ci: ensure npm ci does not dirty package-lock via npm-force-resolutions #694
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.
Description
There are security vulnerabilities that are sometimes discovered in npm packages that are dependencies of dependencies which we do not directly control. To overcome this limitation, we us
npm-force-resolutions
and theresolutions
field underpackage.json
to forcibly resolve the packages to use the proper dependencies that resolved the security vulnerabilities. The problem is that the resolution process should only occur during the package installation step (npm install
) but NOT during CI gathering of dependencies (npm ci
). Currently it occurs in both. This PR uses apostshrinkwrap
script to runnpm-force-resolutions
, which only occurs fornpm install
and notnpm ci
.@hamidzr discovered this post that provides basis of this solution:
rogeriochaves/npm-force-resolutions#10 (comment)
Test Plan
Check that...
npm ci
does not alter any files, especiallypackage.json
andpackage-lock.json
.npm install
does runnpx npm-force-resolutions
(postshrinkwrap
script).Commentary (optional)