summaryrefslogtreecommitdiff
path: root/deps/npm/lib/install/action
diff options
context:
space:
mode:
authorKat Marchán <kzm@sykosomatic.org>2017-05-28 21:04:08 -0700
committerJames M Snell <jasnell@gmail.com>2017-05-29 09:36:12 -0700
commit6083c4dc102b4da306faaf81469e33687f30daf1 (patch)
treeb2d3a62f03531e9ca7c3a7eebbf562efc91b15ca /deps/npm/lib/install/action
parentac2e8820c4c4188e54afa0cf0d9fea8ec823e15d (diff)
downloadnode-new-6083c4dc102b4da306faaf81469e33687f30daf1.tar.gz
deps: upgrade npm to 5.0.0
PR-URL: https://github.com/nodejs/node/pull/13276 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Diffstat (limited to 'deps/npm/lib/install/action')
-rw-r--r--deps/npm/lib/install/action/extract.js11
-rw-r--r--deps/npm/lib/install/action/finalize.js5
-rw-r--r--deps/npm/lib/install/action/preinstall.js3
-rw-r--r--deps/npm/lib/install/action/refresh-package-json.js8
4 files changed, 12 insertions, 15 deletions
diff --git a/deps/npm/lib/install/action/extract.js b/deps/npm/lib/install/action/extract.js
index 7839177850..437d7e57f7 100644
--- a/deps/npm/lib/install/action/extract.js
+++ b/deps/npm/lib/install/action/extract.js
@@ -10,22 +10,19 @@ const moduleName = require('../../utils/module-name.js')
const moduleStagingPath = require('../module-staging-path.js')
const move = BB.promisify(require('../../utils/move.js'))
const npa = require('npm-package-arg')
-const npm = require('../../npm.js')
const packageId = require('../../utils/package-id.js')
const pacote = require('pacote')
-const pacoteOpts = require('../../config/pacote')
+let pacoteOpts
const path = require('path')
module.exports = extract
function extract (staging, pkg, log) {
log.silly('extract', packageId(pkg))
- const up = npm.config.get('unsafe-perm')
- const user = up ? null : npm.config.get('user')
- const group = up ? null : npm.config.get('group')
const extractTo = moduleStagingPath(staging, pkg)
+ if (!pacoteOpts) {
+ pacoteOpts = require('../../config/pacote')
+ }
const opts = pacoteOpts({
- uid: user,
- gid: group,
integrity: pkg.package._integrity
})
return pacote.extract(
diff --git a/deps/npm/lib/install/action/finalize.js b/deps/npm/lib/install/action/finalize.js
index 1e86475710..ba38e602f8 100644
--- a/deps/npm/lib/install/action/finalize.js
+++ b/deps/npm/lib/install/action/finalize.js
@@ -23,10 +23,11 @@ module.exports = function (staging, pkg, log) {
const requested = pkg.package._requested || getRequested(pkg)
if (requested.type === 'directory') {
+ const relative = path.relative(path.dirname(pkg.path), pkg.realpath)
return makeParentPath(pkg.path)
- .then(() => symlink(pkg.realpath, pkg.path, 'junction'))
+ .then(() => symlink(relative, pkg.path, 'junction'))
.catch((ex) => {
- return rimraf(pkg.path).then(() => symlink(pkg.realpath, pkg.path, 'junction'))
+ return rimraf(pkg.path).then(() => symlink(relative, pkg.path, 'junction'))
})
} else {
return makeParentPath(pkg.realpath)
diff --git a/deps/npm/lib/install/action/preinstall.js b/deps/npm/lib/install/action/preinstall.js
index a6f85b0a5a..a16082ef73 100644
--- a/deps/npm/lib/install/action/preinstall.js
+++ b/deps/npm/lib/install/action/preinstall.js
@@ -1,9 +1,8 @@
'use strict'
var lifecycle = require('../../utils/lifecycle.js')
var packageId = require('../../utils/package-id.js')
-var moduleStagingPath = require('../module-staging-path.js')
module.exports = function (staging, pkg, log, next) {
log.silly('preinstall', packageId(pkg))
- lifecycle(pkg.package, 'preinstall', moduleStagingPath(staging, pkg), false, false, next)
+ lifecycle(pkg.package, 'preinstall', pkg.path, false, false, next)
}
diff --git a/deps/npm/lib/install/action/refresh-package-json.js b/deps/npm/lib/install/action/refresh-package-json.js
index 337be0caf2..6910803451 100644
--- a/deps/npm/lib/install/action/refresh-package-json.js
+++ b/deps/npm/lib/install/action/refresh-package-json.js
@@ -10,13 +10,13 @@ module.exports = function (staging, pkg, log) {
return readJson(path.join(pkg.path, 'package.json'), false).then((metadata) => {
Object.keys(pkg.package).forEach(function (key) {
- if (key !== '_injectedFromShrinkwrap' && !isEmpty(pkg.package[key])) {
+ if (!isEmpty(pkg.package[key])) {
metadata[key] = pkg.package[key]
- if (key === '_resolved' && metadata[key] == null && pkg.package._injectedFromShrinkwrap) {
- metadata[key] = pkg.package._injectedFromShrinkwrap.resolved
- }
}
})
+ if (metadata._resolved == null && pkg.fakeChild) {
+ metadata._resolved = pkg.fakeChild.resolved
+ }
// These two sneak in and it's awful
delete metadata.readme
delete metadata.readmeFilename