From 6a8b5e219a91f947955daabff2c324f3166d5fa5 Mon Sep 17 00:00:00 2001 From: "zhouxiao.shaw" Date: Wed, 6 Dec 2023 18:24:45 +0800 Subject: [PATCH] chore: optimize husky commit hook --- .husky/commit-msg | 14 +------------- package.json | 4 +++- 2 files changed, 4 insertions(+), 14 deletions(-) mode change 100644 => 100755 .husky/commit-msg diff --git a/.husky/commit-msg b/.husky/commit-msg old mode 100644 new mode 100755 index 7e9b3075ba8..df96e691d62 --- a/.husky/commit-msg +++ b/.husky/commit-msg @@ -1,17 +1,5 @@ #!/usr/bin/env sh . "$(dirname -- "$0")/_/husky.sh" -export NVM_DIR="$HOME/.nvm/nvm.sh" -if [ -f "$NVM_DIR" ]; then - . "$(dirname $NVM_DIR)/nvm.sh" - - export NVM_DIR="$HOME/.nvm" - a=$(nvm ls | grep 'node') - b=${a#*(-> } - v=${b%%[)| ]*} - - export PATH="$NVM_DIR/versions/node/$v/bin:$PATH" -fi - -npx --no -- commitlint --edit +npm run commitlint ${1} diff --git a/package.json b/package.json index ac62d1bfa47..163ce361275 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,9 @@ "sync:pullMFTypes": "concurrently \"node ./packages/enhanced/pullts.js\"", "app:next:dev": "nx run-many --target=build --configuration=development -p enhanced utils nextjs-mf && nx run-many --target=serve --configuration=development -p 3000-home 3001-shop 3002-checkout", "app:next:prod": "nx run-many --target=build --configuration=production -p 3000-home 3001-shop 3002-checkout && nx run-many --target=serve --configuration=production -p 3000-home 3001-shop 3002-checkout", - "app:runtime:dev": "nx run-many --target=serve -p runtime_demo_host runtime_demo_remote" + "app:runtime:dev": "nx run-many --target=serve -p runtime_demo_host runtime_demo_remote", + "commitlint": "commitlint --edit", + "prepare": "husky install" }, "dependencies": { "adm-zip": "0.5.10",