mirror of
https://github.com/pnpm/pnpm.git
synced 2026-05-05 06:28:47 -04:00
feat: add missing logging
This commit is contained in:
@@ -28,8 +28,10 @@ import getPkgInfoFromShr from 'supi/lib/getPkgInfoFromShr'
|
||||
import {npmRunScript} from 'supi/lib/install/postInstall'
|
||||
import linkBins, {linkPkgBins} from 'supi/lib/link/linkBins' // TODO: move to separate package
|
||||
import {
|
||||
packageJsonLogger,
|
||||
rootLogger,
|
||||
stageLogger,
|
||||
statsLogger,
|
||||
summaryLogger,
|
||||
} from 'supi/lib/loggers'
|
||||
import logStatus from 'supi/lib/logging/logInstallStatus'
|
||||
@@ -85,6 +87,8 @@ export default async (
|
||||
|
||||
const pkg = await readPkg(path.join(opts.prefix, 'package.json')) as PackageJson
|
||||
|
||||
packageJsonLogger.debug({ initial: pkg })
|
||||
|
||||
const scripts = !opts.ignoreScripts && pkg.scripts || {}
|
||||
|
||||
const scriptsOpts = {
|
||||
@@ -110,6 +114,9 @@ export default async (
|
||||
stageLogger.debug('importing_started')
|
||||
const depGraph = await shrinkwrapToDepGraph(filteredShrinkwrap, opts)
|
||||
|
||||
statsLogger.debug({added: Object.keys(depGraph).length})
|
||||
statsLogger.debug({removed: 0}) // TODO: implement removing orphans
|
||||
|
||||
await Promise.all([
|
||||
linkAllModules(depGraph, {optional: opts.optional}),
|
||||
linkAllPkgs(opts.storeController, R.values(depGraph), opts),
|
||||
|
||||
@@ -5,7 +5,11 @@ import path = require('path')
|
||||
import exists = require('path-exists')
|
||||
import rimraf = require('rimraf-then')
|
||||
import sinon = require('sinon')
|
||||
import {StageLog} from 'supi'
|
||||
import {
|
||||
StageLog,
|
||||
StatsLog,
|
||||
PackageJsonLog,
|
||||
} from 'supi'
|
||||
import testDefaults from './utils/testDefaults'
|
||||
|
||||
const fixtures = path.join(__dirname, 'fixtures')
|
||||
@@ -27,6 +31,21 @@ test('installing a simple project', async (t) => {
|
||||
t.ok(await project.loadCurrentShrinkwrap())
|
||||
t.ok(await project.loadModules())
|
||||
|
||||
t.ok(reporter.calledWithMatch({
|
||||
initial: require(path.join(prefix, 'package.json')),
|
||||
level: 'debug',
|
||||
name: 'pnpm:package-json',
|
||||
} as PackageJsonLog), 'initial package.json logged')
|
||||
t.ok(reporter.calledWithMatch({
|
||||
added: 15,
|
||||
level: 'debug',
|
||||
name: 'pnpm:stats',
|
||||
} as StatsLog), 'added stat')
|
||||
t.ok(reporter.calledWithMatch({
|
||||
removed: 0,
|
||||
level: 'debug',
|
||||
name: 'pnpm:stats',
|
||||
} as StatsLog), 'removed stat')
|
||||
t.ok(reporter.calledWithMatch({
|
||||
level: 'debug',
|
||||
message: 'importing_done',
|
||||
|
||||
Reference in New Issue
Block a user