Created
February 3, 2022 20:51
-
-
Save joernb/774cfef4f2c5fedf2da72fb60aaf94aa to your computer and use it in GitHub Desktop.
Run npm script with .env vars
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"scripts": { | |
"env": "NODE_OPTIONS='-r dotenv/config' npm run", // runs a given npm script with .env environment variables | |
"foo": "curl --user $USER:$PASSWORD $ENDPOINT" // sample script, run this with: npm run env foo | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment