Skip to content

Commit 9214762

Browse files
fix(release): store hard-linked files as plain files in Linux CLI archives
pnpm and node-gyp leave hard links in the staged node_modules on Linux, GNU tar records them as link entries, and npm refuses a tarball that carries one. Co-Authored-By: Claude Fable 5 <[email protected]>
1 parent 958d853 commit 9214762

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

‎scripts/build-cli-archive.ts‎

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -542,8 +542,20 @@ const buildCliArchive = Effect.fn("buildCliArchive")(function* (input: {
542542
"tar (zip)",
543543
);
544544
} else {
545+
// On Linux, pnpm hard-links identical files out of its store and node-gyp
546+
// hard-links build outputs, and GNU tar records those as link entries.
547+
// The npm registry rejects a tarball containing any, and the npm platform
548+
// packages are re-packed from this archive's contents, so store every
549+
// file as a file. macOS's bsdtar has no such flag; pnpm clones there.
545550
yield* runCommand(
546-
ChildProcess.make("tar", ["-czf", archivePath, "-C", stageRoot, stem]),
551+
ChildProcess.make("tar", [
552+
...(input.platform === "linux" ? ["--hard-dereference"] : []),
553+
"-czf",
554+
archivePath,
555+
"-C",
556+
stageRoot,
557+
stem,
558+
]),
547559
"tar (gzip)",
548560
);
549561
}

0 commit comments

Comments
 (0)