diff --git a/.husky/install.mjs b/.husky/install.mjs new file mode 100644 index 00000000..29401b5f --- /dev/null +++ b/.husky/install.mjs @@ -0,0 +1,6 @@ +// 在生产环境和 CI 中跳过 Husky 安装 +if (process.env.NODE_ENV === 'production' || process.env.CI === 'true') { + process.exit(0); +} +const husky = (await import('husky')).default; +console.log(husky()); diff --git a/package.json b/package.json index 9b0dd383..cfaafd5f 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,7 @@ "format": "prettier --write --cache .", "format:check": "prettier --check --cache .", "lint": "eslint . --cache", - "prepare": "husky", + "prepare": "node .husky/install.mjs", "test": "jest --no-cache", "clean:dist": "del-cli dist/*", "release": "node scripts/release.mjs"