Skip to content

Instantly share code, notes, and snippets.

@joernb
Created February 3, 2022 20:51
Show Gist options
  • Save joernb/774cfef4f2c5fedf2da72fb60aaf94aa to your computer and use it in GitHub Desktop.
Save joernb/774cfef4f2c5fedf2da72fb60aaf94aa to your computer and use it in GitHub Desktop.
Run npm script with .env vars
{
"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