Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can NPM install the .git folder for dependencies?

Tags:

node.js

npm

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?

like image 584
jdewit Avatar asked May 07 '14 20:05

jdewit


1 Answers

No

Git repos are never cloned directly into your application. They always follow this process:

  1. npm does a bare clone of the repo into $TMPDIR
  2. npm clones that clone into a directory in your npm cache, and then checks out the treeish that the branch requested mapped to.
  3. npm produces an installable package tarball from that checkout that is then placed into your npm cache.
  4. 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

like image 169
Motin Avatar answered Oct 26 '22 04:10

Motin