fix: remove some backup files generated by pkg if present (#1287)

This commit is contained in:
Fernando 2024-05-16 21:22:33 -07:00 • committed by GitHub
parent 9a9b7baf15
commit 9f160ad11a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -20,6 +20,10 @@ const architectures = ["x64", "arm64"];
let targets = platforms.flatMap((platform) =>
architectures.map((arch) => `${platform}-${arch}`),
);
const assetBackups = [
"node_modules/win-ca/lib/crypt32-ia32.node.bak",
"node_modules/win-ca/lib/crypt32-x64.node.bak"
];
let esbuildOnly = false;
for (let i = 2; i < process.argv.length; i++) {
@ -152,6 +156,13 @@ async function installNodeModuleInTempDirAndCopyToCurrent(package, toCopy) {
}
}
console.log("[info] Cleaning up artifacts from previous builds...");
// delete asset backups generated by previous pkg invocations, if present
for (const assetPath of assetBackups) {
fs.rmSync(assetPath, {force: true});
}
console.log("[info] Building with esbuild...");
// Bundles the extension into one file
await esbuild.build({