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:
-rw-r--r--lib/build.js16
-rw-r--r--lib/cache/add-local-tarball.js8
-rw-r--r--lib/cache/add-named.js8
-rw-r--r--lib/install.js12
-rw-r--r--lib/install/deps.js4
-rw-r--r--lib/install/filter-invalid-actions.js4
-rw-r--r--lib/install/mutate-into-logical-tree.js4
-rw-r--r--lib/install/validate-tree.js6
-rw-r--r--lib/ls.js10
-rw-r--r--lib/shrinkwrap.js4
-rw-r--r--lib/utils/package-id.js (renamed from lib/install/get-package-id.js)2
11 files changed, 39 insertions, 39 deletions
diff --git a/lib/build.js b/lib/build.js
index 8d62cb61f..b6d2da3ad 100644
--- a/lib/build.js
+++ b/lib/build.js
@@ -21,7 +21,7 @@ var cmdShimIfExists = cmdShim.ifExists
var asyncMap = require('slide').asyncMap
var ini = require('ini')
var writeFile = require('write-file-atomic')
-var getPackageId = require('./install/get-package-id.js')
+var packageId = require('./utils/package-id.js')
module.exports = build
build.usage = 'npm build [<folder>]'
@@ -101,18 +101,18 @@ var linkStuff = build.linkStuff = function (pkg, folder, global, didRB, cb) {
var gnm = global && npm.globalDir
var gtop = parent === gnm
- log.info('linkStuff', getPackageId(pkg))
- log.silly('linkStuff', getPackageId(pkg), 'has', parent, 'as its parent node_modules')
- if (global) log.silly('linkStuff', getPackageId(pkg), 'is part of a global install')
- if (gnm) log.silly('linkStuff', getPackageId(pkg), 'is installed into a global node_modules')
- if (gtop) log.silly('linkStuff', getPackageId(pkg), 'is installed into the top-level global node_modules')
+ log.info('linkStuff', packageId(pkg))
+ log.silly('linkStuff', packageId(pkg), 'has', parent, 'as its parent node_modules')
+ if (global) log.silly('linkStuff', packageId(pkg), 'is part of a global install')
+ if (gnm) log.silly('linkStuff', packageId(pkg), 'is installed into a global node_modules')
+ if (gtop) log.silly('linkStuff', packageId(pkg), 'is installed into the top-level global node_modules')
shouldWarn(pkg, folder, global, function () {
asyncMap(
[linkBins, linkMans, !didRB && rebuildBundles],
function (fn, cb) {
if (!fn) return cb()
- log.verbose(fn.name, getPackageId(pkg))
+ log.verbose(fn.name, packageId(pkg))
fn(pkg, folder, parent, gtop, cb)
},
cb
@@ -140,7 +140,7 @@ function shouldWarn (pkg, folder, global, cb) {
.indexOf(currentPkg) === -1) {
if (top && pkg.preferGlobal && !global) {
- log.warn('prefer global', getPackageId(pkg) + ' should be installed with -g')
+ log.warn('prefer global', packageId(pkg) + ' should be installed with -g')
}
}
}
diff --git a/lib/cache/add-local-tarball.js b/lib/cache/add-local-tarball.js
index 1bcb48623..00710cf52 100644
--- a/lib/cache/add-local-tarball.js
+++ b/lib/cache/add-local-tarball.js
@@ -16,7 +16,7 @@ var once = require('once')
var writeStream = require('fs-write-stream-atomic')
var tempFilename = require('../utils/temp-filename.js')
var rimraf = require('rimraf')
-var getPackageId = require('../install/get-package-id.js')
+var packageId = require('../utils/package-id.js')
module.exports = addLocalTarball
@@ -97,7 +97,7 @@ function addTmpTarball (tgz, pkgData, shasum, cb) {
log.verbose(
'addTmpTarball',
'already have metadata; skipping unpack for',
- getPackageId(pkgData)
+ packageId(pkgData)
)
return addTmpTarball_(tgz, pkgData, shasum, cb)
}
@@ -130,8 +130,8 @@ function addTmpTarball (tgz, pkgData, shasum, cb) {
return cb(new Error('No version provided'))
} else if (pkgData.version && data.version !== pkgData.version) {
return cb(new Error('Invalid Package: expected ' +
- getPackageId(pkgData) +
- ' but found ' + getPackageId(data)))
+ packageId(pkgData) +
+ ' but found ' + packageId(data)))
}
addTmpTarball_(tgz, data, shasum, cb)
diff --git a/lib/cache/add-named.js b/lib/cache/add-named.js
index b90d31398..212ea7836 100644
--- a/lib/cache/add-named.js
+++ b/lib/cache/add-named.js
@@ -13,7 +13,7 @@ var addRemoteTarball = require('./add-remote-tarball.js')
var cachedPackageRoot = require('./cached-package-root.js')
var mapToRegistry = require('../utils/map-to-registry.js')
var pulseTillDone = require('../utils/pulse-till-done.js')
-var getPackageId = require('../install/get-package-id.js')
+var packageId = require('../utils/package-id.js')
module.exports = addNamed
@@ -148,11 +148,11 @@ function addNameVersion (name, v, data, cb) {
deprCheck(data)
var dist = data.dist
- if (!dist) return cb(new Error('No dist in ' + getPackageId(data) + ' package'))
+ if (!dist) return cb(new Error('No dist in ' + packageId(data) + ' package'))
if (!dist.tarball) {
return cb(new Error(
- 'No dist.tarball in ' + getPackageId(data) + ' package'
+ 'No dist.tarball in ' + packageId(data) + ' package'
))
}
@@ -210,7 +210,7 @@ function addNameVersion (name, v, data, cb) {
// Only add non-shasum'ed packages if --forced. Only ancient things
// would lack this for good reasons nowadays.
if (!dist.shasum && !npm.config.get('force')) {
- return cb(new Error('package lacks shasum: ' + getPackageId(data)))
+ return cb(new Error('package lacks shasum: ' + packageId(data)))
}
addRemoteTarball(tb, data, dist.shasum, auth, cb)
diff --git a/lib/install.js b/lib/install.js
index 84da53ac3..3dec2719a 100644
--- a/lib/install.js
+++ b/lib/install.js
@@ -132,7 +132,7 @@ var doSerialActions = require('./install/actions.js').doSerial
var doReverseSerialActions = require('./install/actions.js').doReverseSerial
var doParallelActions = require('./install/actions.js').doParallel
var doOneAction = require('./install/actions.js').doOne
-var getPackageId = require('./install/get-package-id.js')
+var packageId = require('./utils/package-id.js')
var moduleName = require('./utils/module-name.js')
function unlockCB (lockPath, name, cb) {
@@ -650,7 +650,7 @@ Installer.prototype.printInstalled = function (cb) {
this.differences.forEach(function (action) {
var mutation = action[0]
var child = action[1]
- var name = getPackageId(child)
+ var name = packageId(child)
var where = path.relative(self.where, child.path)
if (mutation === 'remove') {
console.log('- ' + name + ' ' + where)
@@ -665,7 +665,7 @@ Installer.prototype.printInstalled = function (cb) {
return !child.failed && (mutation === 'add' || mutation === 'update')
}).map(function (action) {
var child = action[1]
- return getPackageId(child)
+ return packageId(child)
})
log.showProgress()
if (!addedOrMoved.length) return cb()
@@ -684,7 +684,7 @@ Installer.prototype.debugActions = function (name, actionListName, cb) {
log.silly(name, 'action count', actionsToLog.length)
actionsToLog.forEach(function (action) {
log.silly(name, action.map(function (value) {
- return (value && value.package) ? getPackageId(value) : value
+ return (value && value.package) ? packageId(value) : value
}).join(' '))
})
cb()
@@ -702,12 +702,12 @@ Installer.prototype.prettify = function (tree) {
validate('O', arguments)
var seen = {}
function byName (aa, bb) {
- return getPackageId(aa).localeCompare(getPackageId(bb))
+ return packageId(aa).localeCompare(packageId(bb))
}
function expandTree (tree) {
seen[tree.path] = true
return {
- label: getPackageId(tree),
+ label: packageId(tree),
nodes: tree.children.filter(function (tree) { return !seen[tree.path] }).sort(byName).map(expandTree)
}
}
diff --git a/lib/install/deps.js b/lib/install/deps.js
index 9c0ec8292..3a37f14c1 100644
--- a/lib/install/deps.js
+++ b/lib/install/deps.js
@@ -25,7 +25,7 @@ var createChild = require('./node.js').create
var resetMetadata = require('./node.js').reset
var andIgnoreErrors = require('./and-ignore-errors.js')
var isInstallable = require('./validate-args.js').isInstallable
-var getPackageId = require('./get-package-id.js')
+var packageId = require('../utils/package-id.js')
var moduleName = require('../utils/module-name.js')
// The export functions in this module mutate a dependency tree, adding
@@ -409,7 +409,7 @@ function resolveWithNewModule (pkg, tree, log, next) {
}
if (!pkg.installable) {
- log.silly('resolveWithNewModule', getPackageId(pkg), 'checking installable status')
+ log.silly('resolveWithNewModule', packageId(pkg), 'checking installable status')
return isInstallable(pkg, iferr(next, function () {
pkg.installable = true
resolveWithNewModule(pkg, tree, log, next)
diff --git a/lib/install/filter-invalid-actions.js b/lib/install/filter-invalid-actions.js
index 55278ed82..f90bf0b4e 100644
--- a/lib/install/filter-invalid-actions.js
+++ b/lib/install/filter-invalid-actions.js
@@ -2,7 +2,7 @@
var path = require('path')
var validate = require('aproba')
var log = require('npmlog')
-var getPackageId = require('./get-package-id.js')
+var packageId = require('../utils/package-id.js')
module.exports = function (top, differences, next) {
validate('SAF', arguments)
@@ -25,7 +25,7 @@ module.exports = function (top, differences, next) {
// we want to skip warning if this is a child of another module that we're removing
if (!pkg.parent.removing) {
log.warn('skippingAction', 'Module is inside a symlinked module: not running ' +
- cmd + ' ' + getPackageId(pkg) + ' ' + path.relative(top, pkg.path))
+ cmd + ' ' + packageId(pkg) + ' ' + path.relative(top, pkg.path))
}
} else {
keep.push(action)
diff --git a/lib/install/mutate-into-logical-tree.js b/lib/install/mutate-into-logical-tree.js
index f2186fcd2..6053cfc7d 100644
--- a/lib/install/mutate-into-logical-tree.js
+++ b/lib/install/mutate-into-logical-tree.js
@@ -5,7 +5,7 @@ var validate = require('aproba')
var flattenTree = require('./flatten-tree.js')
var isExtraneous = require('./is-extraneous.js')
var validateAllPeerDeps = require('./deps.js').validateAllPeerDeps
-var getPackageId = require('./get-package-id.js')
+var packageId = require('../utils/package-id.js')
var moduleName = require('../utils/module-name.js')
var mutateIntoLogicalTree = module.exports = function (tree) {
@@ -99,7 +99,7 @@ function translateTree_ (tree, seen) {
}
if (!peerPkg.peerMissing) peerPkg.peerMissing = []
peerPkg.peerMissing.push({
- requiredBy: getPackageId(child),
+ requiredBy: packageId(child),
requires: pkgname + '@' + version
})
})
diff --git a/lib/install/validate-tree.js b/lib/install/validate-tree.js
index f09abedcb..b3caefb55 100644
--- a/lib/install/validate-tree.js
+++ b/lib/install/validate-tree.js
@@ -11,7 +11,7 @@ var npm = require('../npm.js')
var andFinishTracker = require('./and-finish-tracker.js')
var flattenTree = require('./flatten-tree.js')
var validateAllPeerDeps = require('./deps.js').validateAllPeerDeps
-var getPackageId = require('./get-package-id.js')
+var packageId = require('../utils/package-id.js')
module.exports = function (idealTree, log, next) {
validate('OOF', arguments)
@@ -38,7 +38,7 @@ function checkErrors (mod, idealTree, next) {
function thenValidateAllPeerDeps (idealTree, next) {
validate('OF', arguments)
validateAllPeerDeps(idealTree, function (tree, pkgname, version) {
- var warn = new Error(getPackageId(tree) + ' requires a peer of ' + pkgname + '@' +
+ var warn = new Error(packageId(tree) + ' requires a peer of ' + pkgname + '@' +
version + ' but none was installed.')
warn.code = 'EPEERINVALID'
idealTree.warnings.push(warn)
@@ -57,7 +57,7 @@ function thenCheckTop (idealTree, next) {
var pkg = clone(idealTree.package)
try {
normalizePackageData(pkg, function (warn) {
- var warnObj = new Error(getPackageId(idealTree) + ' ' + warn)
+ var warnObj = new Error(packageId(idealTree) + ' ' + warn)
warnObj.code = 'EPACKAGEJSON'
idealTree.warnings.push(warnObj)
}, false)
diff --git a/lib/ls.js b/lib/ls.js
index 1854938eb..51f0b5155 100644
--- a/lib/ls.js
+++ b/lib/ls.js
@@ -18,7 +18,7 @@ var iferr = require('iferr')
var npm = require('./npm.js')
var mutateIntoLogicalTree = require('./install/mutate-into-logical-tree.js')
var recalculateMetadata = require('./install/deps.js').recalculateMetadata
-var getPackageId = require('./install/get-package-id.js')
+var packageId = require('./utils/package-id.js')
ls.usage = 'npm ls [[<@scope>/]<pkg> ...]' +
'\n\naliases: list, la, ll'
@@ -151,7 +151,7 @@ function getLite (data, noname) {
if (data.extraneous) {
lite.extraneous = true
lite.problems = lite.problems || []
- lite.problems.push('extraneous: ' + getPackageId(data) + ' ' + (data.path || ''))
+ lite.problems.push('extraneous: ' + packageId(data) + ' ' + (data.path || ''))
}
if (data.error && data.path !== path.resolve(npm.globalDir, '..') &&
@@ -174,7 +174,7 @@ function getLite (data, noname) {
lite.invalid = true
lite.problems = lite.problems || []
lite.problems.push('invalid: ' +
- getPackageId(data) +
+ packageId(data) +
' ' + (data.path || ''))
}
@@ -182,7 +182,7 @@ function getLite (data, noname) {
lite.peerInvalid = true
lite.problems = lite.problems || []
lite.problems.push('peer dep not met: ' +
- getPackageId(data) +
+ packageId(data) +
' ' + (data.path || ''))
}
@@ -200,7 +200,7 @@ function getLite (data, noname) {
}
p += d + '@' + dep.requiredBy +
', required by ' +
- getPackageId(data)
+ packageId(data)
lite.problems.push(p)
return [d, { required: dep.requiredBy, missing: true }]
} else if (dep.peerMissing) {
diff --git a/lib/shrinkwrap.js b/lib/shrinkwrap.js
index 5cb2ad095..8942ef60f 100644
--- a/lib/shrinkwrap.js
+++ b/lib/shrinkwrap.js
@@ -14,7 +14,7 @@ var recalculateMetadata = require('./install/deps.js').recalculateMetadata
var validatePeerDeps = require('./install/deps.js').validatePeerDeps
var isExtraneous = require('./install/is-extraneous.js')
var isOnlyDev = require('./install/is-dev.js').isOnlyDev
-var getPackageId = require('./install/get-package-id.js')
+var packageId = require('./utils/package-id.js')
var moduleName = require('./utils/module-name.js')
shrinkwrap.usage = 'npm shrinkwrap'
@@ -69,7 +69,7 @@ function shrinkwrapDeps (dev, problems, deps, tree, seen) {
if (invalid) {
problems.push('invalid: have ' + invalid.package._id + ' (expected: ' + tree.missingDeps[name] + ') ' + invalid.path)
} else {
- var topname = getPackageId(tree)
+ var topname = packageId(tree)
problems.push('missing: ' + name + '@' + tree.package.dependencies[name] +
(topname ? ', required by ' + topname : ''))
}
diff --git a/lib/install/get-package-id.js b/lib/utils/package-id.js
index 9291bbe77..2c5e33146 100644
--- a/lib/install/get-package-id.js
+++ b/lib/utils/package-id.js
@@ -1,5 +1,5 @@
'use strict'
-var moduleName = require('../utils/module-name.js')
+var moduleName = require('./module-name.js')
module.exports = function (tree) {
var pkg = tree.package || tree