2022-12-30 00:49:00 -05:00
|
|
|
import { exec } from 'node:child_process';
|
|
|
|
import { promisify } from 'node:util';
|
|
|
|
|
|
|
|
const execAsync = promisify(exec);
|
|
|
|
|
2023-04-28 23:31:59 -05:00
|
|
|
const cmd = ['pnpm changeset version', ...process.argv.slice(2)].join(' ');
|
2022-12-30 00:49:00 -05:00
|
|
|
|
2023-01-07 08:14:17 -05:00
|
|
|
const catchCmdError = ({ stderr, stdout, code }) => {
|
|
|
|
console.log(stdout);
|
2022-12-30 00:49:00 -05:00
|
|
|
console.error(stderr);
|
|
|
|
process.exit(code ?? 1);
|
2023-01-06 03:33:08 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
console.log(cmd);
|
|
|
|
|
|
|
|
await execAsync(cmd).catch(catchCmdError);
|
|
|
|
|
|
|
|
// Manually run lifecycle script since changesets didn't
|
2023-04-02 04:05:18 -05:00
|
|
|
await execAsync(`pnpm -r version`).catch(catchCmdError);
|
2023-01-07 08:14:17 -05:00
|
|
|
|
|
|
|
// Sanity check for prepublish scripts
|
2023-04-02 04:05:18 -05:00
|
|
|
await execAsync(`pnpm -r prepack`).catch(catchCmdError);
|
|
|
|
await execAsync(`pnpm -r prepublishOnly`).catch(catchCmdError);
|
2023-04-17 09:18:47 -05:00
|
|
|
|
|
|
|
// Update lockfile
|
|
|
|
await execAsync(`pnpm i --no-frozen-lockfile`).catch(catchCmdError);
|
|
|
|
|
|
|
|
// Show Git changes
|
|
|
|
await execAsync(`git status`).catch(catchCmdError);
|