Open analog-nico opened 8 years ago
Since npm@3.10.0 a "postshrinkwrap" lifecycle hook is supported. Integrating shrinkydink becomes very easy with that:
npm@3.10.0
shrinkydink
npm install shrinkydink --save-dev
{ "scripts": { "postshrinkwrap": "shrinkydink ../npm-shrinkwrap.json" } }
When executing npm shrinkwrap shrinkydink is executed in ./node_modules/ folder (= process.cwd()).
npm shrinkwrap
./node_modules/
process.cwd()
You could check process.cwd() if the last folder is "node_modules" and in that case search for ../npm-shrinkwrap.json instead of npm-shrinkwrap.json.
../npm-shrinkwrap.json
npm-shrinkwrap.json
Then the "postshrinkwrap" integration would become even easier:
{ "scripts": { "postshrinkwrap": "shrinkydink" } }
Since
npm@3.10.0
a "postshrinkwrap" lifecycle hook is supported. Integratingshrinkydink
becomes very easy with that:npm install shrinkydink --save-dev
shrinkydink
to the lifecycle hook:When executing
npm shrinkwrap
shrinkydink
is executed in./node_modules/
folder (=process.cwd()
).You could check
process.cwd()
if the last folder is "node_modules" and in that case search for../npm-shrinkwrap.json
instead ofnpm-shrinkwrap.json
.Then the "postshrinkwrap" integration would become even easier: