Skip to content

fix: omit Husky from published package installs - #206

Draft
Pybsama wants to merge 1 commit into
aws:mainfrom
Pybsama:codex/fix-package-postinstall-husky
Draft

fix: omit Husky from published package installs#206
Pybsama wants to merge 1 commit into
aws:mainfrom
Pybsama:codex/fix-package-postinstall-husky

Conversation

@Pybsama

@Pybsama Pybsama commented Jul 30, 2026

Copy link
Copy Markdown

Issue #, if available:

Closes #205

Description of changes:

The published package currently runs postinstall: husky, but Husky is a
development dependency and is not available in a clean consumer install.

This keeps the repository's Yarn 3 contributor hook setup intact while using
Husky's documented Yarn publishing pattern:

  • pinst --disable runs before packing, so the published manifest has no
    active postinstall;
  • pinst --enable restores the source manifest after packing; and
  • a package-install smoke test packs the real artifact and installs it in an
    offline, development-dependency-free npm consumer.

The smoke test places a failing Husky guard ahead of the repository's own
node_modules/.bin, so the regression cannot pass by accidentally finding the
checkout's development dependency. It also restores the source manifest in a
finally block if packing fails.

Validation:

  • corepack yarn install --immutable
  • corepack yarn test --runInBand (25/25)
  • corepack yarn test:package-install
  • corepack yarn lint
  • corepack yarn typescript
  • corepack yarn prepare
  • real npm pack followed by offline npm and Yarn 3 consumer installs
  • corepack yarn prettier --check package.json .github/workflows/pr.yaml scripts/test-package-install.js
  • git diff --check

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

postinstall script fails when package is installed as a dependency - husky: command not found

1 participant