feat(desktop): add signal macOS DMG installer background (#6201)
Co-authored-by: Rodrigo Brechard <[email protected]> Co-authored-by: Julius Marminge <[email protected]> Co-authored-by: codex <[email protected]>
This commit is contained in:
13 files changed
+384
-25
No files matched your search
@@ -0,0 +1,33 @@
|
||||
<svg width="1080" height="760" viewBox="0 0 540 380" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<defs>
|
||||
<linearGradient id="latest-surface" x1="0" y1="0" x2="540" y2="380" gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="#FAFAF9"/>
|
||||
<stop offset="1" stop-color="#F5F5F4"/>
|
||||
</linearGradient>
|
||||
<radialGradient id="latest-light" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(430 0) rotate(152) scale(320 150)">
|
||||
<stop stop-color="#FFFFFF"/>
|
||||
<stop offset="1" stop-color="#FFFFFF" stop-opacity="0"/>
|
||||
</radialGradient>
|
||||
</defs>
|
||||
|
||||
<rect width="540" height="380" fill="url(#latest-surface)"/>
|
||||
<rect width="540" height="112" fill="#EFEFED"/>
|
||||
<rect width="540" height="112" fill="url(#latest-light)"/>
|
||||
<path d="M0 111.5H540" stroke="#18181B" stroke-opacity="0.08"/>
|
||||
<path d="M32 28H64" stroke="#18181B" stroke-width="2"/>
|
||||
|
||||
<g font-family="-apple-system, BlinkMacSystemFont, sans-serif" fill="#18181B">
|
||||
<text x="32" y="50" font-size="12" font-weight="600" letter-spacing="1.4">T3 CODE</text>
|
||||
<text x="32" y="82" font-size="22" font-weight="600" letter-spacing="-0.45">Desktop</text>
|
||||
<text x="508" y="50" text-anchor="end" font-family="ui-monospace, SFMono-Regular, Menlo, monospace" font-size="8.5" font-weight="600" letter-spacing="1.2" fill="#71717A">LATEST RELEASE</text>
|
||||
</g>
|
||||
|
||||
<path d="M196 224C242 239 307 201 362 220" stroke="#71717A" stroke-width="1.5" stroke-linecap="round" stroke-dasharray="1 7" opacity="0.42"/>
|
||||
<circle cx="362" cy="220" r="2" fill="#71717A" opacity="0.55"/>
|
||||
<path d="M176 204V227L182 221L187.5 232L192 229.8L186.5 219H194L176 204Z" fill="#71717A" stroke="#F7F7F5" stroke-width="1.5" stroke-linejoin="round"/>
|
||||
|
||||
<g font-family="-apple-system, BlinkMacSystemFont, sans-serif" text-anchor="middle">
|
||||
<text x="270" y="322" font-size="13" font-weight="600" letter-spacing="-0.1" fill="#18181B">Drag T3 Code to Applications</text>
|
||||
<text x="270" y="345" font-size="9.5" fill="#71717A">Open it from Applications when the copy finishes.</text>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.0 KiB |
@@ -0,0 +1,64 @@
|
||||
<svg width="1080" height="760" viewBox="0 0 540 380" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<defs>
|
||||
<linearGradient id="night-sky" x1="28" y1="0" x2="510" y2="112" gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="#07152F"/>
|
||||
<stop offset="0.52" stop-color="#151443"/>
|
||||
<stop offset="1" stop-color="#32155B"/>
|
||||
</linearGradient>
|
||||
<radialGradient id="night-glow" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(420 18) rotate(157) scale(260 126)">
|
||||
<stop stop-color="#5165D8" stop-opacity="0.42"/>
|
||||
<stop offset="0.55" stop-color="#283075" stop-opacity="0.15"/>
|
||||
<stop offset="1" stop-color="#111635" stop-opacity="0"/>
|
||||
</radialGradient>
|
||||
<linearGradient id="night-cloud" x1="18" y1="62" x2="260" y2="112" gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="#4EA4FF" stop-opacity="0.5"/>
|
||||
<stop offset="0.52" stop-color="#696FEA" stop-opacity="0.62"/>
|
||||
<stop offset="1" stop-color="#A85BEA" stop-opacity="0.5"/>
|
||||
</linearGradient>
|
||||
<filter id="night-soft" x="-24" y="35" width="588" height="101" filterUnits="userSpaceOnUse">
|
||||
<feGaussianBlur stdDeviation="4"/>
|
||||
</filter>
|
||||
</defs>
|
||||
|
||||
<rect width="540" height="380" fill="#F7F7F5"/>
|
||||
<rect width="540" height="112" fill="url(#night-sky)"/>
|
||||
<rect width="540" height="112" fill="url(#night-glow)"/>
|
||||
|
||||
<g fill="#E4EAFF">
|
||||
<circle cx="20" cy="18" r="0.8" opacity="0.82"/>
|
||||
<circle cx="76" cy="27" r="0.55" opacity="0.55"/>
|
||||
<circle cx="133" cy="13" r="0.65" opacity="0.7"/>
|
||||
<circle cx="198" cy="28" r="0.5" opacity="0.5"/>
|
||||
<circle cx="258" cy="15" r="0.75" opacity="0.8"/>
|
||||
<circle cx="326" cy="29" r="0.5" opacity="0.55"/>
|
||||
<circle cx="384" cy="12" r="0.65" opacity="0.72"/>
|
||||
<circle cx="455" cy="26" r="0.55" opacity="0.58"/>
|
||||
<circle cx="517" cy="15" r="0.75" opacity="0.78"/>
|
||||
</g>
|
||||
<g stroke="#EEF2FF" stroke-linecap="round" stroke-width="0.65" opacity="0.68">
|
||||
<path d="M104 30V34M102 32H106"/>
|
||||
<path d="M448 24V28M446 26H450"/>
|
||||
</g>
|
||||
|
||||
<g filter="url(#night-soft)">
|
||||
<path d="M-12 112V101C-12 87 0 76 14 76C18 63 30 54 44 54C58 54 70 62 74 75C79 70 86 67 94 67C110 67 123 79 124 95C132 96 138 101 141 112H-12Z" fill="url(#night-cloud)"/>
|
||||
<path d="M374 112C375 98 387 87 401 87C405 72 418 62 434 62C450 62 463 72 467 87C478 87 488 94 492 104C506 103 518 106 526 112H374Z" fill="url(#night-cloud)" opacity="0.82"/>
|
||||
</g>
|
||||
<path d="M0 111.5H540" stroke="#050A19" stroke-opacity="0.3"/>
|
||||
<path d="M32 28H64" stroke="#FFFFFF" stroke-width="2"/>
|
||||
|
||||
<g font-family="-apple-system, BlinkMacSystemFont, sans-serif" fill="#FFFFFF">
|
||||
<text x="32" y="50" font-size="12" font-weight="600" letter-spacing="1.4">T3 CODE</text>
|
||||
<text x="32" y="82" font-size="22" font-weight="600" letter-spacing="-0.45">Desktop</text>
|
||||
<text x="508" y="50" text-anchor="end" font-family="ui-monospace, SFMono-Regular, Menlo, monospace" font-size="8.5" font-weight="600" letter-spacing="1.2" opacity="0.84">NIGHTLY BUILD</text>
|
||||
</g>
|
||||
|
||||
<path d="M196 224C242 239 307 201 362 220" stroke="#71717A" stroke-width="1.5" stroke-linecap="round" stroke-dasharray="1 7" opacity="0.42"/>
|
||||
<circle cx="362" cy="220" r="2" fill="#71717A" opacity="0.55"/>
|
||||
<path d="M176 204V227L182 221L187.5 232L192 229.8L186.5 219H194L176 204Z" fill="#71717A" stroke="#F7F7F5" stroke-width="1.5" stroke-linejoin="round"/>
|
||||
|
||||
<g font-family="-apple-system, BlinkMacSystemFont, sans-serif" text-anchor="middle">
|
||||
<text x="270" y="322" font-size="13" font-weight="600" letter-spacing="-0.1" fill="#18181B">Drag T3 Code to Applications</text>
|
||||
<text x="270" y="345" font-size="9.5" fill="#71717A">Open it from Applications when the copy finishes.</text>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 3.7 KiB |
Binary file not shown.
Binary file not shown.
|
Before Width: | Height: | Size: 279 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 313 KiB |
@@ -20,14 +20,14 @@ export const APP_BUNDLE_ID = isDevelopment
|
||||
? `com.t3tools.t3code.dev.${devBundleIdSuffix || "local"}`
|
||||
: "com.t3tools.t3code";
|
||||
const APP_PROTOCOL_SCHEMES = isDevelopment ? ["t3code-dev"] : ["t3code"];
|
||||
const LAUNCHER_VERSION = 14;
|
||||
const defaultIconPath = NodePath.join(desktopDir, "resources", "icon.icns");
|
||||
const LAUNCHER_VERSION = 15;
|
||||
const developmentMacIconPngPath = NodePath.join(
|
||||
repoRoot,
|
||||
"assets",
|
||||
"dev",
|
||||
"blueprint-macos-1024.png",
|
||||
);
|
||||
const productionMacIconPngPath = NodePath.join(repoRoot, "assets", "prod", "black-macos-1024.png");
|
||||
// oxlint-disable-next-line t3code/no-global-process-runtime -- Standalone launcher script has no Effect runtime.
|
||||
const hostPlatform = NodeOS.platform();
|
||||
|
||||
@@ -165,15 +165,22 @@ function registerMacLauncherBundle(appBundlePath) {
|
||||
}
|
||||
}
|
||||
|
||||
function ensureDevelopmentIconIcns(runtimeDir) {
|
||||
const generatedIconPath = NodePath.join(runtimeDir, "icon-dev.icns");
|
||||
export function resolveMacLauncherIconPaths(runtimeDir, development = isDevelopment) {
|
||||
return {
|
||||
sourceIconPath: development ? developmentMacIconPngPath : productionMacIconPngPath,
|
||||
generatedIconPath: NodePath.join(runtimeDir, development ? "icon-dev.icns" : "icon-prod.icns"),
|
||||
};
|
||||
}
|
||||
|
||||
function ensureMacIconIcns(runtimeDir) {
|
||||
const { sourceIconPath, generatedIconPath } = resolveMacLauncherIconPaths(runtimeDir);
|
||||
NodeFS.mkdirSync(runtimeDir, { recursive: true });
|
||||
|
||||
if (!NodeFS.existsSync(developmentMacIconPngPath)) {
|
||||
return defaultIconPath;
|
||||
if (!NodeFS.existsSync(sourceIconPath)) {
|
||||
throw new Error(`Desktop macOS icon source is missing at ${sourceIconPath}`);
|
||||
}
|
||||
|
||||
const sourceMtimeMs = NodeFS.statSync(developmentMacIconPngPath).mtimeMs;
|
||||
const sourceMtimeMs = NodeFS.statSync(sourceIconPath).mtimeMs;
|
||||
if (
|
||||
NodeFS.existsSync(generatedIconPath) &&
|
||||
NodeFS.statSync(generatedIconPath).mtimeMs >= sourceMtimeMs
|
||||
@@ -191,7 +198,7 @@ function ensureDevelopmentIconIcns(runtimeDir) {
|
||||
"-z",
|
||||
String(size),
|
||||
String(size),
|
||||
developmentMacIconPngPath,
|
||||
sourceIconPath,
|
||||
"--out",
|
||||
NodePath.join(iconsetDir, `icon_${size}x${size}.png`),
|
||||
]);
|
||||
@@ -201,7 +208,7 @@ function ensureDevelopmentIconIcns(runtimeDir) {
|
||||
"-z",
|
||||
String(retinaSize),
|
||||
String(retinaSize),
|
||||
developmentMacIconPngPath,
|
||||
sourceIconPath,
|
||||
"--out",
|
||||
NodePath.join(iconsetDir, `icon_${size}x${size}@2x.png`),
|
||||
]);
|
||||
@@ -209,12 +216,6 @@ function ensureDevelopmentIconIcns(runtimeDir) {
|
||||
|
||||
runChecked("iconutil", ["-c", "icns", iconsetDir, "-o", generatedIconPath]);
|
||||
return generatedIconPath;
|
||||
} catch (error) {
|
||||
console.warn(
|
||||
"[desktop-launcher] Failed to generate dev macOS icon, falling back to default icon.",
|
||||
error,
|
||||
);
|
||||
return defaultIconPath;
|
||||
} finally {
|
||||
NodeFS.rmSync(iconsetRoot, { recursive: true, force: true });
|
||||
}
|
||||
@@ -297,7 +298,7 @@ function buildMacLauncher(electronBinaryPath) {
|
||||
const launcherBinaryPath = isDevelopment
|
||||
? developmentPaths.launcherBinaryPath
|
||||
: runtimeElectronBinaryPath;
|
||||
const iconPath = isDevelopment ? ensureDevelopmentIconIcns(runtimeDir) : defaultIconPath;
|
||||
const iconPath = ensureMacIconIcns(runtimeDir);
|
||||
const metadataPath = NodePath.join(runtimeDir, "metadata.json");
|
||||
|
||||
NodeFS.mkdirSync(runtimeDir, { recursive: true });
|
||||
|
||||
@@ -3,6 +3,7 @@ import { assert, describe, it } from "vite-plus/test";
|
||||
import {
|
||||
makeDevelopmentLauncherScript,
|
||||
resolveElectronBinaryPath,
|
||||
resolveMacLauncherIconPaths,
|
||||
resolveMacLauncherPaths,
|
||||
} from "./electron-launcher.mjs";
|
||||
|
||||
@@ -78,4 +79,14 @@ describe("electron development launcher", () => {
|
||||
);
|
||||
assert.notInclude(script, "node_modules/electron");
|
||||
});
|
||||
|
||||
it("derives launcher icons from canonical development and production assets", () => {
|
||||
const development = resolveMacLauncherIconPaths("/runtime", true);
|
||||
const production = resolveMacLauncherIconPaths("/runtime", false);
|
||||
|
||||
assert.match(development.sourceIconPath, /assets\/dev\/blueprint-macos-1024\.png$/);
|
||||
assert.equal(development.generatedIconPath, "/runtime/icon-dev.icns");
|
||||
assert.match(production.sourceIconPath, /assets\/prod\/black-macos-1024\.png$/);
|
||||
assert.equal(production.generatedIconPath, "/runtime/icon-prod.icns");
|
||||
});
|
||||
});
|
||||
@@ -3,6 +3,7 @@ import { assert, describe, it } from "@effect/vitest";
|
||||
import * as Effect from "effect/Effect";
|
||||
import * as FileSystem from "effect/FileSystem";
|
||||
import * as Layer from "effect/Layer";
|
||||
import * as Option from "effect/Option";
|
||||
import * as PlatformError from "effect/PlatformError";
|
||||
|
||||
import * as DesktopAssets from "./DesktopAssets.ts";
|
||||
@@ -22,6 +23,45 @@ const environmentLayer = DesktopEnvironment.layer({
|
||||
}).pipe(Layer.provide(Layer.mergeAll(NodeServices.layer, DesktopConfig.layerTest({}))));
|
||||
|
||||
describe("DesktopAssets", () => {
|
||||
it.effect("uses canonical source-tree icons for unpackaged development", () =>
|
||||
Effect.gen(function* () {
|
||||
const developmentEnvironmentLayer = DesktopEnvironment.layer({
|
||||
dirname: "/repo/apps/desktop/dist-electron",
|
||||
homeDirectory: "/Users/alice",
|
||||
platform: "linux",
|
||||
processArch: "x64",
|
||||
appVersion: "1.2.3",
|
||||
appPath: "/repo",
|
||||
isPackaged: false,
|
||||
resourcesPath: "/repo/apps/desktop/resources",
|
||||
runningUnderArm64Translation: false,
|
||||
}).pipe(
|
||||
Layer.provide(
|
||||
Layer.mergeAll(
|
||||
NodeServices.layer,
|
||||
DesktopConfig.layerTest({ VITE_DEV_SERVER_URL: "http://localhost:5733" }),
|
||||
),
|
||||
),
|
||||
);
|
||||
const fileSystemLayer = FileSystem.layerNoop({
|
||||
exists: (path) => Effect.succeed(String(path).includes("/assets/dev/")),
|
||||
});
|
||||
const assets = yield* DesktopAssets.DesktopAssets.pipe(
|
||||
Effect.provide(
|
||||
DesktopAssets.layer.pipe(
|
||||
Layer.provide(Layer.merge(fileSystemLayer, developmentEnvironmentLayer)),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
const icons = yield* assets.iconPaths;
|
||||
|
||||
assert.match(Option.getOrThrow(icons.ico), /assets\/dev\/blueprint-windows\.ico$/);
|
||||
assert.match(Option.getOrThrow(icons.png), /assets\/dev\/blueprint-universal-1024\.png$/);
|
||||
assert.isTrue(Option.isNone(icons.icns));
|
||||
}),
|
||||
);
|
||||
|
||||
it.effect("preserves the failed asset candidate and filesystem cause", () =>
|
||||
Effect.gen(function* () {
|
||||
const fileName = "custom.bin";
|
||||
|
||||
@@ -61,6 +61,35 @@ const resolveResourcePath = Effect.fn("desktop.assets.resolveResourcePath")(func
|
||||
return Option.none<string>();
|
||||
});
|
||||
|
||||
const sourceTreeIconFileNames = {
|
||||
dev: {
|
||||
ico: "blueprint-windows.ico",
|
||||
macPng: "blueprint-macos-1024.png",
|
||||
universalPng: "blueprint-universal-1024.png",
|
||||
},
|
||||
prod: {
|
||||
ico: "t3-black-windows.ico",
|
||||
macPng: "black-macos-1024.png",
|
||||
universalPng: "black-universal-1024.png",
|
||||
},
|
||||
} as const;
|
||||
|
||||
function resolveSourceTreeIconPath(
|
||||
environment: DesktopEnvironment.DesktopEnvironment["Service"],
|
||||
ext: keyof DesktopIconPaths,
|
||||
): string | undefined {
|
||||
if (environment.isPackaged || ext === "icns") return undefined;
|
||||
const brand = environment.isDevelopment ? "dev" : "prod";
|
||||
const fileNames = sourceTreeIconFileNames[brand];
|
||||
const fileName =
|
||||
ext === "ico"
|
||||
? fileNames.ico
|
||||
: environment.platform === "darwin"
|
||||
? fileNames.macPng
|
||||
: fileNames.universalPng;
|
||||
return environment.path.join(environment.rootDir, "assets", brand, fileName);
|
||||
}
|
||||
|
||||
const resolveIconPath = Effect.fn("desktop.assets.resolveIconPath")(function* (
|
||||
ext: keyof DesktopIconPaths,
|
||||
): Effect.fn.Return<
|
||||
@@ -70,20 +99,20 @@ const resolveIconPath = Effect.fn("desktop.assets.resolveIconPath")(function* (
|
||||
> {
|
||||
const fileSystem = yield* FileSystem.FileSystem;
|
||||
const environment = yield* DesktopEnvironment.DesktopEnvironment;
|
||||
if (environment.isDevelopment && environment.platform === "darwin" && ext === "png") {
|
||||
const developmentDockIconPath = environment.developmentDockIconPath;
|
||||
const developmentDockIconExists = yield* fileSystem.exists(developmentDockIconPath).pipe(
|
||||
const sourceTreeIconPath = resolveSourceTreeIconPath(environment, ext);
|
||||
if (sourceTreeIconPath !== undefined) {
|
||||
const sourceTreeIconExists = yield* fileSystem.exists(sourceTreeIconPath).pipe(
|
||||
Effect.mapError(
|
||||
(cause) =>
|
||||
new DesktopAssetProbeError({
|
||||
fileName: "icon.png",
|
||||
candidatePath: developmentDockIconPath,
|
||||
fileName: `icon.${ext}`,
|
||||
candidatePath: sourceTreeIconPath,
|
||||
cause,
|
||||
}),
|
||||
),
|
||||
);
|
||||
if (developmentDockIconExists) {
|
||||
return Option.some(developmentDockIconPath);
|
||||
if (sourceTreeIconExists) {
|
||||
return Option.some(sourceTreeIconPath);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -82,7 +82,6 @@ export class DesktopEnvironment extends Context.Service<
|
||||
readonly runtimeInfo: DesktopRuntimeInfo;
|
||||
readonly resolvePickFolderDefaultPath: (rawOptions: unknown) => Option.Option<string>;
|
||||
readonly resolveResourcePathCandidates: (fileName: string) => readonly string[];
|
||||
readonly developmentDockIconPath: string;
|
||||
}
|
||||
>()("@t3tools/desktop/app/DesktopEnvironment") {}
|
||||
|
||||
@@ -270,7 +269,6 @@ const make = Effect.fn("desktop.environment.make")(function* (
|
||||
path.join(resourcesPath, "resources", fileName),
|
||||
path.join(resourcesPath, fileName),
|
||||
],
|
||||
developmentDockIconPath: path.join(rootDir, "assets", "dev", "blueprint-macos-1024.png"),
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -78,6 +78,11 @@ authenticated.
|
||||
|
||||
- Default build is unsigned/not notarized for local sharing.
|
||||
- The DMG build uses `assets/prod/black-macos-1024.png` as the production app icon source.
|
||||
- The DMG chrome follows the release channel: neutral for Latest and the Nightly sky artwork for
|
||||
Nightly. Blueprint artwork remains exclusive to Dev builds. Packaging rasterizes the selected
|
||||
SVG into standard and Retina PNGs inside the disposable staging directory.
|
||||
- The Finder window is 540×412 while its background is 540×380; the extra 32px accounts for the
|
||||
title bar included in Finder's window bounds.
|
||||
- Desktop production windows load the bundled UI from the `t3code://app/` root URL (not a
|
||||
`127.0.0.1` document URL, and not an explicit `index.html` path).
|
||||
- Desktop packaging includes `apps/server/dist` (the `t3` backend) and starts it on loopback with an
|
||||
|
||||
@@ -13,6 +13,7 @@ import { ChildProcessSpawner } from "effect/unstable/process";
|
||||
import {
|
||||
BundleNotSelfContainedError,
|
||||
BuildCommandFailedError,
|
||||
DesktopDmgBackgroundSourceMissingError,
|
||||
createStageWorkspaceConfig,
|
||||
createStagePatchedDependencies,
|
||||
createBuildConfig,
|
||||
@@ -45,6 +46,7 @@ import {
|
||||
resolveMockUpdateServerUrl,
|
||||
resolvePackageManagerUserAgent,
|
||||
stageLinuxIconSize,
|
||||
stageDesktopDmgBackground,
|
||||
STAGE_INSTALL_ARGS,
|
||||
ancestorNodeModulesPaths,
|
||||
copyDirectoryPreservingSymlinks,
|
||||
@@ -463,6 +465,17 @@ it.layer(NodeServices.layer)("build-desktop-artifact", (it) => {
|
||||
"**/node_modules/.bin",
|
||||
"**/node_modules/.bin/**",
|
||||
]);
|
||||
assert.deepStrictEqual(mac.dmg, {
|
||||
title: "T3 Code (Alpha) 1.2.3 Installer",
|
||||
background: "dmg/dmg-background-latest.png",
|
||||
window: { width: 540, height: 412 },
|
||||
contents: [
|
||||
{ x: 130, y: 220, type: "file" },
|
||||
{ x: 410, y: 220, type: "link", path: "/Applications" },
|
||||
],
|
||||
iconSize: 80,
|
||||
iconTextSize: 12,
|
||||
});
|
||||
// Linux must register the renderer schemes so the generated .desktop
|
||||
// entry advertises MimeType=x-scheme-handler/t3code; for OAuth deep links.
|
||||
assert.deepStrictEqual((linux.linux as Record<string, unknown>).protocols, [
|
||||
@@ -784,6 +797,77 @@ it.layer(NodeServices.layer)("build-desktop-artifact", (it) => {
|
||||
});
|
||||
});
|
||||
|
||||
it.effect("rasterizes staged DMG backgrounds at standard and Retina sizes", () =>
|
||||
Effect.scoped(
|
||||
Effect.gen(function* () {
|
||||
const fs = yield* FileSystem.FileSystem;
|
||||
const path = yield* Path.Path;
|
||||
const stageResourcesDir = yield* fs.makeTempDirectoryScoped({
|
||||
prefix: "t3code-dmg-background-",
|
||||
});
|
||||
const dmgDir = path.join(stageResourcesDir, "dmg");
|
||||
yield* fs.makeDirectory(dmgDir, { recursive: true });
|
||||
const sourcePath = path.join(dmgDir, "dmg-background-nightly.svg");
|
||||
yield* fs.writeFileString(sourcePath, '<svg xmlns="http://www.w3.org/2000/svg"/>');
|
||||
const commands: Array<{ readonly command: string; readonly args: ReadonlyArray<string> }> =
|
||||
[];
|
||||
|
||||
yield* stageDesktopDmgBackground(stageResourcesDir, "nightly", false).pipe(
|
||||
Effect.provide(iconResizeSpawnerLayer(commands, [0, 0])),
|
||||
);
|
||||
|
||||
assert.deepStrictEqual(
|
||||
commands.map((command) => [command.command, ...command.args]),
|
||||
[
|
||||
[
|
||||
"sips",
|
||||
"-s",
|
||||
"format",
|
||||
"png",
|
||||
"-z",
|
||||
"380",
|
||||
"540",
|
||||
sourcePath,
|
||||
"--out",
|
||||
path.join(dmgDir, "dmg-background-nightly.png"),
|
||||
],
|
||||
[
|
||||
"sips",
|
||||
"-s",
|
||||
"format",
|
||||
"png",
|
||||
"-z",
|
||||
"760",
|
||||
"1080",
|
||||
sourcePath,
|
||||
"--out",
|
||||
path.join(dmgDir, "[email protected]"),
|
||||
],
|
||||
],
|
||||
);
|
||||
}),
|
||||
),
|
||||
);
|
||||
|
||||
it.effect("fails clearly when the selected DMG background source is missing", () =>
|
||||
Effect.scoped(
|
||||
Effect.gen(function* () {
|
||||
const fs = yield* FileSystem.FileSystem;
|
||||
const stageResourcesDir = yield* fs.makeTempDirectoryScoped({
|
||||
prefix: "t3code-dmg-background-missing-",
|
||||
});
|
||||
|
||||
const error = yield* stageDesktopDmgBackground(stageResourcesDir, "latest", false).pipe(
|
||||
Effect.flip,
|
||||
);
|
||||
|
||||
assert.instanceOf(error, DesktopDmgBackgroundSourceMissingError);
|
||||
assert.equal(error.channel, "latest");
|
||||
assert.include(error.sourcePath, "dmg-background-latest.svg");
|
||||
}),
|
||||
),
|
||||
);
|
||||
|
||||
it("derives macOS passkey signing configuration from the Clerk publishable key", () => {
|
||||
const configuration = resolveMacPasskeySigningConfiguration({
|
||||
T3CODE_APPLE_TEAM_ID: "abc1234567",
|
||||
@@ -916,6 +1000,25 @@ it.layer(NodeServices.layer)("build-desktop-artifact", (it) => {
|
||||
}).pipe(Effect.provide(ConfigProvider.layer(ConfigProvider.fromEnv({ env: {} })))),
|
||||
);
|
||||
|
||||
it.effect("uses the nightly DMG background for nightly macOS builds", () =>
|
||||
Effect.gen(function* () {
|
||||
const config = yield* createBuildConfig(
|
||||
"mac",
|
||||
"dmg",
|
||||
"1.2.3-nightly.20260815.1",
|
||||
false,
|
||||
false,
|
||||
undefined,
|
||||
undefined,
|
||||
);
|
||||
|
||||
assert.equal(
|
||||
(config.dmg as Record<string, unknown>).background,
|
||||
"dmg/dmg-background-nightly.png",
|
||||
);
|
||||
}).pipe(Effect.provide(ConfigProvider.layer(ConfigProvider.fromEnv({ env: {} })))),
|
||||
);
|
||||
|
||||
it.effect("keeps executable resource editing enabled for unsigned Windows builds", () =>
|
||||
Effect.gen(function* () {
|
||||
const config = yield* createBuildConfig(
|
||||
|
||||
@@ -318,6 +318,18 @@ export class DesktopIconSourceMissingError extends Schema.TaggedErrorClass<Deskt
|
||||
}
|
||||
}
|
||||
|
||||
export class DesktopDmgBackgroundSourceMissingError extends Schema.TaggedErrorClass<DesktopDmgBackgroundSourceMissingError>()(
|
||||
"DesktopDmgBackgroundSourceMissingError",
|
||||
{
|
||||
channel: Schema.Literals(["latest", "nightly"]),
|
||||
sourcePath: Schema.String,
|
||||
},
|
||||
) {
|
||||
override get message(): string {
|
||||
return `Desktop ${this.channel} DMG background source is missing at ${this.sourcePath}`;
|
||||
}
|
||||
}
|
||||
|
||||
export class BundledClientAssetsMissingError extends Schema.TaggedErrorClass<BundledClientAssetsMissingError>()(
|
||||
"BundledClientAssetsMissingError",
|
||||
{
|
||||
@@ -1770,6 +1782,39 @@ function stageMacIcons(stageResourcesDir: string, sourcePng: string, verbose: bo
|
||||
});
|
||||
}
|
||||
|
||||
export const stageDesktopDmgBackground = Effect.fn("stageDesktopDmgBackground")(function* (
|
||||
stageResourcesDir: string,
|
||||
channel: "latest" | "nightly",
|
||||
verbose: boolean,
|
||||
) {
|
||||
const fs = yield* FileSystem.FileSystem;
|
||||
const path = yield* Path.Path;
|
||||
const sourcePath = path.join(stageResourcesDir, "dmg", `dmg-background-${channel}.svg`);
|
||||
if (!(yield* fs.exists(sourcePath))) {
|
||||
return yield* new DesktopDmgBackgroundSourceMissingError({ channel, sourcePath });
|
||||
}
|
||||
|
||||
for (const output of [
|
||||
{ suffix: "", width: 540, height: 380 },
|
||||
{ suffix: "@2x", width: 1080, height: 760 },
|
||||
] as const) {
|
||||
const targetPath = path.join(
|
||||
stageResourcesDir,
|
||||
"dmg",
|
||||
`dmg-background-${channel}${output.suffix}.png`,
|
||||
);
|
||||
yield* runCommand(
|
||||
ChildProcess.make(
|
||||
{},
|
||||
)`sips -s format png -z ${output.height} ${output.width} ${sourcePath} --out ${targetPath}`,
|
||||
{
|
||||
label: `sips ${channel} DMG background${output.suffix || "@1x"}`,
|
||||
verbose,
|
||||
},
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
function stageLinuxIcons(stageResourcesDir: string, sourcePng: string, verbose: boolean) {
|
||||
return Effect.gen(function* () {
|
||||
const fs = yield* FileSystem.FileSystem;
|
||||
@@ -2039,6 +2084,29 @@ export const createBuildConfig = Effect.fn("createBuildConfig")(function* (
|
||||
};
|
||||
}
|
||||
|
||||
if (platform === "mac" && target === "dmg") {
|
||||
buildConfig.dmg = {
|
||||
// Give the themed installer its own Finder volume name. Finder caches
|
||||
// DMG window backgrounds by volume name, so reusing a generic name can
|
||||
// make a newly built background look unchanged during testing.
|
||||
title: `${resolveDesktopProductName(version)} ${version} Installer`,
|
||||
background: `dmg/dmg-background-${updateChannel}.png`,
|
||||
window: {
|
||||
width: 540,
|
||||
// Finder counts its 32px title bar in the window bounds. The themed
|
||||
// background itself is 380px tall, so add the chrome height here to
|
||||
// keep the full canvas visible.
|
||||
height: 412,
|
||||
},
|
||||
contents: [
|
||||
{ x: 130, y: 220, type: "file" },
|
||||
{ x: 410, y: 220, type: "link", path: "/Applications" },
|
||||
],
|
||||
iconSize: 80,
|
||||
iconTextSize: 12,
|
||||
};
|
||||
}
|
||||
|
||||
if (platform === "linux") {
|
||||
buildConfig.linux = {
|
||||
target: [target],
|
||||
@@ -2738,6 +2806,13 @@ const buildDesktopArtifact = Effect.fn("buildDesktopArtifact")(function* (
|
||||
yield* Effect.log("[desktop-artifact] Staging release app...");
|
||||
yield* fs.copy(distDirs.desktopDist, path.join(stageAppDir, "apps/desktop/dist-electron"));
|
||||
yield* fs.copy(distDirs.desktopResources, stageResourcesDir);
|
||||
if (options.platform === "mac" && options.target === "dmg") {
|
||||
yield* stageDesktopDmgBackground(
|
||||
stageResourcesDir,
|
||||
resolveDesktopUpdateChannel(appVersion),
|
||||
options.verbose,
|
||||
);
|
||||
}
|
||||
// On Windows the server tree ships in the server.asar sidecar instead of
|
||||
// app.asar (see stageWindowsServerSidecar), so the app stage omits it.
|
||||
if (options.platform !== "win") {
|
||||
|
||||
Reference in new issue
Block a user