Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorForrest L Norvell <forrest@npmjs.com>2015-03-05 23:35:10 +0300
committerForrest L Norvell <forrest@npmjs.com>2015-03-05 23:35:10 +0300
commitb6bd99a73f575545fbbaef95c12237c47dd32561 (patch)
tree7ea0991ed129d4de023b1504ac9f7f702e9d8465
parent6de1e91116a5105dfa75126532b9083d8672e034 (diff)
install: engineStrict only warns for this package
-rw-r--r--lib/cache/add-named.js7
-rw-r--r--lib/install.js24
2 files changed, 19 insertions, 12 deletions
diff --git a/lib/cache/add-named.js b/lib/cache/add-named.js
index d81b7b0da..cb5a3fa8a 100644
--- a/lib/cache/add-named.js
+++ b/lib/cache/add-named.js
@@ -12,7 +12,6 @@ var path = require("path")
, addRemoteTarball = require("./add-remote-tarball.js")
, cachedPackageRoot = require("./cached-package-root.js")
, mapToRegistry = require("../utils/map-to-registry.js")
- , warnStrict = require("../utils/warn-deprecated.js")("engineStrict")
module.exports = addNamed
@@ -92,12 +91,6 @@ function engineFilter (data) {
Object.keys(data.versions || {}).forEach(function (v) {
var eng = data.versions[v].engines
if (!eng) return
- if (data.versions[v].engineStrict) {
- warnStrict([
- "Per-package engineStrict (found in package.json for "+data.name+")",
- "won't be used in npm 3+. Use the config setting `engine-strict` instead."
- ], data.name)
- }
if (!strict && !data.versions[v].engineStrict) return
if (eng.node && !semver.satisfies(nodev, eng.node, true)
|| eng.npm && !semver.satisfies(npmv, eng.npm, true)) {
diff --git a/lib/install.js b/lib/install.js
index 73580e5af..b79987147 100644
--- a/lib/install.js
+++ b/lib/install.js
@@ -109,6 +109,7 @@ var npm = require("./npm.js")
, locker = require("./utils/locker.js")
, lock = locker.lock
, unlock = locker.unlock
+ , warnStrict = require("./utils/warn-deprecated.js")("engineStrict")
, warnPeers = require("./utils/warn-deprecated.js")("peerDependencies")
function install (args, cb_) {
@@ -117,7 +118,7 @@ function install (args, cb_) {
function cb (er, installed) {
if (er) return cb_(er)
- findPeerInvalid(where, function (er, problem) {
+ validateInstall(where, function (er, problem) {
if (er) return cb_(er)
if (problem) {
@@ -244,11 +245,24 @@ function install (args, cb_) {
})
}
-function findPeerInvalid (where, cb) {
- readInstalled(where, { log: log.warn, dev: true }, function (er, data) {
- if (er) return cb(er)
+function validateInstall (where, cb) {
+ readJson(path.resolve(where, 'package.json'), log.warn, function (er, data) {
+ if (er
+ && er.code !== 'ENOENT'
+ && er.code !== 'ENOTDIR') return cb(er)
+
+ if (data && data.engineStrict) {
+ warnStrict([
+ "Per-package engineStrict (found in this package's package.json) ",
+ "won't be used in npm 3+. Use the config setting `engine-strict` instead."
+ ], data.name)
+ }
- cb(null, findPeerInvalid_(data.dependencies, []))
+ readInstalled(where, { log: log.warn, dev: true }, function (er, data) {
+ if (er) return cb(er)
+
+ cb(null, findPeerInvalid_(data.dependencies, []))
+ })
})
}