| 8 | const pkg = JSON.parse(readFileSync(join(root, "package.json"), "utf8")); |
| 9 | |
| 10 | function run(label, command, args, options = {}) { |
| 11 | console.log(`==> ${label}`); |
| 12 | const { quiet, ...spawnOptions } = options; |
| 13 | const result = spawnSync(command, args, { |
| 14 | cwd: root, |
| 15 | stdio: quiet ? "pipe" : "inherit", |
| 16 | shell: process.platform === "win32", |
| 17 | ...spawnOptions, |
| 18 | }); |
| 19 | if (result.status !== 0) { |
| 20 | console.error(`Package smoke failed: ${label}`); |
| 21 | if (quiet) { |
| 22 | if (result.stdout) process.stderr.write(result.stdout); |
| 23 | if (result.stderr) process.stderr.write(result.stderr); |
| 24 | } |
| 25 | process.exit(result.status ?? 1); |
| 26 | } |
| 27 | } |
| 28 | |
| 29 | function assertPath(path, label = path) { |
| 30 | const full = join(root, path); |