Skip to content

Commit be8274e

Browse files
committed
wip
1 parent 3c5f680 commit be8274e

File tree

3 files changed

+18
-9
lines changed

3 files changed

+18
-9
lines changed

lib/install.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -825,14 +825,10 @@ Installer.prototype.printInstalledForHuman = function (diffs, auditResult) {
825825
var report = ''
826826
if (this.args.length && (added || updated)) {
827827
report += this.args.map((p) => {
828-
const isAlias = p._requested.type === 'alias'
829-
const name = isAlias
830-
? p._requested.name
831-
: p.name
832-
return `+ ${name}@${isAlias ? `npm:${p.name}@` : ''}${p.version}${
833-
p._requested.name === p.name || isAlias
828+
return `+ ${p.name}@${p.version}${
829+
!p._requested.name || p._requested.name === p.name
834830
? ''
835-
: ` (as node_modules/${p._requested.name})`
831+
: ` (as ${p._requested.name})`
836832
}`
837833
}).join('\n') + '\n'
838834
}

lib/install/deps.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,12 +294,12 @@ function computeVersionSpec (tree, child) {
294294
var childReq = child.package._requested
295295
if (child.isLink) {
296296
requested = npa.resolve(moduleName(child), 'file:' + child.realpath, getTop(tree).path)
297-
} else if (child.name && child.name !== child.package.name) {
298-
requested = npa.resolve(child.name, `npm:${child.package.name}@${child.package.version})`)
299297
} else if (childReq && (isNotEmpty(childReq.saveSpec) || (isNotEmpty(childReq.rawSpec) && isNotEmpty(childReq.fetchSpec)))) {
300298
requested = child.package._requested
301299
} else if (child.package._from) {
302300
requested = npa(child.package._from, tree.path)
301+
} else if (child.name && child.name !== child.package.name) {
302+
requested = npa.resolve(child.name, `npm:${child.package.name}@${child.package.version})`)
303303
} else {
304304
npa.resolve(child.package.name, child.package.version)
305305
}

lib/ls.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -555,3 +555,16 @@ function makeParseable_ (data, long, dir, depth, parent, d) {
555555
(data.peerInvalid ? ':PEERINVALID' : '') +
556556
(data.peerMissing ? ':PEERINVALID:MISSING' : '')
557557
}
558+
559+
function physicalName (data) {
560+
if (!data._location) {
561+
return data.name
562+
} else {
563+
const match = data._location.match(/(?:@[^/\\]+[/\\])?[^/\\]+$/i)
564+
if (match) {
565+
return match[0]
566+
} else {
567+
return data.name
568+
}
569+
}
570+
}

0 commit comments

Comments
 (0)