import { readJSON, writeJSON } from 'fs-extra'; import { join } from 'path'; export async function addPackageScripts({ cwd, scripts, }: { cwd: string; scripts: Record; }) { const packageJsonPath = join(cwd, 'package.json'); const packageJson = await readJSON(packageJsonPath); packageJson.scripts = { ...packageJson.scripts, ...scripts, }; await writeJSON(packageJsonPath, packageJson, { spaces: 2 }); }