Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add dedupe commands to commit hook #2698

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 6 additions & 13 deletions automation/test-lock-deduplicated.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,12 @@

set -e

cp npm-shrinkwrap.json npm-shrinkwrap.json.old
npm i
npm dedupe
npm i

if ! diff -q npm-shrinkwrap.json npm-shrinkwrap.json.old > /dev/null; then
if npm dedupe --dry-run | grep "remove"; then
cp npm-shrinkwrap.json npm-shrinkwrap.json.old
npm dedupe
diff npm-shrinkwrap.json.old npm-shrinkwrap.json;
rm npm-shrinkwrap.json.old
echo "** npm-shrinkwrap.json was not deduplicated or not fully committed - FAIL **";
echo "** This can usually be fixed with: **";
echo "** git checkout master -- npm-shrinkwrap.json **";
echo "** rm -rf node_modules **";
echo "** npm install && npm dedupe && npm install **";
echo "** Please run 'npm ci', followed by 'npm dedupe' **";
exit 1;
fi

rm npm-shrinkwrap.json.old
fi
24 changes: 12 additions & 12 deletions npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
},
"husky": {
"hooks": {
"pre-commit": "node automation/check-npm-version.js && ts-node automation/check-doc.ts"
"pre-commit": "node automation/check-npm-version.js && ts-node automation/check-doc.ts && npm run test:shrinkwrap"
}
},
"oclif": {
Expand Down
Loading