A little command line utility that allows to strip dependencies from a NPM package.json file
A little command line utility that allows to strip dependencies from a NPM package.json file.
The command basically takes the JSON content of a package.json
file and prints in the standard output the same content but by stripping
the keys dependencies
and devDependencies
.
Globally:
npm install --global package-strip-deps
Or as a dev dependency (e.g. you need it as part of your build process)
npm install --save-dev package-strip-deps
Using “pipes”:
cat package.json | package-strip-deps
Using input redirection:
package-strip-deps < package.json
If you want to save the output to a file just use output redirection:
package-strip-deps < package.json > strippedPackage.json
If you want to keep specific packages from either dependencies
or devDependencies
,
you can use the --keep
flag as follows:
package-strip-deps --keep serverless --keep lodash
In this case serverless
and lodash
will remain in the final JSON and all the other
dependencies will be stripped
Everyone is very welcome to contribute to this project. You can contribute just by submitting bugs or suggesting improvements by opening an issue on GitHub.
Licensed under MIT License. © Luciano Mammino.