Add DMG background images and update asset management
All checks were successful
farmcontrol/farmcontrol-server/pipeline/head This commit looks good
All checks were successful
farmcontrol/farmcontrol-server/pipeline/head This commit looks good
- Introduced new background images for macOS DMG packaging, including standard and retina versions. - Updated the finalize-desktop-artifacts.mjs script to check for the presence of these background images, enhancing error handling. - Refactored the ensureMacDmgAssets function to improve asset validation and streamline the DMG building process.
This commit is contained in:
parent
f63b1fbc37
commit
eb49ba7ce3
BIN
assets/dmg/background.png
Normal file
BIN
assets/dmg/background.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 13 KiB |
BIN
assets/dmg/background@2x.png
Normal file
BIN
assets/dmg/background@2x.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 29 KiB |
@ -190,13 +190,19 @@ function cleanStagingArtifacts(keepNames) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const MAC_DMG_ASSETS_DIR = path.join(rootDir, "packaging/macos/dmg");
|
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_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 });
|
mkdirSync(MAC_DMG_ASSETS_DIR, { recursive: true });
|
||||||
|
|
||||||
const voliconPath = path.join(MAC_DMG_ASSETS_DIR, "volicon.icns");
|
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");
|
const iconsetPath = path.join(rootDir, "assets/icon.iconset");
|
||||||
|
|
||||||
if (!existsSync(voliconPath) && existsSync(iconsetPath)) {
|
if (!existsSync(voliconPath) && existsSync(iconsetPath)) {
|
||||||
@ -213,16 +219,19 @@ async function ensureMacDmgAssets() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!existsSync(backgroundPath)) {
|
if (!existsSync(MAC_DMG_BACKGROUND_PATH)) {
|
||||||
const { Jimp } = await import("jimp");
|
throw new Error(`DMG background not found at ${MAC_DMG_BACKGROUND_PATH}`);
|
||||||
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_RETINA_PATH)) {
|
||||||
|
console.warn(
|
||||||
|
`finalize-desktop-artifacts: retina DMG background not found at ${MAC_DMG_BACKGROUND_RETINA_PATH}`,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
volicon: existsSync(voliconPath) ? voliconPath : null,
|
volicon: existsSync(voliconPath) ? voliconPath : null,
|
||||||
background: existsSync(backgroundPath) ? backgroundPath : null,
|
background: MAC_DMG_BACKGROUND_PATH,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -260,19 +269,19 @@ function buildMacDmgWithCreateDmg(
|
|||||||
"200",
|
"200",
|
||||||
"120",
|
"120",
|
||||||
"--window-size",
|
"--window-size",
|
||||||
"700",
|
String(MAC_DMG_WINDOW_WIDTH),
|
||||||
"450",
|
String(MAC_DMG_WINDOW_HEIGHT),
|
||||||
"--icon-size",
|
"--icon-size",
|
||||||
"120",
|
"120",
|
||||||
"--icon",
|
"--icon",
|
||||||
appBundleName,
|
appBundleName,
|
||||||
"180",
|
"98",
|
||||||
"200",
|
"270",
|
||||||
"--hide-extension",
|
"--hide-extension",
|
||||||
appBundleName,
|
appBundleName,
|
||||||
"--app-drop-link",
|
"--app-drop-link",
|
||||||
"520",
|
"282",
|
||||||
"200",
|
"270",
|
||||||
"--format",
|
"--format",
|
||||||
"UDZO",
|
"UDZO",
|
||||||
];
|
];
|
||||||
@ -367,7 +376,7 @@ async function buildMacDmg(appBundlePath, arch) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let builtDmgPath;
|
let builtDmgPath;
|
||||||
const dmgAssets = await ensureMacDmgAssets();
|
const dmgAssets = ensureMacDmgAssets();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
builtDmgPath = buildMacDmgWithCreateDmg(
|
builtDmgPath = buildMacDmgWithCreateDmg(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user