mirror of
https://github.com/pnpm/pnpm.git
synced 2026-05-04 14:08:44 -04:00
feat: show linked dependencies in installation summary
ref https://github.com/pnpm/pnpm/issues/732
This commit is contained in:
@@ -61,7 +61,7 @@
|
||||
"normalize-newline": "^3.0.0",
|
||||
"package-preview": "^1.0.0",
|
||||
"rimraf": "^2.5.4",
|
||||
"supi": "^0.7.3",
|
||||
"supi": "^0.7.4",
|
||||
"tape": "^4.8.0",
|
||||
"ts-node": "^3.3.0",
|
||||
"tslint": "^5.7.0",
|
||||
|
||||
@@ -19,7 +19,7 @@ devDependencies:
|
||||
normalize-newline: 3.0.0
|
||||
package-preview: 1.0.0
|
||||
rimraf: 2.6.2
|
||||
supi: 0.7.3
|
||||
supi: 0.7.4
|
||||
tape: 4.8.0
|
||||
ts-node: 3.3.0
|
||||
tslint: 5.8.0
|
||||
@@ -128,6 +128,10 @@ packages:
|
||||
dev: false
|
||||
resolution:
|
||||
integrity: sha512-37umDB+zS6tK+3j0YJxsl7O8T4aYHYO6s1UpADJ/nxMHFjmuSd5XRQryC4IXX3HQ4XzstqAqhk/D+cdxwvqtEQ==
|
||||
/@types/ramda/0.25.3:
|
||||
dev: true
|
||||
resolution:
|
||||
integrity: sha512-wxs2s/qPon1Obr+0NSiBlF/6uHrFYmh+F14971ZIvpM9OUad2eMqDrPC6Cz5WZh50DNrKYz1C8dVIpWp7PVQ7w==
|
||||
/@types/ramda/0.25.5:
|
||||
dev: true
|
||||
resolution:
|
||||
@@ -1894,17 +1898,6 @@ packages:
|
||||
node: '>=0.10.0'
|
||||
resolution:
|
||||
integrity: sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=
|
||||
/load-json-file/3.0.0:
|
||||
dependencies:
|
||||
graceful-fs: 4.1.11
|
||||
parse-json: 3.0.0
|
||||
pify: 2.3.0
|
||||
strip-bom: 3.0.0
|
||||
dev: true
|
||||
engines:
|
||||
node: '>=4'
|
||||
resolution:
|
||||
integrity: sha1-frNzXZg6ftImKt5P92mvU2nFxEA=
|
||||
/load-json-file/4.0.0:
|
||||
dependencies:
|
||||
graceful-fs: 4.1.11
|
||||
@@ -2581,14 +2574,6 @@ packages:
|
||||
node: '>=0.10.0'
|
||||
resolution:
|
||||
integrity: sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=
|
||||
/parse-json/3.0.0:
|
||||
dependencies:
|
||||
error-ex: 1.3.1
|
||||
dev: true
|
||||
engines:
|
||||
node: '>=4'
|
||||
resolution:
|
||||
integrity: sha1-+m9HsY4jgm6tMvJj50TQ4ehH+xM=
|
||||
/parse-json/4.0.0:
|
||||
dependencies:
|
||||
error-ex: 1.3.1
|
||||
@@ -3375,7 +3360,7 @@ packages:
|
||||
node: '>=0.10.0'
|
||||
resolution:
|
||||
integrity: sha1-PFMZQukIwml8DsNEhYwobHygpgo=
|
||||
/supi/0.7.3:
|
||||
/supi/0.7.4:
|
||||
dependencies:
|
||||
'@pnpm/types': 1.0.0
|
||||
'@types/byline': 4.2.31
|
||||
@@ -3386,7 +3371,7 @@ packages:
|
||||
'@types/nopt': 3.0.29
|
||||
'@types/npm': 2.0.29
|
||||
'@types/p-series': 1.0.1
|
||||
'@types/ramda': 0.25.5
|
||||
'@types/ramda': 0.25.3
|
||||
'@types/rc': 0.0.1
|
||||
'@types/semver': 5.4.0
|
||||
'@types/update-notifier': 1.0.2
|
||||
@@ -3406,7 +3391,7 @@ packages:
|
||||
is-inner-link: 2.0.2
|
||||
is-subdir: 1.0.2
|
||||
is-windows: 1.0.1
|
||||
load-json-file: 3.0.0
|
||||
load-json-file: 4.0.0
|
||||
load-yaml-file: 0.1.0
|
||||
mkdirp-promise: 5.0.1
|
||||
mz: 2.7.0
|
||||
@@ -3442,7 +3427,7 @@ packages:
|
||||
peerDependencies:
|
||||
'@pnpm/logger': ^1.0.0
|
||||
resolution:
|
||||
integrity: sha512-Gb8TEan7VIXgKp3cd7NnUsVhH5MXNwWvP1LxQhqk5vDOECjXIXlkzdBP1KCq/hcvlo+3xds5kn4xejftGlLeig==
|
||||
integrity: sha512-rwa39F+gVe/yRyViqRSCifWL1ji19eVN6uyAUIQcDcmiGTTfMBglu7WCVLfFRBV1dUuAt6qdsVFI32NTYGNK7Q==
|
||||
/supports-color/0.2.0:
|
||||
dev: true
|
||||
engines:
|
||||
@@ -3900,7 +3885,7 @@ specifiers:
|
||||
ramda: ^0.25.0
|
||||
rimraf: ^2.5.4
|
||||
stacktracey: ^1.2.87
|
||||
supi: ^0.7.3
|
||||
supi: ^0.7.4
|
||||
tape: ^4.8.0
|
||||
ts-node: ^3.3.0
|
||||
tslint: ^5.7.0
|
||||
|
||||
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: {},
|
||||
|
||||
@@ -15,6 +15,7 @@ const DEPRECATED = chalk.red('deprecated')
|
||||
const versionColor = chalk.grey
|
||||
const ADD = chalk.green('+')
|
||||
const SUB = chalk.red('-')
|
||||
const LINKED = chalk.magentaBright('#')
|
||||
const h1 = chalk.blue
|
||||
const hlValue = chalk.blue
|
||||
const hlPkgId = chalk['whiteBright']
|
||||
@@ -189,6 +190,14 @@ test('prints summary', t => {
|
||||
name: 'is-positive',
|
||||
},
|
||||
})
|
||||
rootLogger.debug({
|
||||
linked: {
|
||||
dependencyType: 'optional',
|
||||
from: '/src/is-linked',
|
||||
name: 'is-linked',
|
||||
to: '/src/project/node_modules'
|
||||
},
|
||||
})
|
||||
packageJsonLogger.debug({
|
||||
updated: {
|
||||
dependencies: {
|
||||
@@ -216,6 +225,7 @@ test('prints summary', t => {
|
||||
${ADD} is-negative ${versionColor('^1.0.0')}
|
||||
|
||||
${h1('optionalDependencies:')}
|
||||
${LINKED} is-linked ${chalk.magentaBright('linked from')} ${chalk.grey('/src/is-linked')}
|
||||
${SUB} is-positive
|
||||
${ADD} lala ${versionColor('1.1.0')}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user