-
Notifications
You must be signed in to change notification settings - Fork 240
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
[RRFC] npm init should also initialise git repo if it git is installed or the folder is not a git repo already #411
Comments
How would npm know if the dir is already in a repo or not? It might not be in a git repo - it might be mercurial, or svn, or perforce, or something invented next week. |
We could do something similar to cargo https://github.com/rust-lang/cargo/blob/18f25982aeaf6ba77626621de91e65d3d6acaf0c/src/cargo/ops/cargo_new.rs#L674-L703 by default assume the version control is |
What if it’s intended to be a subfolder in a not-yet-inited monorepo? |
You are right it does complicate things rather than simplifying. Since cargo follows different approach to those issues replicating it might not be possible I did not think this through. Thanks for your time @ljharb. Feel free to close this RFC if this could not be taken further. |
Motivation ("The Why")
$ npm init
in a project they usually run$ git init
to set it as a git repocargo init
checks if you have git installed if so initialises it as a git repo (it it already not a git repo)$ cargo --vcs
Example
$ npm init -y
it creates apackage.json
with default values and also initialises it as a git repoHow
Current Behaviour
$ npm init
it asks you a set of questions then it initialises thepackage.json
$ npm init -y
it creates the package.json with default valuesDesired Behaviour
$ npm init
ask question about version control (with git as default value)$ npm init -y
it will createpackage.json
and initialise the folder as git repo if it is already not a git repo and git is installedReferences
The text was updated successfully, but these errors were encountered: