Refactor finalize-desktop-artifacts.mjs for improved readability and consistency
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
- Reformatted code for better readability by adjusting line breaks and indentation. - Updated macOS DMG window dimensions for improved layout. - Streamlined the build architecture retrieval process for clarity. - Enhanced filtering logic in the canUseDirectDmgSourceFolder function for consistency.
This commit is contained in:
parent
d0d43aebb7
commit
ffe8bce3a5
@ -22,7 +22,10 @@ import {
|
||||
import { codesignMacAppBundle } from "./codesign-macos-app.mjs";
|
||||
import { prepareWindowsAppBinaries } from "./prepare-windows-app-binaries.mjs";
|
||||
|
||||
const rootDir = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
|
||||
const rootDir = path.resolve(
|
||||
path.dirname(fileURLToPath(import.meta.url)),
|
||||
"..",
|
||||
);
|
||||
const packageJson = JSON.parse(
|
||||
readFileSync(path.join(rootDir, "package.json"), "utf8"),
|
||||
);
|
||||
@ -36,9 +39,7 @@ const targetOs =
|
||||
: process.platform === "linux"
|
||||
? "linux"
|
||||
: null);
|
||||
const buildArch = getReleaseArch(
|
||||
process.env.ELECTROBUN_ARCH || process.arch,
|
||||
);
|
||||
const buildArch = getReleaseArch(process.env.ELECTROBUN_ARCH || process.arch);
|
||||
const version =
|
||||
process.env.ELECTROBUN_APP_VERSION || getReleaseVersion(packageJson);
|
||||
const artifactDir =
|
||||
@ -197,8 +198,8 @@ const MAC_DMG_BACKGROUND_RETINA_PATH = path.join(
|
||||
"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;
|
||||
const MAC_DMG_WINDOW_WIDTH = 540;
|
||||
const MAC_DMG_WINDOW_HEIGHT = 380;
|
||||
|
||||
function ensureMacDmgAssets() {
|
||||
mkdirSync(MAC_DMG_ASSETS_DIR, { recursive: true });
|
||||
@ -327,8 +328,7 @@ function canUseDirectDmgSourceFolder(appBundlePath) {
|
||||
const platformDir = path.dirname(appBundlePath);
|
||||
const appName = path.basename(appBundlePath);
|
||||
const entries = readdirSync(platformDir).filter(
|
||||
(entry) =>
|
||||
!entry.startsWith(".") && entry !== ".finalize-dmg-staging",
|
||||
(entry) => !entry.startsWith(".") && entry !== ".finalize-dmg-staging",
|
||||
);
|
||||
|
||||
return entries.length === 1 && entries[0] === appName;
|
||||
@ -368,10 +368,7 @@ async function buildMacDmg(appBundlePath, arch) {
|
||||
if (!useDirectSource) {
|
||||
rmSync(stagingDir, { recursive: true, force: true });
|
||||
mkdirSync(stagingDir, { recursive: true });
|
||||
const stagedAppPath = path.join(
|
||||
stagingDir,
|
||||
path.basename(appBundlePath),
|
||||
);
|
||||
const stagedAppPath = path.join(stagingDir, path.basename(appBundlePath));
|
||||
copyMacAppBundle(appBundlePath, stagedAppPath);
|
||||
codesignMacAppBundle(stagedAppPath);
|
||||
}
|
||||
@ -449,8 +446,7 @@ function buildWindowsNsis(appDir, arch) {
|
||||
artifactDir,
|
||||
getReleaseArtifactName(version, arch, "exe"),
|
||||
);
|
||||
const powershell =
|
||||
process.env.SystemRoot
|
||||
const powershell = process.env.SystemRoot
|
||||
? path.join(
|
||||
process.env.SystemRoot,
|
||||
"System32",
|
||||
@ -494,8 +490,7 @@ function buildWindowsMsi(setupExePath, arch) {
|
||||
artifactDir,
|
||||
getReleaseArtifactName(version, arch, "msi"),
|
||||
);
|
||||
const powershell =
|
||||
process.env.SystemRoot
|
||||
const powershell = process.env.SystemRoot
|
||||
? path.join(
|
||||
process.env.SystemRoot,
|
||||
"System32",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user