npm Community Forum (Archive)

The npm community forum has been discontinued.

To discuss usage of npm, visit the GitHub Support Community.

New subcommand "npm clone"

I just got into this one situation that usually drives me (just a little bit) insane.
I am required to clone the source of a package, then afterwards I need to step into the directory to install the dependencies too.
I know this could be resolved with an alias command, but … maybe it’s time for a subcommand npm clone?
That way we could prepare a package for being worked on in a single utility command that may also have other useful options.

Cloning from a source

npm clone <packageName>

would go look into the repository configuration of packageName on the NPM registry (default, can be overridden with --registry as usual) and clones it from there with whatever program can be found that might make sense.

"type": "git" -> use git
"type": "svn" -> use whatever can handle that.

npm clone <URL>

would clone from the given URL and then do the same as above.

After cloning

Unless an option like --no-install is given, npm clone could then install the dependencies for that package or run a script!


Option Meaning
-w / --work-dir Where to run the npm commands (such as npm install)
-r / --run A script to run after cloning
-n / --no-install No automatic install will be run


I am looking forward to feedbac and other ideas by you guys :slight_smile: