summaryrefslogtreecommitdiff
path: root/deps/npm/lib
diff options
context:
space:
mode:
Diffstat (limited to 'deps/npm/lib')
-rw-r--r--deps/npm/lib/build.js7
-rw-r--r--deps/npm/lib/cache.js5
-rw-r--r--deps/npm/lib/install.js17
-rw-r--r--deps/npm/lib/npm.js28
-rw-r--r--deps/npm/lib/utils/lifecycle.js2
5 files changed, 32 insertions, 27 deletions
diff --git a/deps/npm/lib/build.js b/deps/npm/lib/build.js
index c04fcbe907..4b73c1e270 100644
--- a/deps/npm/lib/build.js
+++ b/deps/npm/lib/build.js
@@ -174,10 +174,13 @@ function linkBins (pkg, folder, parent, gtop, cb) {
if (er) return cb(er)
// bins should always be executable.
// XXX skip chmod on windows?
- fs.chmod(path.resolve(folder, pkg.bin[b]), npm.modes.exec, function (er) {
+ var src = path.resolve(folder, pkg.bin[b])
+ fs.chmod(src, npm.modes.exec, function (er) {
+ if (er && er.code === "ENOENT" && npm.config.get("ignore-scripts")) {
+ return cb()
+ }
if (er || !gtop) return cb(er)
var dest = path.resolve(binRoot, b)
- , src = path.resolve(folder, pkg.bin[b])
, out = npm.config.get("parseable")
? dest + "::" + src + ":BINFILE"
: dest + " -> " + src
diff --git a/deps/npm/lib/cache.js b/deps/npm/lib/cache.js
index 7181220881..b606ef2517 100644
--- a/deps/npm/lib/cache.js
+++ b/deps/npm/lib/cache.js
@@ -83,6 +83,7 @@ var mkdir = require("mkdirp")
, chmodr = require("chmodr")
, which = require("which")
, isGitUrl = require("./utils/is-git-url.js")
+ , pathIsInside = require("path-is-inside")
cache.usage = "npm cache add <tarball file>"
+ "\nnpm cache add <folder>"
@@ -1253,7 +1254,3 @@ function needVersion(er, data) {
: (data && !data.version) ? new Error("No version provided")
: null
}
-
-function pathIsInside (potentialChild, parent) {
- return path.relative(parent, potentialChild).indexOf('..') === -1
-}
diff --git a/deps/npm/lib/install.js b/deps/npm/lib/install.js
index 5b09f8b2f9..fe210764cc 100644
--- a/deps/npm/lib/install.js
+++ b/deps/npm/lib/install.js
@@ -136,6 +136,7 @@ function install (args, cb_) {
, ancestors: {}
, explicit: false
, parent: data
+ , root: true
, wrap: null }
if (data.name === path.basename(where) &&
@@ -172,6 +173,7 @@ function install (args, cb_) {
, ancestors: {}
, explicit: true
, parent: data
+ , root: true
, wrap: null }
if (data) {
context.family[data.name] = context.ancestors[data.name] = data.version
@@ -578,7 +580,9 @@ function installMany (what, where, context, cb) {
var newPrev = Object.create(context.family)
, newAnc = Object.create(context.ancestors)
- newAnc[data.name] = data.version
+ if (!context.root) {
+ newAnc[data.name] = data.version
+ }
targets.forEach(function (t) {
newPrev[t.name] = t.version
})
@@ -627,7 +631,8 @@ function targetResolver (where, context, deps) {
// otherwise, make sure that it's a semver match with what we want.
var bd = parent.bundleDependencies
if (bd && bd.indexOf(d.name) !== -1 ||
- semver.satisfies(d.version, deps[d.name] || "*", true)) {
+ semver.satisfies(d.version, deps[d.name] || "*", true) ||
+ deps[d.name] === d._resolved) {
return cb(null, d.name)
}
@@ -1032,10 +1037,10 @@ function write (target, targetFolder, context, cb_) {
family)
var depsTargetFolder = targetFolder
var depsContext = { family: family
- , ancestors: context.ancestors
- , parent: target
- , explicit: false
- , wrap: wrap }
+ , ancestors: context.ancestors
+ , parent: target
+ , explicit: false
+ , wrap: wrap }
var peerDeps = prepareForInstallMany(data, "peerDependencies", bundled,
wrap, family)
diff --git a/deps/npm/lib/npm.js b/deps/npm/lib/npm.js
index a14ec3cce6..858a5e8c4b 100644
--- a/deps/npm/lib/npm.js
+++ b/deps/npm/lib/npm.js
@@ -176,7 +176,7 @@ var commandCache = {}
Object.keys(abbrevs).concat(plumbing).forEach(function addCommand (c) {
Object.defineProperty(npm.commands, c, { get : function () {
if (!loaded) throw new Error(
- "Call npm.load(conf, cb) before using this command.\n"+
+ "Call npm.load(config, cb) before using this command.\n"+
"See the README.md or cli.js for example usage.")
var a = npm.deref(c)
if (c === "la" || c === "ll") {
@@ -276,16 +276,16 @@ function load (npm, cli, cb) {
//console.error("about to look up configs")
var builtin = path.resolve(__dirname, "..", "npmrc")
- npmconf.load(cli, builtin, function (er, conf) {
- if (er === conf) er = null
+ npmconf.load(cli, builtin, function (er, config) {
+ if (er === config) er = null
- npm.config = conf
+ npm.config = config
- var color = conf.get("color")
+ var color = config.get("color")
- log.level = conf.get("loglevel")
- log.heading = conf.get("heading") || "npm"
- log.stream = conf.get("logstream")
+ log.level = config.get("loglevel")
+ log.heading = config.get("heading") || "npm"
+ log.stream = config.get("logstream")
switch (color) {
case "always": log.enableColor(); break
case false: log.disableColor(); break
@@ -313,12 +313,12 @@ function load (npm, cli, cb) {
// at this point the configs are all set.
// go ahead and spin up the registry client.
- var token = conf.get("_token")
+ var token = config.get("_token")
if (typeof token === "string") {
try {
token = JSON.parse(token)
- conf.set("_token", token, "user")
- conf.save("user")
+ config.set("_token", token, "user")
+ config.save("user")
} catch (e) { token = null }
}
@@ -339,18 +339,18 @@ function load (npm, cli, cb) {
, umask: umask }
chain([ [ loadPrefix, npm, cli ]
- , [ setUser, conf, conf.root ]
+ , [ setUser, config, config.root ]
, [ loadUid, npm ]
], cb)
})
})
}
-function loadPrefix (npm, conf, cb) {
+function loadPrefix (npm, config, cb) {
// try to guess at a good node_modules location.
var p
, gp
- if (!Object.prototype.hasOwnProperty.call(conf, "prefix")) {
+ if (!Object.prototype.hasOwnProperty.call(config, "prefix")) {
p = process.cwd()
} else {
p = npm.config.get("prefix")
diff --git a/deps/npm/lib/utils/lifecycle.js b/deps/npm/lib/utils/lifecycle.js
index 71c8e07b82..ffa6484fa8 100644
--- a/deps/npm/lib/utils/lifecycle.js
+++ b/deps/npm/lib/utils/lifecycle.js
@@ -31,7 +31,7 @@ function lifecycle (pkg, stage, wd, unsafe, failOk, cb) {
if (!pkg) return cb(new Error("Invalid package data"))
log.info(stage, pkg._id)
- if (!pkg.scripts) pkg.scripts = {}
+ if (!pkg.scripts || npm.config.get('ignore-scripts')) pkg.scripts = {}
validWd(wd || path.resolve(npm.dir, pkg.name), function (er, wd) {
if (er) return cb(er)