File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ // Skip Husky installation in environments where dev dependencies may be omitted
2+ if (
3+ process . env . NODE_ENV === 'production' ||
4+ process . env . CI === 'true' ||
5+ process . env . HUSKY === '0'
6+ ) {
7+ process . exit ( 0 ) ;
8+ }
9+
10+ try {
11+ const { install } = await import ( 'husky' ) ;
12+
13+ // Only call install if it exists (safe check)
14+ if ( typeof install === 'function' ) {
15+ install ( ) ;
16+ }
17+ } catch ( error ) {
18+ // Ignore error if husky is not installed (e.g., production/CI environments)
19+ if (
20+ error ?. code === 'ERR_MODULE_NOT_FOUND' ||
21+ error ?. message ?. includes ( "Cannot find package 'husky'" )
22+ ) {
23+ process . exit ( 0 ) ;
24+ }
25+
26+ // Re-throw other unexpected errors
27+ throw error ;
28+ }
Original file line number Diff line number Diff line change 9393 "docker:cover:integration" : " pnpm run docker:integration:run pnpm exec nyc --report-dir .coverage/integration pnpm run test:integration -- -p cover" ,
9494 "postdocker:integration:run" : " docker compose -f ./test/integration/docker-compose.yml down" ,
9595 "prepack" : " pnpm run build" ,
96- "prepare" : " husky install || exit 0 " ,
96+ "prepare" : " node .husky/ install.mjs " ,
9797 "changeset:version" : " changeset version && pnpm install --lockfile-only" ,
9898 "changeset:publish" : " changeset publish"
9999 },
You can’t perform that action at this time.
0 commit comments