chore(pack-verify): retain tarball on failure (fix dead cleanup flag)
Review follow-up: `cleanupTarball` was always true (set true at init and again in the catch), so the finally guard was dead logic. Make it meaningful — retain the packed tarball on failure so a packaging problem can be inspected, and log where it is; the happy path still removes it. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BrihGWcrM9JGRyu41nzZYw
This commit is contained in:
parent
7815548300
commit
c1b168e522
1 changed files with 5 additions and 1 deletions
|
|
@ -151,6 +151,8 @@ console.log(
|
||||||
// runs the package's postinstall).
|
// runs the package's postinstall).
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
const work = mkdtempSync(join(tmpdir(), "pack-verify-"));
|
const work = mkdtempSync(join(tmpdir(), "pack-verify-"));
|
||||||
|
// Remove the packed tarball on success; retain it on failure so a packaging
|
||||||
|
// problem can be inspected (unpack it, diff the file list).
|
||||||
let cleanupTarball = true;
|
let cleanupTarball = true;
|
||||||
try {
|
try {
|
||||||
ensureTestServer();
|
ensureTestServer();
|
||||||
|
|
@ -253,7 +255,9 @@ try {
|
||||||
"web (prod / served dist), cli (stdio tools/list), and tui (help) end to end.",
|
"web (prod / served dist), cli (stdio tools/list), and tui (help) end to end.",
|
||||||
);
|
);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
cleanupTarball = true;
|
// Keep the tarball around for post-mortem inspection of the packaging failure.
|
||||||
|
cleanupTarball = false;
|
||||||
|
console.error(`pack:verify — tarball retained for inspection at ${tarball}`);
|
||||||
fail(err instanceof Error ? err.message : String(err));
|
fail(err instanceof Error ? err.message : String(err));
|
||||||
} finally {
|
} finally {
|
||||||
rmSync(work, { recursive: true, force: true });
|
rmSync(work, { recursive: true, force: true });
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue