diff --git a/.husky/install.mjs b/.husky/install.mjs new file mode 100644 index 0000000..ba8e33d --- /dev/null +++ b/.husky/install.mjs @@ -0,0 +1,6 @@ +// Skip Husky install in production and CI +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/.husky/pre-commit b/.husky/pre-commit index 36af219..2312dc5 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,4 +1 @@ -#!/bin/sh -. "$(dirname "$0")/_/husky.sh" - npx lint-staged diff --git a/.husky/pre-push b/.husky/pre-push index 0473f6c..a21a749 100755 --- a/.husky/pre-push +++ b/.husky/pre-push @@ -1,4 +1 @@ -#!/bin/sh -. "$(dirname "$0")/_/husky.sh" - npx commitlint --from origin/main --to HEAD --verbose diff --git a/package-lock.json b/package-lock.json index 4bf7730..4c6c6a2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7,7 +7,6 @@ "": { "name": "@opengovsg/mockpass", "version": "4.2.0", - "hasInstallScript": true, "license": "MIT", "dependencies": { "base-64": "^1.0.0", diff --git a/package.json b/package.json index 4088d3c..7c3d336 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "cz": "git-cz", "lint": "eslint lib", "lint-fix": "eslint --fix lib", - "postinstall": "husky install", + "prepare": "node .husky/install.mjs", "prepublishOnly": "pinst --disable", "postpublish": "pinst --enable" },