chore(husky): change prepare script to postinstall and add setup script#6944
chore(husky): change prepare script to postinstall and add setup script#6944theo-sim-dev wants to merge 6 commits intoaxios:v1.xfrom
Conversation
|
please check it seems you included a sub module? |
@jasonsaayman Oops, it was added by accident during testing. Just removed it! |
no worries thanks 🙌 |
jasonsaayman
left a comment
There was a problem hiding this comment.
something is off with the tests, please check it out
@jasonsaayman Can you please clarify how I can reproduce the issue? I ran |
|
Thanks @theo-sim-dev. I have already merged a fix for this as part of modernisation. Closing. |
Fixes #6931
Summary
This PR replaces the use of the
preparescript with a saferpostinstall-based Husky setup that only runs in contributor environments. This ensures that consumers of Axios can install it from GitHub or tarballs without encountering errors related to Husky, even in environments without a.gitdirectory.Previously, Axios's
preparescript included Husky install logic that assumed the presence of a.gitdirectory. This caused installation failures in environments such as:npm install github:axios/axios)To prevent this while preserving automatic Git hook setup for contributors, this change moves the Husky logic into a guarded shell script executed during
postinstall, but only when a.gitdirectory is present.Changes
"prepare"and"prepare:hooks"scripts frompackage.json"postinstall"with a guardedscripts/setup-husky.shscript that:husky install(same as before)commit-msghook usingcommitlint(same as before).git/is not present (new).npmignoreto ensure the script is included in the published tarball. Otherwise,npm installwill fail.npxwith direct binary references for environments wherenpxmay not be available