A sloppy fork of yarnhook which supports pnpm v7 and removes support for other package managers
pnpmhook keeps your node_modules up-to-date when your pnpm-lock.yaml changes due to git
operations like checkout, merge, rebase, pull etc.
This package should be used with husky.
pnpm install --save-dev pnpmhook huskyYou should let pnpmhook handle git hooks that change the dependencies. Example package.json is
as follows:
{
"husky": {
"hooks": {
"post-checkout": "pnpmhook",
"post-merge": "pnpmhook",
"post-rewrite": "pnpmhook"
}
}
}Prepend these flags to your git command to use them.
PNPMHOOK_BYPASS: Run git command bypassing pnpnmhook completelyPNPMHOOK_DEBUG: Print debug informationPNPMHOOK_DRYRUN: Don't install dependencies, only notify
An example:
PNPMHOOK_BYPASS=true git checkout feature-branch