diff --git a/binary/build.js b/binary/build.js index 7a13c43edb..0553edb855 100644 --- a/binary/build.js +++ b/binary/build.js @@ -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({