@kutur-kit/strict
A pnpm hook that requires exact catalog versions for workspace dependencies, exact release-age exclusions and script names that no pnpm command takes.
A pnpm hook that requires exact catalog versions for workspace dependencies, exact release-age exclusions and script names that no pnpm command takes. It fails pnpm install, including frozen installs in CI, when:
dependencies,devDependenciesoroptionalDependenciesuse a version that is notcatalog:orworkspace:;- a catalog entry used by those fields is not an exact version. Exact npm aliases such as
npm:@scope/ui@1.2.3pass; - a script has the name of a pnpm command or alias, such as
deployorwhy.pnpm deployruns pnpm's command, not the script. Scripts that pnpm runs by name pass:test,start,stopandrestart, and the lifecycle scriptsinstall,publishandversion.clean,purge,rebuild,rbandtaskspass in the root, and in a workspace package only when the root has the same script, sincepnpm -r cleanfrom the root otherwise runs pnpm'sclean; - a
minimumReleaseAgeExcludeentry is not one package name with an exact version, asname@1.2.3. Name patterns such as@scope/*,!nameorname?also exempt other packages. Bare names, ranges and tags also exempt versions published later.name@1.2.3 || 1.2.4, which pnpm writes for several versions of one package, passes; minimumReleaseAgeExcludePruneis nottrue. pnpm adds exclusions on its own; with this setting it removes them once the lockfile no longer uses those versions.
peerDependencies may use any range, directly or through a catalog that only peers use. The hook checks the root package.json and every workspace package. It reports all problems at once.
Setup
Tested with pnpm 12 and Node.js 26. Add the package as a config dependency:
pnpm add --config @kutur-kit/strict@alphaThen load its pnpmfile and turn on exclusion pruning in pnpm-workspace.yaml:
pnpmfile:
- node_modules/.pnpm-config/@kutur-kit/strict/pnpmfile.mjs
minimumReleaseAgeExcludePrune: trueSetting pnpmfile replaces the default .pnpmfile.mjs; list it too if the workspace has one. The lockfile records a checksum of every pnpmfile, so upgrading the hook also updates pnpm-lock.yaml.
Limitations
overrides and packageExtensions in pnpm-workspace.yaml may still use ranges.
The command names are those that pnpm 12.21 lists in pnpm --help, and its unlisted pm. A command added in a later pnpm goes unchecked until the hook lists it.