doc: workaround to npm shrinkwrap development dependencies bug

There are some npm versions that for some strange reason will attempt to
put *every* single development dependency in the `npm-shinkwrap.json`
file when editing the dependencies list.

This commit describes a workaround I've found to ensure only production
dependencies are added to the file.

I also renamed our `npm run shrinkwrap` script to `npm run
clean-shrinkwrap` since in some recent versions of npm, running `npm
shrinkwrap` will trigger our custom script instead of the original
implementation.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
This commit is contained in:
Juan Cruz Viotti 2017-01-30 17:13:37 -04:00
parent ea95177e94
commit 16340b412a
3 changed files with 15 additions and 4 deletions

View File

@ -44,9 +44,20 @@ Use the following steps to ensure everything goes flawlessly:
- Install the new version of the dependency. For example: `npm install --save
<package>@<version>`. This will update the `npm-shrinkwrap.json` file.
- Run `npm run shrinkwrap`. This is a small script that ensures that operating
system specific dependencies that could get included in the previous step are
removed from `npm-shrinkwrap.json`.
- Run `npm run clean-shrinkwrap`. This is a small script that ensures that
operating system specific dependencies that could get included in the
previous step are removed from `npm-shrinkwrap.json`.
Some npm versions seem to contain an issue were all development dependencies
will be included in `npm-shrinkwrap.json` when attempting to modify it (e.g: by
`npm install`, `npm uninstall`, etc). A bulletproof way to ensure only the
necessary dependencies get added is to run the following commands:
```sh
make electron-develop
npm prune --production
npm shrinkwrap
```
- Commit *both* `package.json` and `npm-shrinkwrap.json`.

View File

@ -18,7 +18,7 @@
"lint": "npm run jslint && npm run scsslint",
"changelog": "versionist",
"start": "electron lib/start.js",
"shrinkwrap": "node ./scripts/shrinkwrap.js"
"clean-shrinkwrap": "node ./scripts/clean-shrinkwrap.js"
},
"author": "Juan Cruz Viotti <juan@resin.io>",
"license": "Apache-2.0",