From e2346e7702acccefe6d711168c2b0e0e272e194a Mon Sep 17 00:00:00 2001 From: Mat Warger Date: Tue, 7 Aug 2018 14:33:39 -0600 Subject: [PATCH] docs: added a section for usage with process.env (#14) added a header for usage with process.env to separate section from 'current lifecycle event' and make it easier to find PR-URL: https://github.com/npm/cli/pull/14 Credit: @mwarger Reviewed-By: @zkat --- doc/misc/npm-scripts.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/misc/npm-scripts.md b/doc/misc/npm-scripts.md index 259bf28a6b7e..e4b90096ae96 100644 --- a/doc/misc/npm-scripts.md +++ b/doc/misc/npm-scripts.md @@ -143,7 +143,9 @@ The package.json fields are tacked onto the `npm_package_` prefix. So, for instance, if you had `{"name":"foo", "version":"1.2.5"}` in your package.json file, then your package scripts would have the `npm_package_name` environment variable set to "foo", and the -`npm_package_version` set to "1.2.5" +`npm_package_version` set to "1.2.5". You can access these variables +in your code with `process.env.npm_package_name` and +`process.env.npm_package_version`, and so on for other fields. ### configuration