Skip to content
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

allow to initialize template project in actual folder instead of subfolder. #8448

Closed
4 tasks done
Mlocik97 opened this issue Jun 2, 2022 · 5 comments · Fixed by #8501
Closed
4 tasks done

allow to initialize template project in actual folder instead of subfolder. #8448

Mlocik97 opened this issue Jun 2, 2022 · 5 comments · Fixed by #8501
Labels
documentation Improvements or additions to documentation p2-nice-to-have Not breaking anything but nice to have (priority)

Comments

@Mlocik97
Copy link

Mlocik97 commented Jun 2, 2022

Clear and concise description of the problem

doing npm init vite -- --template svelte ask me for project directory, if I don't fill it, it will create project inside vite-project subfolder, instead of actual folder.

Suggested solution

allow to initialize template project in actual folder instead of subfolder (if I don't write name or write just . to input).

Alternative

No response

Additional context

No response

Validations

@sapphi-red sapphi-red added documentation Improvements or additions to documentation and removed enhancement: pending triage labels Jun 2, 2022
@sapphi-red
Copy link
Member

If you type . when Project name: is prompt, it will create the project in the current folder.
It might be difficult to find this out.

@Mlocik97
Copy link
Author

Mlocik97 commented Jun 2, 2022

Tried again, somehow it works, still it would be nice, if it would create project in actual folder even when I don't provide any name, than using default name.

@Mlocik97
Copy link
Author

Mlocik97 commented Jun 2, 2022

also if we use . for actual folder, can we derivate pkg.name from actual folder name? It could provide as default value if we don't write own name for package.

@bluwy
Copy link
Member

bluwy commented Jun 5, 2022

I'm not really sure where we can put this "trick" in the CLI. The prompt is Project name: and . isn't actually one. It might take a small re-design of the CLI to better support this, so it may not be as easy as it seems for this issue.

@Mlocik97
Copy link
Author

Mlocik97 commented Jun 5, 2022

I actually like how SvelteKit's CLI works with project name and package name (maybe except that they could allow to choose custom pkg.name via CLI, like Vite's CLI do now, see linked issue).

npm init svelte

ask for name of project (folder), if I press enter (don't write any name), actual folder is used.
pkg.name is derived from name of actual folder.

npm init svelte
if I enter name my-app, subfolder named my-app is created where project is initialized
pkg.name is set to my-app

npm init svelte my-app
same, but didn't ask for name as it's already provided.

I would suggest that Vite works same way, but doesn't automatically set pkg.name, but let user to write what it should be, or if they leave it blank, then use pkg.name = folderName approach.
While it should also validate pkg.name.

This would allow user to choose actual folder easier, as well as set pkg.name.

@sapphi-red sapphi-red added the p2-nice-to-have Not breaking anything but nice to have (priority) label Jun 8, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Jun 24, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Improvements or additions to documentation p2-nice-to-have Not breaking anything but nice to have (priority)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants