File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 5454 if ! git diff --exit-code pnpm-lock.yaml; then
5555 echo "❌ Error: pnpm-lock.yaml was modified after install"
5656 echo "This indicates a pnpm version mismatch or corrupted lockfile"
57- echo "Expected pnpm version: $(node -p 'require(\"./package.json\").packageManager')"
58- echo "Actual pnpm version: $(pnpm --version)"
57+ echo ""
58+ echo "Expected pnpm version from package.json:"
59+ node -p "require('./package.json').packageManager || 'not specified'" || echo "Could not read package.json"
60+ echo ""
61+ echo "Actual pnpm version:"
62+ pnpm --version || echo "pnpm not found"
5963 exit 1
6064 fi
6165 echo "✅ Lockfile is consistent"
Original file line number Diff line number Diff line change 4343 if ! git diff --exit-code pnpm-lock.yaml; then
4444 echo "❌ Error: pnpm-lock.yaml was modified after install"
4545 echo "This indicates a pnpm version mismatch or corrupted lockfile"
46- echo "Expected pnpm version: $(node -p 'require(\"./package.json\").packageManager')"
47- echo "Actual pnpm version: $(pnpm --version)"
46+ echo ""
47+ echo "Expected pnpm version from package.json:"
48+ node -p "require('./package.json').packageManager || 'not specified'" || echo "Could not read package.json"
49+ echo ""
50+ echo "Actual pnpm version:"
51+ pnpm --version || echo "pnpm not found"
4852 exit 1
4953 fi
5054 echo "✅ Lockfile is consistent"
Original file line number Diff line number Diff line change 5858 process . exit ( 0 ) ;
5959
6060} catch ( error ) {
61- console . error ( '❌ Error checking lockfile:' , error . message ) ;
62- // Don't fail the commit, just warn
61+ if ( error . code === 'ENOENT' ) {
62+ console . error ( '❌ Error: Git repository or command not found' ) ;
63+ } else if ( error . message . includes ( 'not a git repository' ) ) {
64+ console . log ( '⚠️ Not in a git repository, skipping lockfile check' ) ;
65+ } else {
66+ console . error ( '❌ Error checking lockfile:' , error . message ) ;
67+ }
68+ // Don't fail the commit, just provide information
6369 process . exit ( 0 ) ;
6470}
Original file line number Diff line number Diff line change 3030 process . exit ( 1 ) ;
3131 }
3232
33- const expectedVersion = packageManager . replace ( 'pnpm@' , '' ) ;
33+ const expectedVersion = packageManager . split ( '@' ) [ 1 ] ;
34+
35+ if ( ! expectedVersion ) {
36+ console . error ( '❌ Error: Could not parse pnpm version from packageManager field' ) ;
37+ process . exit ( 1 ) ;
38+ }
3439
3540 // Get actual pnpm version
3641 let actualVersion ;
You can’t perform that action at this time.
0 commit comments