Browse Source

fix: only use --force-local tar flag on Windows

macOS BSD tar does not support --force-local. Only needed on Windows
where drive letters (C:) get misinterpreted as remote hosts.
Ma 7 months ago
parent
commit
eb29720020
1 changed files with 2 additions and 1 deletions
  1. 2 1
      packages/cli/src/__tests__/publish-package.test.ts

+ 2 - 1
packages/cli/src/__tests__/publish-package.test.ts

@@ -24,7 +24,8 @@ async function extractPackedPackageJson(packDir: string) {
     throw new Error(`Expected exactly one tarball in ${packDir}, found ${tgzFiles.length}`);
     throw new Error(`Expected exactly one tarball in ${packDir}, found ${tgzFiles.length}`);
   }
   }
 
 
-  return execFileSync("tar", ["--force-local", "-xOf", join(packDir, tgzFiles[0]), "package/package.json"], {
+  const tarArgs = process.platform === "win32" ? ["--force-local", "-xOf"] : ["-xOf"];
+  return execFileSync("tar", [...tarArgs, join(packDir, tgzFiles[0]), "package/package.json"], {
     cwd: workspaceRoot,
     cwd: workspaceRoot,
     encoding: "utf-8",
     encoding: "utf-8",
   });
   });