Open-source Grok Bot alternative for named AI teammates. Local-first desktop, web, and mobile clients with per-bot tools, instructions, and memory. Independent fork of T3 Code.
[codex] Filter staged desktop patched dependencies (#2945)
Julius Marmingea6edad197428
diff --git a/scripts/build-desktop-artifact.test.ts b/scripts/build-desktop-artifact.test.tsindex 345217a54..8dc23484a 100644--- a/scripts/build-desktop-artifact.test.ts+++ b/scripts/build-desktop-artifact.test.ts@@ -65,19 +65,37 @@ it.layer(NodeServices.layer)("build-desktop-artifact", (it) => {);});- it("carries workspace patch metadata into staged desktop installs", () => {+ it("carries only staged dependency patch metadata into staged desktop installs", () => {assert.deepStrictEqual(- createStagePnpmConfig({- "@pierre/[email protected]": "patches/@pierre%[email protected]",- }),+ createStagePnpmConfig(+ {+ "@expo/[email protected]": "patches/@expo%[email protected]",+ "@pierre/[email protected]": "patches/@pierre%[email protected]",+ "[email protected]": "patches/[email protected]",+ "[email protected]": "patches/[email protected]",+ },+ {+ "@pierre/diffs": "1.1.20",+ effect: "4.0.0-beta.73",+ },+ ),{patchedDependencies: {"@pierre/[email protected]": "patches/@pierre%[email protected]",+ "[email protected]": "patches/[email protected]",},},);- assert.equal(createStagePnpmConfig({}), undefined);+ assert.equal(+ createStagePnpmConfig(+ {+ "@expo/[email protected]": "patches/@expo%[email protected]",+ },+ { effect: "4.0.0-beta.73" },+ ),+ undefined,+ );});it("falls back to the default mock update port when the configured port is blank", () => {diff --git a/scripts/build-desktop-artifact.ts b/scripts/build-desktop-artifact.tsindex 53f7da8e6..f86c94e5d 100644--- a/scripts/build-desktop-artifact.ts+++ b/scripts/build-desktop-artifact.ts@@ -278,8 +278,22 @@ interface StagePackageJson {export function createStagePnpmConfig(patchedDependencies: Record<string, string>,+ dependencies: Record<string, unknown>,): StagePackageJson["pnpm"] | undefined {- return Object.keys(patchedDependencies).length > 0 ? { patchedDependencies } : undefined;+ const stagePatchedDependencies = Object.fromEntries(+ Object.entries(patchedDependencies).filter(([patchKey]) =>+ Object.hasOwn(dependencies, getPatchedDependencyPackageName(patchKey)),+ ),+ );++ return Object.keys(stagePatchedDependencies).length > 0+ ? { patchedDependencies: stagePatchedDependencies }+ : undefined;+}++function getPatchedDependencyPackageName(patchKey: string): string {+ const versionSeparator = patchKey.lastIndexOf("@");+ return versionSeparator > 0 ? patchKey.slice(0, versionSeparator) : patchKey;}const AzureTrustedSigningOptionsConfig = Config.all({@@ -878,7 +892,11 @@ const buildDesktopArtifact = Effect.fn("buildDesktopArtifact")(function* (// electron-builder is filtering out stageResourcesDir directory in the AppImage for productionyield* fs.copy(stageResourcesDir, path.join(stageAppDir, "apps/desktop/prod-resources"));- const stagePnpmConfig = createStagePnpmConfig(workspacePatchedDependencies);+ const stageDependencies = {+ ...resolvedServerDependencies,+ ...resolvedDesktopRuntimeDependencies,+ };+ const stagePnpmConfig = createStagePnpmConfig(workspacePatchedDependencies, stageDependencies);const stagePackageJson: StagePackageJson = {name: "t3code",version: appVersion,@@ -897,10 +915,7 @@ const buildDesktopArtifact = Effect.fn("buildDesktopArtifact")(function* (options.mockUpdates,options.mockUpdateServerPort,),- dependencies: {- ...resolvedServerDependencies,- ...resolvedDesktopRuntimeDependencies,- },+ dependencies: stageDependencies,devDependencies: {electron: electronVersion,},