balena-cli/automation/test-lock-deduplicated.sh
Vipul Gupta (@vipulgupta2048) 180c59913b
Add dedupe commands to commit hook
Change-type: patch
Signed-off-by: Vipul Gupta (@vipulgupta2048) <vipulgupta2048@gmail.com>
2023-11-08 22:17:18 +05:30

13 lines
371 B
Bash
Executable File

#!/bin/bash
set -e
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 "** Please run 'npm ci', followed by 'npm dedupe' **";
exit 1;
fi