I have a postinstall script in a NPM package:
"postinstall": "is-ci || husky install",
If I download the repository using Github UI (Code -> Download ZIP), after extracting it, executing npm install raises Error: .git can't be found:
postinstall error
> [email protected] postinstall /.../simple-icons-font-develop
> is-ci || husky install
/.../simple-icons-font-develop/node_modules/husky/lib/commands/install.js:20
throw new Error(".git can't be found");
^
Error: .git can't be found
at Object.install (/.../simple-icons-font-develop/node_modules/husky/lib/commands/install.js:20:15)
at Object.<anonymous> (/.../simple-icons-font-develop/node_modules/husky/lib/bin.js:43:19)
I can prevent the error doing something like this:
"postinstall": "node -e \"if(require('fs').existsSync('.git')){process.exit(1)}\" || is-ci || husky install",
But it seems a bit hacky. What would be the recommended way to solve this?
I have a
postinstallscript in a NPM package:If I download the repository using Github UI (Code -> Download ZIP), after extracting it, executing
npm installraisesError: .git can't be found:postinstall error
I can prevent the error doing something like this:
But it seems a bit hacky. What would be the recommended way to solve this?