Skip to content

Commit

Permalink
feat: integrated archive to create an archive needed during build
Browse files Browse the repository at this point in the history
  • Loading branch information
TimPietrusky committed Feb 21, 2024
1 parent a8d9596 commit 173d698
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions scripts/archive.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import fsp from "node:fs/promises";
import path from "node:path";
import { fileURLToPath } from "node:url";

import Seven from "node-7z";

const __dirname = path.dirname(fileURLToPath(import.meta.url));
const my7z = path.join(__dirname, "..", "resources", "7zip", "win", "7za.exe");

const sourceFolder = path.join(__dirname, "..", "resources", "python-embedded");
const outputArchive = path.join(__dirname, "..", "resources", "python-embedded.7z");

const files = await fsp.readdir(sourceFolder);

const archive = Seven.add(
outputArchive,
files.map(file => path.join(sourceFolder, file)),
{
$bin: my7z,
recursive: true,
}
);

archive.on("end", () => {
console.log("Compression finished");
});

archive.on("error", error => {
console.error("Compression error:", error);
});

0 comments on commit 173d698

Please sign in to comment.