Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
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
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