From 85358db80d6ccb5f7bc9a0b4d558ac6dd2468394 Mon Sep 17 00:00:00 2001 From: isaacs Date: Mon, 22 Jul 2019 16:19:40 -0700 Subject: [PATCH] npm-lifecycle@3.1.2 --- node_modules/.gitignore | 1 - node_modules/npm-lifecycle/CHANGELOG.md | 10 +++++++ node_modules/npm-lifecycle/index.js | 39 +++++++++++++++---------- node_modules/npm-lifecycle/package.json | 21 ++++++------- package-lock.json | 6 ++-- package.json | 2 +- 6 files changed, 49 insertions(+), 30 deletions(-) diff --git a/node_modules/.gitignore b/node_modules/.gitignore index 6fc6080041e4b..c87e18016a8ad 100644 --- a/node_modules/.gitignore +++ b/node_modules/.gitignore @@ -11,7 +11,6 @@ /@babel/types /@blueoak/list /@types/caseless -/@types/form-data /@types/node /@types/request /@types/tough-cookie diff --git a/node_modules/npm-lifecycle/CHANGELOG.md b/node_modules/npm-lifecycle/CHANGELOG.md index 1bdbe8f57e2fd..1a8c916bf3d39 100644 --- a/node_modules/npm-lifecycle/CHANGELOG.md +++ b/node_modules/npm-lifecycle/CHANGELOG.md @@ -2,6 +2,16 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. + +## [3.1.2](https://github.com/npm/lifecycle/compare/v3.1.1...v3.1.2) (2019-07-22) + + +### Bug Fixes + +* do not exclude /path/ from process.env copying ([53e6318](https://github.com/npm/lifecycle/commit/53e6318)) + + + # [3.1.0](https://github.com/npm/lifecycle/compare/v3.0.0...v3.1.0) (2019-07-17) diff --git a/node_modules/npm-lifecycle/index.js b/node_modules/npm-lifecycle/index.js index b2a25eed3bd71..0972870b18c97 100644 --- a/node_modules/npm-lifecycle/index.js +++ b/node_modules/npm-lifecycle/index.js @@ -21,21 +21,28 @@ const resolveFrom = require('resolve-from') const DEFAULT_NODE_GYP_PATH = resolveFrom(__dirname, 'node-gyp/bin/node-gyp') const hookStatCache = new Map() -let PATH = 'PATH' +let PATH = isWindows ? 'Path' : 'PATH' +exports._pathEnvName = PATH +const delimiter = path.delimiter // windows calls its path 'Path' usually, but this is not guaranteed. -if (isWindows) { - PATH = 'Path' - if (!process.env[PATH]) { - Object.keys(process.env).forEach(function (e) { - if (e.match(/^PATH$/i)) { - PATH = e - } - }) - } +// merge them all together in the order they appear in the object. +const mergePath = env => + Object.keys(env).filter(p => /^path$/i.test(p) && env[p]) + .map(p => env[p].split(delimiter)) + .reduce((set, p) => set.concat(p.filter(p => !set.includes(p))), []) + .join(delimiter) +exports._mergePath = mergePath + +const setPathEnv = (env, path) => { + // first ensure that the canonical value is set. + env[PATH] = path + // also set any other case values, because windows. + Object.keys(env) + .filter(p => p !== PATH && /^path$/i.test(p)) + .forEach(p => { env[p] = path }) } - -exports._pathEnvName = PATH +exports._setPathEnv = setPathEnv function logid (pkg, stage) { return pkg._id + '~' + stage + ':' @@ -127,8 +134,10 @@ function lifecycle_ (pkg, stage, wd, opts, env, cb) { pathArr.push(path.dirname(process.execPath)) } - if (env[PATH]) pathArr.push(env[PATH]) - env[PATH] = pathArr.join(isWindows ? ';' : ':') + const existingPath = mergePath(env) + if (existingPath) pathArr.push(existingPath) + const envPath = pathArr.join(isWindows ? ';' : ':') + setPathEnv(env, envPath) var packageLifecycle = pkg.scripts && pkg.scripts.hasOwnProperty(stage) @@ -379,7 +388,7 @@ function makeEnv (data, opts, prefix, env) { if (!env) { env = {} for (var i in process.env) { - if (!i.match(/^npm_/) && (!i.match(/^PATH$/i) || i === PATH)) { + if (!i.match(/^npm_/)) { env[i] = process.env[i] } } diff --git a/node_modules/npm-lifecycle/package.json b/node_modules/npm-lifecycle/package.json index 1b81484c8087c..80cbae3a5fb4f 100644 --- a/node_modules/npm-lifecycle/package.json +++ b/node_modules/npm-lifecycle/package.json @@ -1,19 +1,19 @@ { - "_from": "npm-lifecycle@3.1.0", - "_id": "npm-lifecycle@3.1.0", + "_from": "npm-lifecycle@3.1.2", + "_id": "npm-lifecycle@3.1.2", "_inBundle": false, - "_integrity": "sha512-G11f/KhHvvrBN9uPG9rj/3plT5eu2T4NKurP4diIDnHQHleppPhT2SaCJq0DQG2WHrAgI+8pH0kKQlwbAwHQNg==", + "_integrity": "sha512-nhfOcoTHrW1lJJlM2o77vTE2RWR4YOVyj7YzmY0y5itsMjEuoJHteio/ez0BliENEPsNxIUQgwhyEW9dShj3Ww==", "_location": "/npm-lifecycle", "_phantomChildren": {}, "_requested": { "type": "version", "registry": true, - "raw": "npm-lifecycle@3.1.0", + "raw": "npm-lifecycle@3.1.2", "name": "npm-lifecycle", "escapedName": "npm-lifecycle", - "rawSpec": "3.1.0", + "rawSpec": "3.1.2", "saveSpec": null, - "fetchSpec": "3.1.0" + "fetchSpec": "3.1.2" }, "_requiredBy": [ "#USER", @@ -21,9 +21,9 @@ "/libcipm", "/libnpm" ], - "_resolved": "https://registry.npmjs.org/npm-lifecycle/-/npm-lifecycle-3.1.0.tgz", - "_shasum": "684d8340e85c8ad1893c231e50903d1b78f46af4", - "_spec": "npm-lifecycle@3.1.0", + "_resolved": "https://registry.npmjs.org/npm-lifecycle/-/npm-lifecycle-3.1.2.tgz", + "_shasum": "06f2253ea3b9e122ce3e55e3496670a810afcc84", + "_spec": "npm-lifecycle@3.1.2", "_where": "/Users/isaacs/dev/npm/cli", "author": { "name": "Mike Sherov" @@ -77,9 +77,10 @@ "prerelease": "npm t", "pretest": "standard", "release": "standard-version -s", + "snap": "TAP_SNAPSHOT=1 npm test", "test": "tap -J --cov test/*.js", "update-coc": "weallbehave -o . && git add CODE_OF_CONDUCT.md && git commit -m 'docs(coc): updated CODE_OF_CONDUCT.md'", "update-contrib": "weallcontribute -o . && git add CONTRIBUTING.md && git commit -m 'docs(contributing): updated CONTRIBUTING.md'" }, - "version": "3.1.0" + "version": "3.1.2" } diff --git a/package-lock.json b/package-lock.json index 3b6bd1ad7ee37..c218d0fa93809 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3774,9 +3774,9 @@ "dev": true }, "npm-lifecycle": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/npm-lifecycle/-/npm-lifecycle-3.1.0.tgz", - "integrity": "sha512-G11f/KhHvvrBN9uPG9rj/3plT5eu2T4NKurP4diIDnHQHleppPhT2SaCJq0DQG2WHrAgI+8pH0kKQlwbAwHQNg==", + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/npm-lifecycle/-/npm-lifecycle-3.1.2.tgz", + "integrity": "sha512-nhfOcoTHrW1lJJlM2o77vTE2RWR4YOVyj7YzmY0y5itsMjEuoJHteio/ez0BliENEPsNxIUQgwhyEW9dShj3Ww==", "requires": { "byline": "^5.0.0", "graceful-fs": "^4.1.15", diff --git a/package.json b/package.json index 6abbccef83b36..64252fcb45ee1 100644 --- a/package.json +++ b/package.json @@ -99,7 +99,7 @@ "npm-audit-report": "^1.3.2", "npm-cache-filename": "~1.0.2", "npm-install-checks": "~3.0.0", - "npm-lifecycle": "^3.1.0", + "npm-lifecycle": "^3.1.2", "npm-package-arg": "^6.1.0", "npm-packlist": "^1.4.4", "npm-pick-manifest": "^2.2.3",