@devries-cameron20 / t3code Mirror · read-only / commits / 203f58e456
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 25, 05:00 UTC

[codex] Fix desktop packaging patched dependencies (#2944)

Co-authored-by: codex <codex@users.noreply.github.com>

Julius Marminge committed Jun 3, 2026 at 23:34 UTC 203f58e45681c14e3f42104d8773c8293ed8c3a1
2 files changed +33
scripts/build-desktop-artifact.test.ts
+16
@@ -5,6 +5,7 @@ import * as Effect from "effect/Effect";
5 import * as Option from "effect/Option";
6
7 import {
8 + createStagePnpmConfig,
9 resolveDesktopRuntimeDependencies,
10 resolveBuildOptions,
11 resolveDesktopBuildIconAssets,
@@ -64,6 +65,21 @@ it.layer(NodeServices.layer)("build-desktop-artifact", (it) => {
65 );
66 });
67
68 + it("carries workspace patch metadata into staged desktop installs", () => {
69 + assert.deepStrictEqual(
70 + createStagePnpmConfig({
71 + "@pierre/diffs@1.1.20": "patches/@pierre%2Fdiffs@1.1.20.patch",
72 + }),
73 + {
74 + patchedDependencies: {
75 + "@pierre/diffs@1.1.20": "patches/@pierre%2Fdiffs@1.1.20.patch",
76 + },
77 + },
78 + );
79 +
80 + assert.equal(createStagePnpmConfig({}), undefined);
81 + });
82 +
83 it("falls back to the default mock update port when the configured port is blank", () => {
84 assert.equal(resolveMockUpdateServerUrl(undefined), "http://localhost:3000");
85 assert.equal(resolveMockUpdateServerUrl(4123), "http://localhost:4123");
scripts/build-desktop-artifact.ts
+17
@@ -32,6 +32,7 @@ const BuildArch = Schema.Literals(["arm64", "x64", "universal"]);
32 const WorkspaceConfig = Schema.Struct({
33 catalog: Schema.optional(Schema.Record(Schema.String, Schema.String)),
34 overrides: Schema.optional(Schema.Record(Schema.String, Schema.String)),
35 + patchedDependencies: Schema.optional(Schema.Record(Schema.String, Schema.String)),
36 });
37 type WorkspaceConfig = typeof WorkspaceConfig.Type;
38
@@ -270,6 +271,15 @@ interface StagePackageJson {
271 readonly electron: string;
272 };
273 readonly overrides: Record<string, unknown>;
274 + readonly pnpm?: {
275 + readonly patchedDependencies?: Record<string, string>;
276 + };
277 +}
278 +
279 +export function createStagePnpmConfig(
280 + patchedDependencies: Record<string, string>,
281 +): StagePackageJson["pnpm"] | undefined {
282 + return Object.keys(patchedDependencies).length > 0 ? { patchedDependencies } : undefined;
283 }
284
285 const AzureTrustedSigningOptionsConfig = Config.all({
@@ -757,6 +767,7 @@ const buildDesktopArtifact = Effect.fn("buildDesktopArtifact")(function* (
767 const workspaceConfig = yield* readWorkspaceConfig();
768 const workspaceCatalog = workspaceConfig.catalog ?? {};
769 const workspaceOverrides = workspaceConfig.overrides ?? {};
770 + const workspacePatchedDependencies = workspaceConfig.patchedDependencies ?? {};
771
772 const platformConfig = PLATFORM_CONFIG[options.platform];
773 if (!platformConfig) {
@@ -867,6 +878,7 @@ const buildDesktopArtifact = Effect.fn("buildDesktopArtifact")(function* (
878 // electron-builder is filtering out stageResourcesDir directory in the AppImage for production
879 yield* fs.copy(stageResourcesDir, path.join(stageAppDir, "apps/desktop/prod-resources"));
880
881 + const stagePnpmConfig = createStagePnpmConfig(workspacePatchedDependencies);
882 const stagePackageJson: StagePackageJson = {
883 name: "t3code",
884 version: appVersion,
@@ -893,11 +905,16 @@ const buildDesktopArtifact = Effect.fn("buildDesktopArtifact")(function* (
905 electron: electronVersion,
906 },
907 overrides: resolvedOverrides,
908 + ...(stagePnpmConfig ? { pnpm: stagePnpmConfig } : {}),
909 };
910
911 const stagePackageJsonString = yield* encodeJsonString(stagePackageJson);
912 yield* fs.writeFileString(path.join(stageAppDir, "package.json"), `${stagePackageJsonString}\n`);
913
914 + if (Object.keys(workspacePatchedDependencies).length > 0) {
915 + yield* fs.copy(path.join(repoRoot, "patches"), path.join(stageAppDir, "patches"));
916 + }
917 +
918 yield* Effect.log("[desktop-artifact] Installing staged production dependencies...");
919 yield* runCommand(
920 ChildProcess.make({