pnpm/exec/lifecycle
await-ovo 77c754b10a
chore: eslint issues (#6123)
2023-02-23 12:12:32 +02:00
..
src fix: remove `suppressImplicitAnyIndexErrors` from typescript settings (#5991) 2023-01-28 18:19:26 +02:00
test fix: throw an error while missing script start or server.js (#5782) 2022-12-12 10:47:14 +00:00
CHANGELOG.md chore(release): 7.27.0 2023-02-08 14:27:15 +02:00
README.md refactor: group projects in different subdirectories (#5659) 2022-11-20 01:35:22 +02:00
jest.config.js refactor: group projects in different subdirectories (#5659) 2022-11-20 01:35:22 +02:00
package.json chore: eslint issues (#6123) 2023-02-23 12:12:32 +02:00
tsconfig.json fix: remove `suppressImplicitAnyIndexErrors` from typescript settings (#5991) 2023-01-28 18:19:26 +02:00
tsconfig.lint.json refactor: put all non-public projects to directories that start with __ 2022-11-20 02:40:44 +02:00

README.md

@pnpm/lifecycle

Package lifecycle hook runner

npm version

Installation

pnpm add @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,
  rawConfig: {},
  rootModulesDir: path.resolve('node_modules'),
  unsafePerm: true,
})

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

API

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

runPostinstallHooks(opts): Promise<void>

License

MIT