Stage production icons for desktop builds and publish (#168)

* Stage production icons for desktop builds and publish

- add shared brand asset paths and a Windows .ico asset
- stage Linux/Windows icons in desktop artifact builds
- override and restore publish favicon during server CLI publish

* 'blip'

* Fix PR review issues for publish icon staging

* Refactor brand assets and harden Windows desktop build setup

* Apply remaining server orchestration updates

* Fix production mac icon asset

Co-authored-by: Theo Browne <[email protected]>

---------

Co-authored-by: Cursor Agent <[email protected]>
Co-authored-by: Theo Browne <[email protected]>
This commit is contained in:
authored and GitHub committed 2026-03-06 13:54:31 -08:00
1 parent 40fcb6bdf8
commit d249e628ee
42 files changed
+263 -86

No files matched your search

+93 -18
View File
@@ -1,11 +1,14 @@
#!/usr/bin/env node
import { spawnSync } from "node:child_process";
import { existsSync } from "node:fs";
import { join } from "node:path";
import rootPackageJson from "../package.json" with { type: "json" };
import desktopPackageJson from "../apps/desktop/package.json" with { type: "json" };
import serverPackageJson from "../apps/server/package.json" with { type: "json" };
import { BRAND_ASSET_PATHS } from "./lib/brand-assets.ts";
import { resolveCatalogDependencies } from "./lib/resolve-catalog.ts";
import * as NodeRuntime from "@effect/platform-node/NodeRuntime";
@@ -20,8 +23,18 @@ const BuildArch = Schema.Literals(["arm64", "x64", "universal"]);
const RepoRoot = Effect.service(Path.Path).pipe(
Effect.flatMap((path) => path.fromFileUrl(new URL("..", import.meta.url))),
);
const IconSource = Effect.zipWith(RepoRoot, Effect.service(Path.Path), (repoRoot, path) =>
path.join(repoRoot, "assets/macos-icon-1024.png"),
const ProductionMacIconSource = Effect.zipWith(RepoRoot, Effect.service(Path.Path), (repoRoot, path) =>
path.join(repoRoot, BRAND_ASSET_PATHS.productionMacIconPng),
);
const ProductionLinuxIconSource = Effect.zipWith(
RepoRoot,
Effect.service(Path.Path),
(repoRoot, path) => path.join(repoRoot, BRAND_ASSET_PATHS.productionLinuxIconPng),
);
const ProductionWindowsIconSource = Effect.zipWith(
RepoRoot,
Effect.service(Path.Path),
(repoRoot, path) => path.join(repoRoot, BRAND_ASSET_PATHS.productionWindowsIconIco),
);
const encodeJsonString = Schema.encodeEffect(Schema.UnknownFromJsonString);
@@ -104,6 +117,39 @@ function resolveGitCommitHash(repoRoot: string): string {
return hash.toLowerCase();
}
function resolvePythonForNodeGyp(): string | undefined {
const configured = process.env.npm_config_python ?? process.env.PYTHON;
if (configured && existsSync(configured)) {
return configured;
}
if (process.platform === "win32") {
const localAppData = process.env.LOCALAPPDATA;
if (localAppData) {
for (const version of ["Python313", "Python312", "Python311", "Python310"]) {
const candidate = join(localAppData, "Programs", "Python", version, "python.exe");
if (existsSync(candidate)) {
return candidate;
}
}
}
}
const probe = spawnSync("python", ["-c", "import sys;print(sys.executable)"], {
encoding: "utf8",
});
if (probe.status !== 0) {
return undefined;
}
const executable = probe.stdout.trim();
if (!executable || !existsSync(executable)) {
return undefined;
}
return executable;
}
interface ResolvedBuildOptions {
readonly platform: typeof BuildPlatform.Type;
readonly target: string;
@@ -261,7 +307,7 @@ function stageMacIcons(stageResourcesDir: string, verbose: boolean) {
return Effect.gen(function* () {
const fs = yield* FileSystem.FileSystem;
const path = yield* Path.Path;
const iconSource = yield* IconSource;
const iconSource = yield* ProductionMacIconSource;
if (!(yield* fs.exists(iconSource))) {
return yield* new BuildScriptError({
message: `Production icon source is missing at ${iconSource}`,
@@ -285,6 +331,38 @@ function stageMacIcons(stageResourcesDir: string, verbose: boolean) {
});
}
function stageLinuxIcons(stageResourcesDir: string) {
return Effect.gen(function* () {
const fs = yield* FileSystem.FileSystem;
const path = yield* Path.Path;
const iconSource = yield* ProductionLinuxIconSource;
if (!(yield* fs.exists(iconSource))) {
return yield* new BuildScriptError({
message: `Production icon source is missing at ${iconSource}`,
});
}
const iconPath = path.join(stageResourcesDir, "icon.png");
yield* fs.copyFile(iconSource, iconPath);
});
}
function stageWindowsIcons(stageResourcesDir: string) {
return Effect.gen(function* () {
const fs = yield* FileSystem.FileSystem;
const path = yield* Path.Path;
const iconSource = yield* ProductionWindowsIconSource;
if (!(yield* fs.exists(iconSource))) {
return yield* new BuildScriptError({
message: `Production Windows icon source is missing at ${iconSource}`,
});
}
const iconPath = path.join(stageResourcesDir, "icon.ico");
yield* fs.copyFile(iconSource, iconPath);
});
}
function validateBundledClientAssets(clientDir: string) {
return Effect.gen(function* () {
const fs = yield* FileSystem.FileSystem;
@@ -416,31 +494,18 @@ const assertPlatformBuildResources = Effect.fn("assertPlatformBuildResources")(f
stageResourcesDir: string,
verbose: boolean,
) {
const fs = yield* FileSystem.FileSystem;
const path = yield* Path.Path;
if (platform === "mac") {
yield* stageMacIcons(stageResourcesDir, verbose);
return;
}
if (platform === "linux") {
const iconPath = path.join(stageResourcesDir, "icon.png");
if (!(yield* fs.exists(iconPath))) {
return yield* new BuildScriptError({
message: `Missing Linux icon at ${iconPath}`,
});
}
yield* stageLinuxIcons(stageResourcesDir);
return;
}
if (platform === "win") {
const iconPath = path.join(stageResourcesDir, "icon.ico");
if (!(yield* fs.exists(iconPath))) {
return yield* new BuildScriptError({
message: `Missing Windows icon at ${iconPath}`,
});
}
yield* stageWindowsIcons(stageResourcesDir);
}
});
@@ -597,6 +662,16 @@ const buildDesktopArtifact = Effect.fn("buildDesktopArtifact")(function* (
delete buildEnv.APPLE_API_ISSUER;
}
if (process.platform === "win32") {
const python = resolvePythonForNodeGyp();
if (python) {
buildEnv.PYTHON = python;
buildEnv.npm_config_python = python;
}
buildEnv.npm_config_msvs_version = buildEnv.npm_config_msvs_version ?? "2022";
buildEnv.GYP_MSVS_VERSION = buildEnv.GYP_MSVS_VERSION ?? "2022";
}
yield* Effect.log(
`[desktop-artifact] Building ${options.platform}/${options.target} (arch=${options.arch}, version=${appVersion})...`,
);
+57
View File
@@ -0,0 +1,57 @@
export const BRAND_ASSET_PATHS = {
productionMacIconPng: "assets/prod/black-macos-1024.png",
productionLinuxIconPng: "assets/prod/black-universal-1024.png",
productionWindowsIconIco: "assets/prod/t3-black-windows.ico",
productionWebFaviconIco: "assets/prod/t3-black-web-favicon.ico",
productionWebFavicon16Png: "assets/prod/t3-black-web-favicon-16x16.png",
productionWebFavicon32Png: "assets/prod/t3-black-web-favicon-32x32.png",
productionWebAppleTouchIconPng: "assets/prod/t3-black-web-apple-touch-180.png",
developmentWindowsIconIco: "assets/dev/blueprint-windows.ico",
developmentWebFaviconIco: "assets/dev/blueprint-web-favicon.ico",
developmentWebFavicon16Png: "assets/dev/blueprint-web-favicon-16x16.png",
developmentWebFavicon32Png: "assets/dev/blueprint-web-favicon-32x32.png",
developmentWebAppleTouchIconPng: "assets/dev/blueprint-web-apple-touch-180.png",
} as const;
export interface IconOverride {
readonly sourceRelativePath: string;
readonly targetRelativePath: string;
}
export const DEVELOPMENT_ICON_OVERRIDES: ReadonlyArray<IconOverride> = [
{
sourceRelativePath: BRAND_ASSET_PATHS.developmentWebFaviconIco,
targetRelativePath: "dist/client/favicon.ico",
},
{
sourceRelativePath: BRAND_ASSET_PATHS.developmentWebFavicon16Png,
targetRelativePath: "dist/client/favicon-16x16.png",
},
{
sourceRelativePath: BRAND_ASSET_PATHS.developmentWebFavicon32Png,
targetRelativePath: "dist/client/favicon-32x32.png",
},
{
sourceRelativePath: BRAND_ASSET_PATHS.developmentWebAppleTouchIconPng,
targetRelativePath: "dist/client/apple-touch-icon.png",
},
];
export const PUBLISH_ICON_OVERRIDES: ReadonlyArray<IconOverride> = [
{
sourceRelativePath: BRAND_ASSET_PATHS.productionWebFaviconIco,
targetRelativePath: "dist/client/favicon.ico",
},
{
sourceRelativePath: BRAND_ASSET_PATHS.productionWebFavicon16Png,
targetRelativePath: "dist/client/favicon-16x16.png",
},
{
sourceRelativePath: BRAND_ASSET_PATHS.productionWebFavicon32Png,
targetRelativePath: "dist/client/favicon-32x32.png",
},
{
sourceRelativePath: BRAND_ASSET_PATHS.productionWebAppleTouchIconPng,
targetRelativePath: "dist/client/apple-touch-icon.png",
},
];