Skip to content

Run `yarn install`, `npm install` or `pnpm install` on git hooks automatically

License

Notifications You must be signed in to change notification settings

TxHawks/pnpmhook

 
 

Repository files navigation

pnpmhook

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.

Installation

This package should be used with husky.

pnpm install --save-dev pnpmhook husky

Configuration

You 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"
    }
  }
}

Flags

Prepend these flags to your git command to use them.

  • PNPMHOOK_BYPASS: Run git command bypassing pnpnmhook completely
  • PNPMHOOK_DEBUG: Print debug information
  • PNPMHOOK_DRYRUN: Don't install dependencies, only notify

An example:

PNPMHOOK_BYPASS=true git checkout feature-branch

About

Run `yarn install`, `npm install` or `pnpm install` on git hooks automatically

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%