Skip to content
This repository was archived by the owner on Feb 18, 2022. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,13 @@ function downloadNpmPackage(name: string, version: string, outDir: string): stri
const fullName = `${npmName}@${version}`;
const cpOpts = { encoding: "utf8", maxBuffer: 100 * 1024 * 1024 } as const;
const npmPack = cp.execFileSync("npm", ["pack", fullName, "--json", "--silent"], cpOpts).trim();
const tarballName = npmPack.endsWith(".tgz") ? npmPack : JSON.parse(npmPack)[0].filename as string;
let tarballName = npmPack.endsWith(".tgz") ? npmPack : JSON.parse(npmPack)[0].filename as string;

// Npm does not report the correct filename for scoped packages. See https://github.com/npm/cli/issues/3405.
if (!fs.existsSync(tarballName)) {
tarballName = tarballName.replace(/^@/, '').replace(/\//, '-');
}

const outPath = path.join(outDir, name);
initDir(outPath);
const args = os.platform() === "darwin"
Expand Down