🌳
pt0/deployF/pnpmF/pnpmInstallF.mts
1import { execSync } from 'node:child_process'
3export type PnpmInstallOpts = {
4 cwd?: string
5 lockfileOnly?: boolean
6 noFrozenLockfile?: boolean
7 preferOffline?: boolean
8 timeoutMs?: number
9}
11export const pnpmInstallSync = (opts: PnpmInstallOpts = {}) => {
12 const flags = [
13 'install',
14 opts.lockfileOnly && '--lockfile-only',
15 opts.noFrozenLockfile && '--no-frozen-lockfile',
16 opts.preferOffline && '--prefer-offline',
17 '--reporter=silent',
18 ].filter(Boolean).join(' ')
19 return execSync(`corepack pnpm ${flags}`, {
20 stdio: 'pipe',
21 timeout: opts.timeoutMs ?? 300_000,
22 ...(opts.cwd ? {cwd: opts.cwd} : {}),
23 })