fix(reporter): log all installation steps for top deps

This commit is contained in:
zkochan
2017-04-07 01:44:26 +03:00
parent 0a130d310d
commit da20e93f5b
5 changed files with 20 additions and 16 deletions

View File

@@ -63,10 +63,10 @@
"parse-npm-tarball-url": "^1.0.1",
"path-exists": "^3.0.0",
"path-name": "^1.0.0",
"pnpm-default-reporter": "^0.5.1",
"pnpm-default-reporter": "^0.6.0",
"pnpm-file-reporter": "^0.0.1",
"pnpm-install-checks": "^1.1.0",
"pnpm-logger": "^0.2.0",
"pnpm-logger": "^0.3.0",
"proper-lockfile": "^2.0.0",
"ramda": "^0.23.0",
"rc": "^1.2.0",

View File

@@ -61,7 +61,6 @@ export default async function fetch (
metaCache: options.metaCache,
offline: options.offline,
})
logStatus({status: 'resolved', pkg: options.loggedPkg})
// keep the shrinkwrap resolution when possible
// to keep the original shasum
if (pkgId !== resolveResult.id || !resolution) {
@@ -72,15 +71,16 @@ export default async function fetch (
fetchingPkg = Promise.resolve(resolveResult.package)
}
}
const id = <string>pkgId
logStatus({status: 'resolved', pkgId: id, pkg: options.loggedPkg})
const target = path.join(options.storePath, id)
const fetchingFiles = options.fetchingLocker(id, () => fetchToStore({
target,
resolution: <Resolution>resolution,
loggedPkg: options.loggedPkg,
pkgId: id,
got: options.got,
localRegistry: options.localRegistry,
offline: options.offline,
@@ -116,7 +116,7 @@ export default async function fetch (
async function fetchToStore (opts: {
target: string,
resolution: Resolution,
loggedPkg: LoggedPkg,
pkgId: string,
got: Got,
localRegistry: string,
offline: boolean,
@@ -142,13 +142,13 @@ async function fetchToStore (opts: {
await fetchResolution(opts.resolution, targetStage, {
got: opts.got,
loggedPkg: opts.loggedPkg,
pkgId: opts.pkgId,
localRegistry: opts.localRegistry,
offline: opts.offline,
})
logStatus({
status: 'fetched',
pkg: opts.loggedPkg // TODO: add version
pkgId: opts.pkgId,
})
// fs.rename(oldPath, newPath) is an atomic operation, so we do it at the

View File

@@ -1,4 +1,4 @@
import logger, {LoggedPkg} from 'pnpm-logger'
import logger from 'pnpm-logger'
import fs = require('mz/fs')
import path = require('path')
import spawn = require('cross-spawn')
@@ -19,7 +19,7 @@ const gitLogger = logger('git')
const fetchLogger = logger('fetch')
export type FetchOptions = {
loggedPkg: LoggedPkg,
pkgId: string,
got: Got,
localRegistry: string,
offline: boolean,
@@ -117,11 +117,11 @@ export async function fetchFromRemoteTarball (dir: string, dist: PackageDist, op
}
await opts.got.download(dist.tarball, localTarballPath, {
shasum: dist.shasum,
onStart: () => logStatus({status: 'fetching', pkg: opts.loggedPkg}),
onStart: () => logStatus({status: 'fetching', pkgId: opts.pkgId}),
onProgress: (done: number, total: number) =>
logStatus({
status: 'fetching',
pkg: opts.loggedPkg,
pkgId: opts.pkgId,
progress: { done, total },
})
})

View File

@@ -201,6 +201,8 @@ async function install (
})
const pkg = await fetchedPkg.fetchingPkg
logStatus({status: 'downloaded_manifest', pkgId: fetchedPkg.id, pkgVersion: pkg.version})
let dependencyIds: string[] | void
const isInstallable = options.isInstallable !== false && (options.force || await getIsInstallable(fetchedPkg.id, pkg, fetchedPkg, options))
@@ -238,10 +240,7 @@ async function install (
addInstalledPkg(ctx.installs, dependency)
logStatus({
status: 'installed',
pkg: Object.assign({}, loggedPkg, {version: pkg.version}),
})
logStatus({status: 'dependencies_installed', pkgId: fetchedPkg.id})
return dependency
}

View File

@@ -12,6 +12,7 @@ import {InstalledPackages} from '../api/install'
import linkBins from './linkBins'
import {Package, Dependencies} from '../types'
import resolvePeers, {DependencyTreeNode, DependencyTreeNodeMap} from './resolvePeers'
import logStatus from '../logging/logInstallStatus'
export type LinkedPackage = {
id: string,
@@ -68,6 +69,10 @@ export default async function (
for (let pkg of flatResolvedDeps.filter(pkg => pkg.depth === 0)) {
await symlinkDependencyTo(pkg, opts.baseNodeModules)
logStatus({
status: 'installed',
pkgId: pkg.id,
})
}
const binPath = opts.global ? globalBinPath() : path.join(opts.baseNodeModules, '.bin')
await linkBins(opts.baseNodeModules, binPath)