Skip to content

Commit

Permalink
chore(repo): setup hook to notify on package lock changes (nrwl#16972)
Browse files Browse the repository at this point in the history
  • Loading branch information
AgentEnder authored May 12, 2023
1 parent 024193f commit 729a549
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .husky/post-checkout
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh
changedFiles="$(git diff-tree -r --name-only --no-commit-id $1 $2)"
node ./scripts/notify-lockfile-changes.js $changedFiles
3 changes: 3 additions & 0 deletions .husky/post-merge
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh
changedFiles="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)"
node ./scripts/notify-lockfile-changes.js $changedFiles
9 changes: 9 additions & 0 deletions scripts/notify-lockfile-changes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
if (process.argv.slice(2).some((arg) => arg.includes('pnpm-lock.yaml'))) {
console.warn(
[
'⚠️ ----------------------------------------------------------------------------------------- ⚠️',
'⚠️ pnpm-lock.yaml changed, please run `pnpm install` to ensure your packages are up to date. ⚠️',
'⚠️ ----------------------------------------------------------------------------------------- ⚠️',
].join('\n')
);
}

0 comments on commit 729a549

Please sign in to comment.