Skip to content

Commit

Permalink
label intermediate build files appropriately
Browse files Browse the repository at this point in the history
  • Loading branch information
Bedrockbreaker committed Dec 25, 2024
1 parent ae0d068 commit 20eaeff
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
4 changes: 2 additions & 2 deletions rollup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,14 +138,14 @@ function evalPredicate(predicate: string): boolean {

const output: OutputOptions[] = [
{
file: "./dist/partypooper.cjs",
file: `./dist/partypooper${{static: "", shared: "-shared", none: "-no-ffmpeg"}[process.env.FFMPEG || "static"]}.cjs`,
format: "commonjs"
}
];

if (process.env.BUILD === "release") {
output.push({
file: "./dist/partypooper.min.cjs",
file: `./dist/partypooper${{static: "", shared: "-shared", none: "-no-ffmpeg"}[process.env.FFMPEG || "static"]}.min.cjs`,
format: "commonjs",
plugins: [terser()]
});
Expand Down
14 changes: 9 additions & 5 deletions tools/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,13 @@ function generateBlob(target: BuildTarget, ffmpegMode: FfmpegMode) {
throw new Error(`Incompatible node version: ${process.version}. Minimum required: ${minimumNodeVersion}`);
}

const configPath = `./dist/sea-config-${target.asNodeString()}.json`;
const ffmpegSuffix = {static: "", shared: "-shared", none: "-no-ffmpeg"}[ffmpegMode || "static"];

const configPath = `./dist/sea-config-${target.asNodeString()}${ffmpegSuffix}.json`;

const config = {
main: "./dist/partypooper.min.cjs",
output: `./dist/partypooper-${target.asNodeString()}.blob`,
main: `./dist/partypooper${ffmpegSuffix}.min.cjs`,
output: `./dist/partypooper-${target.asNodeString()}${ffmpegSuffix}.blob`,
disableExperimentalSEAWarning: true,
assets: {} as Record<string, string>
};
Expand Down Expand Up @@ -300,9 +302,11 @@ program
generateBlob(target, ffmpegMode);
}

const ffmpegSuffix = {static: "", shared: "-shared", none: "-no-ffmpeg"}[ffmpegMode || "static"];

for (const target of targets) {
const executablePath = await getNode(target, targetNodeVersion);
const appName = `PartyPooper-${{static: "", shared: "ffmpeg-shared-", none: "ffmpeg-none-"}[ffmpegMode]}${target.asNodeString()}`;
const appName = `PartyPooper-${target.asNodeString()}${ffmpegSuffix}`;
const distExecutable = join("./dist", `${appName}${target.isWindows ? ".exe" : ""}`);
copyFileSync(executablePath, distExecutable);

Expand All @@ -311,7 +315,7 @@ program
await inject(
distExecutable,
"NODE_SEA_BLOB",
readFileSync(`./dist/partypooper-${target.asNodeString()}.blob`),
readFileSync(`./dist/partypooper-${target.asNodeString()}${ffmpegSuffix}.blob`),
{sentinelFuse: "NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2"}
);

Expand Down

0 comments on commit 20eaeff

Please sign in to comment.