diff options
author | Rebecca Turner <me@re-becca.org> | 2015-10-07 01:48:44 +0300 |
---|---|---|
committer | Rebecca Turner <me@re-becca.org> | 2015-10-09 02:24:34 +0300 |
commit | 5a6e8730689579a11a6770db53721a817f30cf0e (patch) | |
tree | eb0035f37e33eda09e5977594d972edf80c2c820 /lib | |
parent | 2bad121a995f0496f32070e7b4dceb1b03514275 (diff) |
package-id: Use getPackageId more consistently in diagnostics
PR-URL: //github.com/npm/npm/pull/9890
Fixes: #9766
Diffstat (limited to 'lib')
-rw-r--r-- | lib/dedupe.js | 3 | ||||
-rw-r--r-- | lib/install/action/build.js | 3 | ||||
-rw-r--r-- | lib/install/action/extract.js | 3 | ||||
-rw-r--r-- | lib/install/action/fetch.js | 3 | ||||
-rw-r--r-- | lib/install/action/global-install.js | 3 | ||||
-rw-r--r-- | lib/install/action/global-link.js | 3 | ||||
-rw-r--r-- | lib/install/action/install.js | 3 | ||||
-rw-r--r-- | lib/install/action/postinstall.js | 3 | ||||
-rw-r--r-- | lib/install/action/preinstall.js | 3 | ||||
-rw-r--r-- | lib/install/action/prepublish.js | 3 | ||||
-rw-r--r-- | lib/install/action/test.js | 3 | ||||
-rw-r--r-- | lib/install/actions.js | 5 | ||||
-rw-r--r-- | lib/shrinkwrap.js | 2 | ||||
-rw-r--r-- | lib/utils/tar.js | 3 |
14 files changed, 28 insertions, 15 deletions
diff --git a/lib/dedupe.js b/lib/dedupe.js index 295a2aa2c..6e8adcbc0 100644 --- a/lib/dedupe.js +++ b/lib/dedupe.js @@ -17,6 +17,7 @@ var filterInvalidActions = require('./install/filter-invalid-actions.js') var recalculateMetadata = require('./install/deps.js').recalculateMetadata var sortActions = require('./install/diff-trees.js').sortActions var moduleName = require('./utils/module-name.js') +var packageId = require('./utils/package-id.js') module.exports = dedupe module.exports.Deduper = Deduper @@ -136,7 +137,7 @@ function hoistChildren_ (tree, diff, seen, next) { seen[tree.path] = true asyncMap(tree.children, function (child, done) { if (!tree.parent) return hoistChildren_(child, diff, seen, done) - var better = findRequirement(tree.parent, moduleName(child), child.package._requested || npa(child.package.name + '@' + child.package.version)) + var better = findRequirement(tree.parent, moduleName(child), child.package._requested || npa(packageId(child))) if (better) { return chain([ [remove, child, diff], diff --git a/lib/install/action/build.js b/lib/install/action/build.js index 6ffa285ee..ffb870d68 100644 --- a/lib/install/action/build.js +++ b/lib/install/action/build.js @@ -2,9 +2,10 @@ var chain = require('slide').chain var build = require('../../build.js') var npm = require('../../npm.js') +var packageId = require('../../utils/package-id.js') module.exports = function (top, buildpath, pkg, log, next) { - log.silly('build', pkg.package.name) + log.silly('build', packageId(pkg)) chain([ [build.linkStuff, pkg.package, pkg.path, npm.config.get('global'), true], [build.writeBuiltinConf, pkg.package, pkg.path] diff --git a/lib/install/action/extract.js b/lib/install/action/extract.js index f9a4f8b2f..7a73f04e9 100644 --- a/lib/install/action/extract.js +++ b/lib/install/action/extract.js @@ -1,10 +1,11 @@ 'use strict' var updatePackageJson = require('../update-package-json') var npm = require('../../npm.js') +var packageId = require('../../utils/package-id.js') var cache = require('../../cache.js') module.exports = function (top, buildpath, pkg, log, next) { - log.silly('extract', pkg.package.name) + log.silly('extract', packageId(pkg)) var up = npm.config.get('unsafe-perm') var user = up ? null : npm.config.get('user') var group = up ? null : npm.config.get('group') diff --git a/lib/install/action/fetch.js b/lib/install/action/fetch.js index 3c3ab143f..a706b1967 100644 --- a/lib/install/action/fetch.js +++ b/lib/install/action/fetch.js @@ -1,5 +1,6 @@ 'use strict' // var cache = require('../../cache.js') +// var packageId = require('../../utils/package-id.js') // var moduleName = require('../../utils/module-name.js') module.exports = function (top, buildpath, pkg, log, next) { @@ -22,7 +23,7 @@ module.exports = function (top, buildpath, pkg, log, next) { default: name = pkg.package._requested.raw } - log.silly('fetch', name, version) + log.silly('fetch', packageId(pkg)) cache.add(name, version, top, false, next) */ } diff --git a/lib/install/action/global-install.js b/lib/install/action/global-install.js index 25c61aebd..a2aa59402 100644 --- a/lib/install/action/global-install.js +++ b/lib/install/action/global-install.js @@ -2,9 +2,10 @@ var path = require('path') var npm = require('../../npm.js') var Installer = require('../../install.js').Installer +var packageId = require('../../utils/package-id.js') module.exports = function (top, buildpath, pkg, log, next) { - log.silly('global-install', pkg.package.name) + log.silly('global-install', packageId(pkg)) var globalRoot = path.resolve(npm.globalDir, '..') npm.config.set('global', true) var install = new Installer(globalRoot, false, [pkg.package.name + '@' + pkg.package._requested.spec]) diff --git a/lib/install/action/global-link.js b/lib/install/action/global-link.js index 80eb46b95..daad48e97 100644 --- a/lib/install/action/global-link.js +++ b/lib/install/action/global-link.js @@ -1,7 +1,8 @@ 'use strict' var npm = require('../../npm.js') +var packageId = require('../../utils/package-id.js') module.exports = function (top, buildpath, pkg, log, next) { - log.silly('global-link', pkg.package.name) + log.silly('global-link', packageId(pkg)) npm.link(pkg.package.name, next) } diff --git a/lib/install/action/install.js b/lib/install/action/install.js index f6c8d56e0..f7b329553 100644 --- a/lib/install/action/install.js +++ b/lib/install/action/install.js @@ -1,7 +1,8 @@ 'use strict' var lifecycle = require('../../utils/lifecycle.js') +var packageId = require('../../utils/package-id.js') module.exports = function (top, buildpath, pkg, log, next) { - log.silly('install', pkg.package.name, buildpath) + log.silly('install', packageId(pkg), buildpath) lifecycle(pkg.package, 'install', pkg.path, false, false, next) } diff --git a/lib/install/action/postinstall.js b/lib/install/action/postinstall.js index 5460c8364..4ca4c8bae 100644 --- a/lib/install/action/postinstall.js +++ b/lib/install/action/postinstall.js @@ -1,7 +1,8 @@ 'use strict' var lifecycle = require('../../utils/lifecycle.js') +var packageId = require('../../utils/package-id.js') module.exports = function (top, buildpath, pkg, log, next) { - log.silly('postinstall', pkg.package.name, buildpath) + log.silly('postinstall', packageId(pkg), buildpath) lifecycle(pkg.package, 'postinstall', pkg.path, false, false, next) } diff --git a/lib/install/action/preinstall.js b/lib/install/action/preinstall.js index 989519c26..abd767016 100644 --- a/lib/install/action/preinstall.js +++ b/lib/install/action/preinstall.js @@ -1,7 +1,8 @@ 'use strict' var lifecycle = require('../../utils/lifecycle.js') +var packageId = require('../../utils/package-id.js') module.exports = function (top, buildpath, pkg, log, next) { - log.silly('preinstall', pkg.package.name, buildpath) + log.silly('preinstall', packageId(pkg), buildpath) lifecycle(pkg.package, 'preinstall', buildpath, false, false, next) } diff --git a/lib/install/action/prepublish.js b/lib/install/action/prepublish.js index 95ff22b66..b9a5a5d6f 100644 --- a/lib/install/action/prepublish.js +++ b/lib/install/action/prepublish.js @@ -1,7 +1,8 @@ 'use strict' var lifecycle = require('../../utils/lifecycle.js') +var packageId = require('../../utils/package-id.js') module.exports = function (top, buildpath, pkg, log, next) { - log.silly('prepublish', pkg.package.name, buildpath) + log.silly('prepublish', packageId(pkg), buildpath) lifecycle(pkg.package, 'prepublish', buildpath, false, false, next) } diff --git a/lib/install/action/test.js b/lib/install/action/test.js index 354519d06..ee315290a 100644 --- a/lib/install/action/test.js +++ b/lib/install/action/test.js @@ -1,7 +1,8 @@ 'use strict' var lifecycle = require('../../utils/lifecycle.js') +var packageId = require('../../utils/package-id.js') module.exports = function (top, buildpath, pkg, log, next) { - log.silly('test', pkg.package.name, buildpath) + log.silly('test', packageId(pkg), buildpath) lifecycle(pkg.package, 'test', buildpath, false, false, next) } diff --git a/lib/install/actions.js b/lib/install/actions.js index 96d1c927d..face4b457 100644 --- a/lib/install/actions.js +++ b/lib/install/actions.js @@ -8,6 +8,7 @@ var log = require('npmlog') var andFinishTracker = require('./and-finish-tracker.js') var andAddParentToErrors = require('./and-add-parent-to-errors.js') var failedDependency = require('./deps.js').failedDependency +var packageId = require('../utils/package-id.js') var moduleName = require('../utils/module-name.js') var actions = {} @@ -69,8 +70,8 @@ function andHandleOptionalDepErrors (pkg, next) { if (isFatal) anyFatal = true } if (anyFatal) return next.apply(null, arguments) - log.warn('install:' + pkg.package.name, er.message) - log.verbose('install:' + pkg.package.name, er.stack) + log.warn('install:' + packageId(pkg), er.message) + log.verbose('install:' + packageId(pkg), er.stack) next() } } diff --git a/lib/shrinkwrap.js b/lib/shrinkwrap.js index 8942ef60f..be599107b 100644 --- a/lib/shrinkwrap.js +++ b/lib/shrinkwrap.js @@ -76,7 +76,7 @@ function shrinkwrapDeps (dev, problems, deps, tree, seen) { }) tree.children.sort(function (aa, bb) { return moduleName(aa).localeCompare(moduleName(bb)) }).forEach(function (child) { if (!dev && isOnlyDev(child)) { - log.warn('shrinkwrap', 'Excluding devDependency: %s', child.package.name, child.parent.package.dependencies) + log.warn('shrinkwrap', 'Excluding devDependency: %s', packageId(child), child.parent.package.dependencies) return } var pkginfo = deps[moduleName(child)] = {} diff --git a/lib/utils/tar.js b/lib/utils/tar.js index ca027e17e..806bb75a9 100644 --- a/lib/utils/tar.js +++ b/lib/utils/tar.js @@ -22,6 +22,7 @@ var readPackageTree = require('read-package-tree') var union = require('lodash.union') var flattenTree = require('../install/flatten-tree.js') var moduleName = require('./module-name.js') +var packageId = require('./package-id.js') if (process.env.SUDO_UID && myUid === 0) { if (!isNaN(process.env.SUDO_UID)) myUid = +process.env.SUDO_UID @@ -146,7 +147,7 @@ function pack_ (tarball, folder, tree, flatTree, pkg, cb) { if (!bd) return false if (!Array.isArray(bd)) { - throw new Error(this.package.name + '\'s `bundledDependencies` should ' + + throw new Error(packageId(this) + '\'s `bundledDependencies` should ' + 'be an array') } if (!tree) return false |