nicojs / node-install-local

Installs npm/yarn packages locally without symlink. Exactly the same as your production installation, no compromises.
106 stars 9 forks source link

Add possibility to ignore package-lock.json #23

Closed seanstern closed 4 years ago

seanstern commented 5 years ago

At present, I'm using your package as part of my build process with a package-lock.json file.

Because the LocalInstaller executes the following command (c.f. line 99 of Local Installer)

exec(`npm install --no save ${toInstall}`)

this means that any use of LocalInstaller will install BOTH any listed local dependencies AND packages listed in package-lock.json. For my purposes, this creates incredibly slow builds (e.g. I would like to ignore devDependencies in staging environments, but install-local installs all my devDependencies).

Would it be possible to create an option or pass a flag such that the LocalInstaller can execute an install and ignore package-lock.json? That is, if there were an option such that LocalInstaller could execute

exec(`npm install --no save --no-package-lock ${toInstall}`)

in certain contexts, that would be really helpful.

I've forked your package to solve this problem in the short term, but if it's possible to incorporate this into this project, I'd be grateful. I can also submit a PR if you can let me know what the preferred default behavior for your project should be.

nicojs commented 4 years ago

Installing dependencies other than "localDependencies" was a side effect from the introduction of package-lock.json files. This behavior was unfortunate and never the intention.

Thanks a ton for bringing this to my attention!