Migrate CI and web tests to vite-plus

- switch workspace checks and tests to `vp`
- fold Vitest browser config into `vite.config.ts`
- add `electron-builder` for desktop packaging
This commit is contained in:
Julius Marminge committed 2026-03-31 15:52:01 -07:00
1 parent 5abe2845ca
commit e3404d1710
9 files changed
+540 -77

No files matched your search

+10 -6
View File
@@ -9,7 +9,7 @@ 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 { getWorkspaceCatalog, resolveCatalogDependencies } from "./lib/resolve-catalog.ts";
import { resolveCatalogDependencies } from "./lib/resolve-catalog.ts";
import * as NodeRuntime from "@effect/platform-node/NodeRuntime";
import * as NodeServices from "@effect/platform-node/NodeServices";
@@ -39,7 +39,6 @@ const ProductionWindowsIconSource = Effect.zipWith(
(repoRoot, path) => path.join(repoRoot, BRAND_ASSET_PATHS.productionWindowsIconIco),
);
const encodeJsonString = Schema.encodeEffect(Schema.UnknownFromJsonString);
const workspaceCatalog = getWorkspaceCatalog(rootPackageJson);
interface PlatformConfig {
readonly cliFlag: "--mac" | "--linux" | "--win";
@@ -182,6 +181,7 @@ interface StagePackageJson {
readonly dependencies: Record<string, unknown>;
readonly devDependencies: {
readonly electron: string;
readonly "electron-builder": string;
};
}
@@ -557,6 +557,7 @@ const buildDesktopArtifact = Effect.fn("buildDesktopArtifact")(function* (
}
const electronVersion = desktopPackageJson.dependencies.electron;
const electronBuilderVersion = desktopPackageJson.devDependencies["electron-builder"];
const serverDependencies = serverPackageJson.dependencies;
if (!serverDependencies || Object.keys(serverDependencies).length === 0) {
@@ -566,7 +567,8 @@ const buildDesktopArtifact = Effect.fn("buildDesktopArtifact")(function* (
}
const resolvedServerDependencies = yield* Effect.try({
try: () => resolveCatalogDependencies(serverDependencies, workspaceCatalog, "apps/server"),
try: () =>
resolveCatalogDependencies(serverDependencies, rootPackageJson.catalog, "apps/server"),
catch: (cause) =>
new BuildScriptError({
message: "Could not resolve production dependencies from apps/server/package.json.",
@@ -574,7 +576,8 @@ const buildDesktopArtifact = Effect.fn("buildDesktopArtifact")(function* (
}),
});
const resolvedDesktopRuntimeDependencies = yield* Effect.try({
try: () => resolveDesktopRuntimeDependencies(desktopPackageJson.dependencies, workspaceCatalog),
try: () =>
resolveDesktopRuntimeDependencies(desktopPackageJson.dependencies, rootPackageJson.catalog),
catch: (cause) =>
new BuildScriptError({
message: "Could not resolve desktop runtime dependencies from apps/desktop/package.json.",
@@ -662,20 +665,21 @@ const buildDesktopArtifact = Effect.fn("buildDesktopArtifact")(function* (
},
devDependencies: {
electron: electronVersion,
"electron-builder": electronBuilderVersion,
},
};
const stagePackageJsonString = yield* encodeJsonString(stagePackageJson);
yield* fs.writeFileString(path.join(stageAppDir, "package.json"), `${stagePackageJsonString}\n`);
yield* Effect.log("[desktop-artifact] Installing staged production dependencies...");
yield* Effect.log("[desktop-artifact] Installing staged build dependencies...");
yield* runCommand(
ChildProcess.make({
cwd: stageAppDir,
...commandOutputOptions(options.verbose),
// Windows needs shell mode to resolve .cmd shims (e.g. bun.cmd).
shell: process.platform === "win32",
})`bun install --production`,
})`vp install`,
);
const buildEnv: NodeJS.ProcessEnv = {
-22
View File
@@ -1,25 +1,3 @@
/**
* Resolve `catalog:` dependency specs using the workspace catalog.
*
* Pure function: returns a new record with every `catalog:…` value replaced by
* the concrete version string found in `catalog`. Throws on missing entries.
*/
export function getWorkspaceCatalog(rootPackageJson: {
readonly catalog?: Record<string, unknown>;
readonly workspaces?:
| {
readonly catalog?: Record<string, unknown>;
}
| ReadonlyArray<string>;
}): Record<string, unknown> {
const workspaceCatalog =
rootPackageJson.workspaces && !Array.isArray(rootPackageJson.workspaces)
? (rootPackageJson.workspaces as { readonly catalog?: Record<string, unknown> }).catalog
: undefined;
return rootPackageJson.catalog ?? workspaceCatalog ?? {};
}
export function resolveCatalogDependencies(
dependencies: Record<string, unknown>,
catalog: Record<string, unknown>,