Running npm version without --package-lock-only causes a full npm install to happen just to update the package lock file. In my CI, where the release script runs in an isolated container, this causes a cascade of problems:
npm version triggers npm install (causing 2000 packages to be downloaded unnecessarily)
npm install triggers npm prepare
npm prepare installs Husky hooks
git push triggers those Husky hooks to run my test suite (which takes 10+ minutes)
- tests fail because the release-container is not set up for them
- the semantic release has failed because the git push was prevented by Husky
I could solve some of the issues in any steps along the way, but the root of the problem lies in the npm install that gets executed by the semantic-release/npm prepare step.
All that's needed to fix it is the addition of the --package-lock-only flag in the npm version command:
|
["version", version, "--userconfig", npmrc, "--no-git-tag-version", "--allow-same-version"], |
Running
npm versionwithout--package-lock-onlycauses a fullnpm installto happen just to update the package lock file. In my CI, where the release script runs in an isolated container, this causes a cascade of problems:npm versiontriggersnpm install(causing 2000 packages to be downloaded unnecessarily)npm installtriggersnpm preparenpm prepareinstalls Husky hooksgit pushtriggers those Husky hooks to run my test suite (which takes 10+ minutes)I could solve some of the issues in any steps along the way, but the root of the problem lies in the
npm installthat gets executed by the semantic-release/npm prepare step.All that's needed to fix it is the addition of the
--package-lock-onlyflag in thenpm versioncommand:npm/lib/prepare.js
Line 16 in 3e262c2