Skip to content

Commit

Permalink
Fix dmg build
Browse files Browse the repository at this point in the history
  • Loading branch information
OrigamingWasTaken committed Jul 4, 2024
1 parent 369e21d commit 4333f3e
Showing 1 changed file with 19 additions and 17 deletions.
36 changes: 19 additions & 17 deletions scripts/build/ts/dmg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ async function createCustomDMG(options: DmgOptions) {
`--window-pos ${windowPos || "200 120"}`, // Default to '200 120' if not provided
`--window-size ${windowSize || "800 400"}`, // Default to '800 400' if not provided
`--text-size ${textSize || 12}`, // Default to 12 if not provided
`--icon-size ${iconSize || 100}`, // Default to 100
`--icon-size ${iconSize || 100}`, // Default to 100
iconPos ? `--icon "${BuildConfig.appName}.app" ${iconPos}` : "", // Icon position (left, y centered)
`--app-drop-link ${appDropLink || "600 120"}`, // Default to '600 120' (right side) if not provided
`"${outputName}.dmg"`,
Expand All @@ -54,8 +54,8 @@ async function createCustomDMG(options: DmgOptions) {
console.log("DMG created successfully");
} catch (error) {
console.error("Failed to create DMG:", error);
console.error(error)
throw new Error("Failed to create dmg:\n" + error)
console.error(error);
throw new Error("Failed to create dmg:\n" + error);
}
}

Expand Down Expand Up @@ -90,20 +90,22 @@ async function build() {
return;
}

await createCustomDMG({
sourceFolder: appFolder,
outputName: path.join(path.resolve("./dist"), `${BuildConfig.appName}-${version}_${app}`),
volumeName: `${BuildConfig.appName}_${app}`,
backgroundPath: path.resolve("./build/assets/bg.png"),
windowPos: "200 120",
windowSize: "600 360",
iconSize: 90,
iconPos: "160 180",
appDropLink: "440 180",
}).catch(()=>{
l.fatal(`failed to package mac_${app}, skipping.`)
break;
});
try {
await createCustomDMG({
sourceFolder: appFolder,
outputName: path.join(path.resolve("./dist"), `${BuildConfig.appName}-${version}_${app}`),
volumeName: BuildConfig.appName,
backgroundPath: path.resolve("./build/assets/bg.png"),
windowPos: "200 120",
windowSize: "600 360",
iconSize: 90,
iconPos: "160 180",
appDropLink: "440 180",
});
} catch (err) {
l.fatal(`failed to package mac_${app}, skipping.`);
continue;
}

l.complete(`mac_${app} packaged in ${((performance.now() - appTime) / 1000).toFixed(3)}s`);
console.log("");
Expand Down

0 comments on commit 4333f3e

Please sign in to comment.