mirror of
https://github.com/pnpm/pnpm.git
synced 2026-05-04 22:16:33 -04:00
feat: show linked dependencies in installation summary
ref https://github.com/pnpm/pnpm/issues/732
This commit is contained in:
10
src/index.ts
10
src/index.ts
@@ -27,6 +27,7 @@ const BIG_TARBALL_SIZE = 1024 * 1024 * 5 // 5 MB
|
||||
|
||||
const addedSign = chalk.green('+')
|
||||
const removedSign = chalk.red('-')
|
||||
const linkSign = chalk.magentaBright('#')
|
||||
const hlValue = chalk.blue
|
||||
const hlPkgId = chalk['whiteBright']
|
||||
|
||||
@@ -294,7 +295,11 @@ function printDiffs(pkgsDiff: PackageDiff[]) {
|
||||
// + chalk 2.0.0
|
||||
pkgsDiff.sort((a, b) => (a.name.localeCompare(b.name) * 10 + (Number(!b.added) - Number(!a.added))))
|
||||
const msg = pkgsDiff.map((pkg) => {
|
||||
let result = pkg.added ? addedSign : removedSign
|
||||
let result = pkg.added
|
||||
? addedSign
|
||||
: pkg.linked
|
||||
? linkSign
|
||||
: removedSign
|
||||
result += ` ${pkg.name}`
|
||||
if (pkg.version) {
|
||||
result += ` ${chalk.grey(pkg.version)}`
|
||||
@@ -302,6 +307,9 @@ function printDiffs(pkgsDiff: PackageDiff[]) {
|
||||
if (pkg.deprecated) {
|
||||
result += ` ${chalk.red('deprecated')}`
|
||||
}
|
||||
if (pkg.linked) {
|
||||
result += ` ${chalk.magentaBright('linked from')} ${chalk.grey(pkg.from || '???')}`
|
||||
}
|
||||
return result
|
||||
}).join(EOL)
|
||||
return msg
|
||||
|
||||
@@ -6,10 +6,12 @@ import {
|
||||
import xs, {Stream} from 'xstream'
|
||||
|
||||
export interface PackageDiff {
|
||||
added: boolean,
|
||||
from?: string,
|
||||
name: string,
|
||||
version?: string,
|
||||
added: boolean,
|
||||
deprecated?: boolean,
|
||||
linked?: true,
|
||||
}
|
||||
|
||||
interface Map<T> {
|
||||
@@ -55,6 +57,15 @@ export default (log$: xs<Log>, deprecationLog$: xs<DeprecationLog>) => {
|
||||
}
|
||||
return pkgsDiff
|
||||
}
|
||||
if (rootLog['linked']) {
|
||||
pkgsDiff[rootLog['linked'].dependencyType][`>${rootLog['linked'].name}`] = {
|
||||
added: false,
|
||||
from: rootLog['linked'].from,
|
||||
linked: true,
|
||||
name: rootLog['linked'].name,
|
||||
}
|
||||
return pkgsDiff
|
||||
}
|
||||
return pkgsDiff
|
||||
}, {
|
||||
dev: {},
|
||||
|
||||
Reference in New Issue
Block a user