fix: show correct output of top packages installations
This commit is contained in:
3 files changed
+22
-17
No files matched your search
+2
-2
@@ -63,10 +63,10 @@
|
||||
"parse-npm-tarball-url": "1.0.0",
|
||||
"path-name": "1.0.0",
|
||||
"pause-stream": "0.0.11",
|
||||
"pnpm-default-reporter": "0.4.0",
|
||||
"pnpm-default-reporter": "0.4.1",
|
||||
"pnpm-file-reporter": "0.0.1",
|
||||
"pnpm-install-checks": "1.1.0",
|
||||
"pnpm-logger": "0.1.0",
|
||||
"pnpm-logger": "0.2.0",
|
||||
"promisequence": "1.1.6",
|
||||
"proper-lockfile": "2.0.0",
|
||||
"rc": "1.1.7",
|
||||
|
||||
@@ -39,27 +39,23 @@ export default async function fetch (
|
||||
shrinkwrapResolution?: Resolution,
|
||||
pkgId?: string,
|
||||
fetchingLocker: MemoizedFunc<Boolean>,
|
||||
loggedPkg: LoggedPkg,
|
||||
}
|
||||
): Promise<FetchedPackage> {
|
||||
const loggedPkg: LoggedPkg = {
|
||||
rawSpec: spec.rawSpec,
|
||||
name: spec.name,
|
||||
}
|
||||
|
||||
try {
|
||||
let fetchingPkg = null
|
||||
let resolution = options.shrinkwrapResolution
|
||||
let pkgId = options.pkgId
|
||||
if (!resolution || options.update) {
|
||||
const resolveResult = await resolve(spec, {
|
||||
loggedPkg,
|
||||
loggedPkg: options.loggedPkg,
|
||||
root: options.root,
|
||||
got: options.got,
|
||||
tag: options.tag,
|
||||
storePath: options.storePath,
|
||||
metaCache: options.metaCache,
|
||||
})
|
||||
logStatus({status: 'resolved', pkg: loggedPkg})
|
||||
logStatus({status: 'resolved', pkg: options.loggedPkg})
|
||||
// keep the shrinkwrap resolution when possible
|
||||
// to keep the original shasum
|
||||
if (pkgId !== resolveResult.id || !resolution) {
|
||||
@@ -78,7 +74,7 @@ export default async function fetch (
|
||||
const fetchingFiles = options.fetchingLocker(id, () => fetchToStore({
|
||||
target,
|
||||
resolution: <Resolution>resolution,
|
||||
loggedPkg,
|
||||
loggedPkg: options.loggedPkg,
|
||||
got: options.got,
|
||||
}))
|
||||
|
||||
@@ -104,7 +100,7 @@ export default async function fetch (
|
||||
},
|
||||
}
|
||||
} catch (err) {
|
||||
logStatus({status: 'error', pkg: loggedPkg})
|
||||
logStatus({status: 'error', pkg: options.loggedPkg})
|
||||
throw err
|
||||
}
|
||||
}
|
||||
|
||||
@@ -133,7 +133,7 @@ async function installMultiple (
|
||||
} catch (err) {
|
||||
if (options.optional) {
|
||||
logger.warn({
|
||||
message: `Skipping failed optional dependency ${pkgId || spec.rawSpec}`,
|
||||
message: `Skipping failed optional dependency ${pkgId || spec.raw}`,
|
||||
err,
|
||||
})
|
||||
return null // is it OK to return null?
|
||||
@@ -187,13 +187,19 @@ async function install (
|
||||
const keypath = options.keypath || []
|
||||
const update = keypath.length <= options.depth
|
||||
|
||||
const dependentId = keypath[keypath.length - 1]
|
||||
const loggedPkg = {
|
||||
rawSpec: spec.rawSpec,
|
||||
name: spec.name,
|
||||
dependentId,
|
||||
}
|
||||
logStatus({
|
||||
status: 'installing',
|
||||
pkg: {rawSpec: spec.rawSpec, name: spec.name},
|
||||
keypath,
|
||||
pkg: loggedPkg,
|
||||
})
|
||||
|
||||
const fetchedPkg = await fetch(spec, Object.assign({}, options, {
|
||||
loggedPkg,
|
||||
update,
|
||||
shrinkwrapResolution: options.dependencyShrinkwrap && options.dependencyShrinkwrap.resolution,
|
||||
fetchingLocker: ctx.fetchingLocker,
|
||||
@@ -225,7 +231,7 @@ async function install (
|
||||
|
||||
addInstalledPkg(ctx.installs, dependency)
|
||||
|
||||
addToGraph(ctx.graph, keypath[keypath.length - 1], dependency)
|
||||
addToGraph(ctx.graph, dependentId, dependency)
|
||||
|
||||
const linking = ctx.linkingLocker(dependency.hardlinkedLocation, async function () {
|
||||
const newlyFetched = await fetchedPkg.fetchingFiles
|
||||
@@ -238,8 +244,6 @@ async function install (
|
||||
}
|
||||
}
|
||||
|
||||
logStatus({ status: 'installed', pkg: {rawSpec: spec.rawSpec, name: pkg.name, version: pkg.version}})
|
||||
|
||||
async function pkgLinkedToStore () {
|
||||
const pkgJsonPathInStore = path.join(fetchedPkg.path, 'package.json')
|
||||
if (await isSameFile(pkgJsonPath, pkgJsonPathInStore)) return true
|
||||
@@ -276,6 +280,11 @@ async function install (
|
||||
const bundledModules = path.join(dependency.hardlinkedLocation, 'node_modules')
|
||||
await linkBins(bundledModules, binPath)
|
||||
}
|
||||
|
||||
logStatus({
|
||||
status: 'installed',
|
||||
pkg: Object.assign({}, loggedPkg, {version: pkg.version}),
|
||||
})
|
||||
} else {
|
||||
await linking
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user