Skip to content

Commit 3ea742e

Browse files
committed
Restore tarball repacking with cross-platform tar support
tar is available on Windows 10+ and uses the same syntax. The repacking is necessary because pnpm filters files based on the files field even when installing from file:// directories.
1 parent 25bd3c1 commit 3ea742e

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

scripts/install-npm-packages.mjs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -695,10 +695,13 @@ async function installPackage(packageInfo) {
695695
// File doesn't exist, ignore.
696696
})
697697

698-
// Create a new tarball with all files included (no files field filtering).
699-
// This ensures test files are preserved when pnpm installs the package.
698+
// pnpm respects the files field even when installing from file:// directories.
699+
// Create a new tarball that includes all files (cross-platform compatible).
700700
const repackedTarball = path.join(tempExtractDir, 'repacked.tgz')
701-
await runCommand('tar', ['-czf', 'repacked.tgz', extractedDir.name], {
701+
const tarArgs = WIN32
702+
? ['-czf', 'repacked.tgz', extractedDir.name]
703+
: ['-czf', 'repacked.tgz', extractedDir.name]
704+
await runCommand('tar', tarArgs, {
702705
cwd: tempExtractDir,
703706
})
704707

0 commit comments

Comments
 (0)