mirror of
https://github.com/pnpm/pnpm.git
synced 2026-05-13 11:05:52 -04:00
* refactor: rename workspace.sort-packages and workspace.pkgs-graph - workspace.sort-packages -> workspace.projects-sorter - workspace.pkgs-graph -> workspace.projects-graph Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * refactor: rename packages/ to core/ and pkg-manifest.read-package-json to reader - Rename packages/ directory to core/ for clarity - Rename pkg-manifest/read-package-json to pkg-manifest/reader (@pnpm/pkg-manifest.reader) - Update all tsconfig, package.json, and lockfile references Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * refactor: consolidate runtime resolvers under engine/runtime domain - Remove unused @pnpm/engine.runtime.node.fetcher package - Rename engine/runtime/node.resolver to node-resolver (dash convention) - Move resolving/bun-resolver to engine/runtime/bun-resolver - Move resolving/deno-resolver to engine/runtime/deno-resolver - Update all package names, tsconfig paths, and lockfile references Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: update lockfile after removing node.fetcher Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: sort tsconfig references and package.json deps alphabetically Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: auto-fix import sorting Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: update __typings__ paths in tsconfig.lint.json for moved resolvers Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: remove deno-resolver from deps of bun-resolver --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
40 lines
1.2 KiB
TypeScript
40 lines
1.2 KiB
TypeScript
import { safeReadPackageJsonFromDir } from '@pnpm/pkg-manifest.reader'
|
|
|
|
import { runLifecycleHook, type RunLifecycleHookOptions } from './runLifecycleHook.js'
|
|
import { runLifecycleHooksConcurrently, type RunLifecycleHooksConcurrentlyOptions } from './runLifecycleHooksConcurrently.js'
|
|
|
|
export function makeNodeRequireOption (modulePath: string): { NODE_OPTIONS: string } {
|
|
let { NODE_OPTIONS } = process.env
|
|
NODE_OPTIONS = `${NODE_OPTIONS ?? ''} --require=${modulePath}`.trim()
|
|
return { NODE_OPTIONS }
|
|
}
|
|
|
|
export {
|
|
runLifecycleHook,
|
|
type RunLifecycleHookOptions,
|
|
runLifecycleHooksConcurrently,
|
|
type RunLifecycleHooksConcurrentlyOptions,
|
|
}
|
|
|
|
export async function runPostinstallHooks (
|
|
opts: RunLifecycleHookOptions
|
|
): Promise<boolean> {
|
|
const pkg = await safeReadPackageJsonFromDir(opts.pkgRoot)
|
|
if (pkg == null) return false
|
|
if (pkg.scripts == null) {
|
|
pkg.scripts = {}
|
|
}
|
|
|
|
if (pkg.scripts.preinstall) {
|
|
await runLifecycleHook('preinstall', pkg, opts)
|
|
}
|
|
const executedAnInstallScript = await runLifecycleHook('install', pkg, opts)
|
|
if (pkg.scripts.postinstall) {
|
|
await runLifecycleHook('postinstall', pkg, opts)
|
|
}
|
|
|
|
return pkg.scripts.preinstall != null ||
|
|
executedAnInstallScript ||
|
|
pkg.scripts.postinstall != null
|
|
}
|