Revert "prune: Fix bug where prune --production would remove dev deps… #166
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
… from the lock file"
This change broke the ability to (easily) create a shrinkwrap file that does not include devDeps. The current behavior of a package published with a shrinkwrap file that includes devDeps is that the devDeps get installed when the package is installed globally (not what you would typically want ever). The only way around this was to
prune --prod
during prepack to generate a shrinkwrap without devDeps and publish with that (prior to this change going out). See people here discussing that workaround: (here here)After this change,
prune --prod
no longer modifies the shrinkwrap file to remove devDeps. Reverting this commit restores the old behavior.The situation is already looking like a hack but here are two alternative ideas:
npm shrinkwrap --prod
should remove the devDeps from the lock file (without pruning node_modules so its faster and can be restored by shrink-wrapping without the flag). The goal isn't to prune node_modules, its to get my shrinkwrap file right.I would propose we revert this change in the meantime so that this avenue isn’t broken, until the primary issue is resolved.
This reverts commit cec5be5.
workaround for those interested
npm prune --prod && rm npm-shrinkwrap.json && npm shrinkwrap
Generates the shrinkwrap without devDepsgit checkout -- npm-shrinkwrap.json && npm i
restores devDeps and reinstalls what was removed during the prune.