Skip to content

Commit

Permalink
fix: remove some backup files generated by pkg if present (#1287)
Browse files Browse the repository at this point in the history
  • Loading branch information
fernandosanchezjr committed May 17, 2024
1 parent 9a9b7ba commit 9f160ad
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions binary/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand Down Expand Up @@ -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({
Expand Down

0 comments on commit 9f160ad

Please sign in to comment.