Fix "rm: .git/hooks: No such file or directory" error in `pnpm install` when the directory is missing (#43142)

* Fix "rm: .git/hooks: No such file or directory" error in `pnpm install`.

* Add changelog.

* Use "rm -rf" instead of "test" command on .git/hooks directory.

We use the "-f" flag so that it does not throw error when the directory does not exist.
This commit is contained in:
Gan Eng Chin 2024-01-09 02:13:42 +08:00 committed by GitHub
parent ce3a38ac55
commit 8b1df6c946
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View File

@ -28,7 +28,7 @@
"clean": "pnpm store prune && git clean -fx **/node_modules && pnpm i",
"preinstall": "npx only-allow pnpm",
"postinstall": "pnpm git:update-hooks",
"git:update-hooks": "if test -d .git; then rm -r .git/hooks && mkdir -p .git/hooks && husky install; else husky install; fi",
"git:update-hooks": "if test -d .git; then rm -rf .git/hooks && mkdir -p .git/hooks && husky install; else husky install; fi",
"create-extension": "node ./tools/create-extension/index.js",
"sync-dependencies": "pnpm exec syncpack -- fix-mismatches",
"utils": "node ./tools/monorepo-utils/dist/index.js"

View File

@ -0,0 +1,4 @@
Significance: patch
Type: dev
Fix "rm: .git/hooks: No such file or directory" error in `pnpm install`.