Skip to content

Latest commit

 

History

History
9 lines (5 loc) · 686 Bytes

npm-scripts-cicd-differentitation.adoc

File metadata and controls

9 lines (5 loc) · 686 Bytes

Status of this document: in progress

We need to differentitate in between NPM script execution on localhosts vs. within CI/CD environments. That for we’re using is-ci, which is recommended e.g. by Husky.

Other solutions like checking for environment variables directly might fail in different usage contexts (for example Microsoft PowerShell seems to be very specific about the allowed signs within a script):

(…) most Continuous Integration Servers set a CI environment variable. You can use it in your hooks to detect if it’s running in a CI.

[ -n "$CI" ] && exit 0