Skip to content

Instantly share code, notes, and snippets.

@indexzero
Last active August 29, 2015 14:25
Show Gist options
  • Save indexzero/aaf33ae307fa64a7fe12 to your computer and use it in GitHub Desktop.
Save indexzero/aaf33ae307fa64a7fe12 to your computer and use it in GitHub Desktop.
TIL that env var values in "scripts" in package.json files are respected by npm.
console.log('process.env.THIS_WORKS=%s', process.env.THIS_WORKS);
{
"name": "npm-scripts-envvar",
"version": "1.0.0",
"description": "Test to see if envvars work in \"npm scripts\"",
"main": "index.js",
"scripts": {
"test": "THIS_WORKS=test node index.js"
},
"author": "Charlie Robbins <[email protected]>",
"license": "MIT"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment