New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New project creation command #2799
base: main
Are you sure you want to change the base?
Conversation
Very nice! We handle Julia env/packages in two ways. For some things (that we consider really core) we ship all required packages as submodules, and then use a Julia environment where all non stdlib packages are deved. For those env, we never need to instantiate and there is never a need to download anything. For other things, we use more standard env, and then just instantiate them at the beginning of the Julia script, https://github.com/julia-vscode/julia-vscode/blob/master/scripts/packagedev/tagnewpackageversion.jl is an example of that. I think this PR here introduces a mixed case, where PkgTemplates.jl is a submodule, but the env that is used still has things that we don't ship and therefore it needs to be instantiated before use. I think this should fall into either category, though. Given how many deps this whole thing has, I'm probably in favor of not doing this via the submodule route, but instead just put everything into the manifest like a normal package, and then make sure that at the beginning of the Julia script the project gets instantiated. Does that make sense? One other thing is that we already have some limited support for the package butler stuff in the extension, and it would be nice if we would have a new project story that is coherent with that... I'm not entirely sure at the moment what the best way to do that would be... One option is probably to just add support for package butler controlled packages to PkgTemplates.jl, but I'll need to think about it a bit more. |
return | ||
|
||
// TODO: add gihub.user as placeholder | ||
const user = await vscode.window.showInputBox({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we also get that from the built-in VS Code authentication stuff?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found that you can access the global git config through vscode's git api but it requires a repository to exist already which doesn't make a lot of sense here.
const extension = vscode.extensions.getExtension<GitExtension>('vscode.git')
if (extension == null && extension.isActive) {
const gitExtension = extension.exports
const api = gitExtension?.getAPI(1)
const user = await api.repositories[0].getGlobalConfig('github.user')
}
There's simple-git that does the job. Does it make sense to add a dependency?
src/createproject.ts
Outdated
if (user === undefined) | ||
return | ||
|
||
let juliaVersion = await vscode.window.showQuickPick( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we have a good default here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1.6? Or the user's current version? If it's left blank PkgTemplates will use whatever major version that runs the script. That could be the default.
src/createproject.ts
Outdated
{ label: 'GitLabCI', picked: false }, | ||
{ label: 'PkgEvalBadge', picked: false }, | ||
{ label: 'RegisterAction', picked: false }, | ||
{ label: 'TravisCI', picked: false } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a way to provide more descriptions? This is probably pretty hard to understand for a newcomer.
One other thought: might it make sense to have a "short" and simple default UI path here? Say it first asks for the name of the project, and then just whether one wants to configure advanced options. If a user picks the advanced stuff, all the other questions come up, but otherwise it just goes with good defaults? |
That makes sense. Thanks for clearing that up.
Good idea! If you call |
Looking for a cleaner approach
adds a simple-git dependency
3387cc3
to
06452cb
Compare
drops any plugins that require it
@davidanthoff Could you have another look when you get the chance? I've cleaned it up with your suggestions and am pretty happy with it now. |
This adds a
Julia: Create New Project
command that takes you through a series of prompts to get the fields needed to create a new project using PkgTemplates. This is a similar experience to callingPkgTemplates.Template(interactive=true)
.Any suggestions are appreciated!
Ref #2447
Here's what running the command looks like
ProjectCreateStart.mov
Alternatively, you can choose to define the details of the template yourself
Screen.Recording.2023-02-14.at.8.24.20.AM.mov
Then after a bit of thinking PkgTemplates generates the package
ProjectCreateEnd.mov