From 0a37f41a197c2e1acf043713e76555845f6dd0ae Mon Sep 17 00:00:00 2001 From: Mat Warger Date: Tue, 17 Jul 2018 14:48:58 -0500 Subject: [PATCH 1/3] added a header for usage with process.env added a header for usage with process.env to separate section from 'current lifecycle event' and make it easier to find --- doc/misc/npm-scripts.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/misc/npm-scripts.md b/doc/misc/npm-scripts.md index 259bf28a6b7ea..9ceab150fe283 100644 --- a/doc/misc/npm-scripts.md +++ b/doc/misc/npm-scripts.md @@ -176,6 +176,8 @@ whichever stage of the cycle is being executed. So, you could have a single script used for different parts of the process which switches based on what's currently happening. +### process.env usage + Objects are flattened following this format, so if you had `{"scripts":{"install":"foo.js"}}` in your package.json, then you'd see this in the script: From 18914a88cc1602eb32269eb2ee990d89455e6e52 Mon Sep 17 00:00:00 2001 From: Mat Warger Date: Fri, 20 Jul 2018 13:39:00 -0500 Subject: [PATCH 2/3] updated usage example --- doc/misc/npm-scripts.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/doc/misc/npm-scripts.md b/doc/misc/npm-scripts.md index 9ceab150fe283..ea5f342fc7ef8 100644 --- a/doc/misc/npm-scripts.md +++ b/doc/misc/npm-scripts.md @@ -143,7 +143,11 @@ 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". + +#### Usage +As an example, you could access the `npm_package_version` variable by +referencing `process.env.npm_package_version` in your code. ### configuration @@ -176,8 +180,6 @@ whichever stage of the cycle is being executed. So, you could have a single script used for different parts of the process which switches based on what's currently happening. -### process.env usage - Objects are flattened following this format, so if you had `{"scripts":{"install":"foo.js"}}` in your package.json, then you'd see this in the script: From bab4de83326941feebcd03ff530820942ad1acb1 Mon Sep 17 00:00:00 2001 From: Mat Warger Date: Thu, 26 Jul 2018 16:45:52 -0500 Subject: [PATCH 3/3] updated with review recommendation --- doc/misc/npm-scripts.md | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/doc/misc/npm-scripts.md b/doc/misc/npm-scripts.md index ea5f342fc7ef8..e4b90096ae962 100644 --- a/doc/misc/npm-scripts.md +++ b/doc/misc/npm-scripts.md @@ -143,11 +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". - -#### Usage -As an example, you could access the `npm_package_version` variable by -referencing `process.env.npm_package_version` in your code. +`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