diff --git a/assets/dmg/background.png b/assets/dmg/background.png new file mode 100644 index 0000000..6a8b823 Binary files /dev/null and b/assets/dmg/background.png differ diff --git a/assets/dmg/background@2x.png b/assets/dmg/background@2x.png new file mode 100644 index 0000000..bb10936 Binary files /dev/null and b/assets/dmg/background@2x.png differ diff --git a/scripts/finalize-desktop-artifacts.mjs b/scripts/finalize-desktop-artifacts.mjs index 7ddc254..152bec1 100644 --- a/scripts/finalize-desktop-artifacts.mjs +++ b/scripts/finalize-desktop-artifacts.mjs @@ -190,13 +190,19 @@ function cleanStagingArtifacts(keepNames) { } const MAC_DMG_ASSETS_DIR = path.join(rootDir, "packaging/macos/dmg"); +const MAC_DMG_BACKGROUND_PATH = path.join(rootDir, "assets/dmg/background.png"); +const MAC_DMG_BACKGROUND_RETINA_PATH = path.join( + rootDir, + "assets/dmg/background@2x.png", +); const MAC_DMG_APP_NAME = "Farm Control Server.app"; +const MAC_DMG_WINDOW_WIDTH = 380; +const MAC_DMG_WINDOW_HEIGHT = 540; -async function ensureMacDmgAssets() { +function ensureMacDmgAssets() { mkdirSync(MAC_DMG_ASSETS_DIR, { recursive: true }); const voliconPath = path.join(MAC_DMG_ASSETS_DIR, "volicon.icns"); - const backgroundPath = path.join(MAC_DMG_ASSETS_DIR, "background.png"); const iconsetPath = path.join(rootDir, "assets/icon.iconset"); if (!existsSync(voliconPath) && existsSync(iconsetPath)) { @@ -213,16 +219,19 @@ async function ensureMacDmgAssets() { } } - if (!existsSync(backgroundPath)) { - const { Jimp } = await import("jimp"); - const background = new Jimp({ width: 700, height: 450, color: "#1f1f1f" }); - await background.write(backgroundPath); - console.log(`finalize-desktop-artifacts: generated DMG background at ${backgroundPath}`); + if (!existsSync(MAC_DMG_BACKGROUND_PATH)) { + throw new Error(`DMG background not found at ${MAC_DMG_BACKGROUND_PATH}`); + } + + if (!existsSync(MAC_DMG_BACKGROUND_RETINA_PATH)) { + console.warn( + `finalize-desktop-artifacts: retina DMG background not found at ${MAC_DMG_BACKGROUND_RETINA_PATH}`, + ); } return { volicon: existsSync(voliconPath) ? voliconPath : null, - background: existsSync(backgroundPath) ? backgroundPath : null, + background: MAC_DMG_BACKGROUND_PATH, }; } @@ -260,19 +269,19 @@ function buildMacDmgWithCreateDmg( "200", "120", "--window-size", - "700", - "450", + String(MAC_DMG_WINDOW_WIDTH), + String(MAC_DMG_WINDOW_HEIGHT), "--icon-size", "120", "--icon", appBundleName, - "180", - "200", + "98", + "270", "--hide-extension", appBundleName, "--app-drop-link", - "520", - "200", + "282", + "270", "--format", "UDZO", ]; @@ -367,7 +376,7 @@ async function buildMacDmg(appBundlePath, arch) { } let builtDmgPath; - const dmgAssets = await ensureMacDmgAssets(); + const dmgAssets = ensureMacDmgAssets(); try { builtDmgPath = buildMacDmgWithCreateDmg(