Files
pnpm/packages/lifecycle
Zoltan Kochan ded5171a49 feat: better reporting of child processes output
PR #1573

* feat(reporting): collapse build output of deps inside node_modules

ref #1440

* feat(reporting): nicer reporting of lifecycle output

* feat(reporting): print the number of collapsed lines

* feat(reporting): always print the status of the child processes

* refactor: reporting

* feat(reporting): nicer indentation

* feat(reporting): report duration of script run

close #1440
2018-12-23 16:42:27 +02:00
..
2018-12-21 01:58:27 +02:00
2018-12-15 22:56:20 +02:00

@pnpm/lifecycle

Package lifecycle hook runner

npm version

Installation

npm i -S @pnpm/logger @pnpm/lifecycle

Usage

import runLifecycleHook, {runPostinstallHooks} from '@pnpm/lifecycle'

const targetPkgRoot = path.resolve('node_modules/target-pkg')
const pkg = require(path.join(targetPkgRoot, 'package.json'))

// Run a specific hook
await runLifecycleHook('preinstall', pkg, {
  pkgId: 'target-pkg/1.0.0',
  pkgRoot: targetPkgRoot,
  rawNpmConfig: {},
  rootNodeModulesDir: path.resolve('node_modules'),
  unsafePerm: true,
})

// Run all install hooks
await runPostinstallHooks({
  pkgId: 'target-pkg/1.0.0',
  pkgRoot: targetPkgRoot,
  rawNpmConfig: {},
  rootNodeModulesDir: path.resolve('node_modules'),
  unsafePerm: true,
})

API

runLifecycleHook(stage, packageJson, opts): Promise<void>

runPostinstallHooks(opts): Promise<void>

License

MIT © Zoltan Kochan