Using npm link to update dependencies during development is kind of a pain.
Does NPM have the equivalent of Composer's "--prefer-source" option to install dependencies as a version control repo?
No
Git repos are never cloned directly into your application. They always follow this process:
- npm does a bare clone of the repo into $TMPDIR
- npm clones that clone into a directory in your npm cache, and then checks out the treeish that the branch requested mapped to.
- npm produces an installable package tarball from that checkout that is then placed into your npm cache.
- that cached tarball is installed into your application.
If you want to be working directly from the Git checkout of your project, with all its submodules intact, your best bet is probably to npm link for the project with the submodules, and then npm link it into the package consuming it. It's more unwieldy than using Git URLs in your package.json, but it will give you the control you need about how files are laid out.
Source: https://github.com/npm/npm/issues/6700#issuecomment-71302066
Feature request for npm at Github for this feature: https://github.com/npm/npm/issues/7375
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With