A pre-commit (or prek) hook for pnpm.
To ensure the lockfile is up-to-date when package.json or workspace files change:
- repo: https://github.com/mmstroik/pnpm-pre-commit
# pnpm version.
rev: v10.30.2
hooks:
# Update the pnpm lockfile
- id: pnpm-lockTo install/synchronize your dependencies upon branch checkout, pull or rebase:
default_install_hook_types:
- post-checkout
- post-merge
- post-rewrite
repos:
- repo: https://github.com/mmstroik/pnpm-pre-commit
# pnpm version.
rev: v10.30.2
hooks:
- id: pnpm-installIf you want to run hooks on pre-push instead of pre-commit (to speed up commits):
default_install_hook_types: [pre-push]
repos:
- repo: https://github.com/mmstroik/pnpm-pre-commit
# pnpm version.
rev: v10.30.2
hooks:
- id: pnpm-lock
stages: [pre-push]To run a hook on a specific workspace within a monorepo:
- repo: https://github.com/mmstroik/pnpm-pre-commit
# pnpm version.
rev: v10.30.2
hooks:
- id: pnpm-lock
# Change <path/to/workspace> to your relative path
files: <path/to/workspace>/(package\.json|pnpm-lock\.yaml)
args: ["--filter=<path/to/workspace>"]