| ... | ... | @@ -32,6 +32,7 @@ const BuildArch = Schema.Literals(["arm64", "x64", "universal"]); |
| 32 | 32 | const WorkspaceConfig = Schema.Struct({ |
| 33 | 33 | catalog: Schema.optional(Schema.Record(Schema.String, Schema.String)), |
| 34 | 34 | overrides: Schema.optional(Schema.Record(Schema.String, Schema.String)), |
| 35 | patchedDependencies: Schema.optional(Schema.Record(Schema.String, Schema.String)), |
| 35 | 36 | }); |
| 36 | 37 | type WorkspaceConfig = typeof WorkspaceConfig.Type; |
| 37 | 38 | |
| ... | ... | @@ -270,6 +271,15 @@ interface StagePackageJson { |
| 270 | 271 | readonly electron: string; |
| 271 | 272 | }; |
| 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; |
| 273 | 283 | } |
| 274 | 284 | |
| 275 | 285 | const AzureTrustedSigningOptionsConfig = Config.all({ |
| ... | ... | @@ -757,6 +767,7 @@ const buildDesktopArtifact = Effect.fn("buildDesktopArtifact")(function* ( |
| 757 | 767 | const workspaceConfig = yield* readWorkspaceConfig(); |
| 758 | 768 | const workspaceCatalog = workspaceConfig.catalog ?? {}; |
| 759 | 769 | const workspaceOverrides = workspaceConfig.overrides ?? {}; |
| 770 | const workspacePatchedDependencies = workspaceConfig.patchedDependencies ?? {}; |
| 760 | 771 | |
| 761 | 772 | const platformConfig = PLATFORM_CONFIG[options.platform]; |
| 762 | 773 | if (!platformConfig) { |
| ... | ... | @@ -867,6 +878,7 @@ const buildDesktopArtifact = Effect.fn("buildDesktopArtifact")(function* ( |
| 867 | 878 | // electron-builder is filtering out stageResourcesDir directory in the AppImage for production |
| 868 | 879 | yield* fs.copy(stageResourcesDir, path.join(stageAppDir, "apps/desktop/prod-resources")); |
| 869 | 880 | |
| 881 | const stagePnpmConfig = createStagePnpmConfig(workspacePatchedDependencies); |
| 870 | 882 | const stagePackageJson: StagePackageJson = { |
| 871 | 883 | name: "t3code", |
| 872 | 884 | version: appVersion, |
| ... | ... | @@ -893,11 +905,16 @@ const buildDesktopArtifact = Effect.fn("buildDesktopArtifact")(function* ( |
| 893 | 905 | electron: electronVersion, |
| 894 | 906 | }, |
| 895 | 907 | overrides: resolvedOverrides, |
| 908 | ...(stagePnpmConfig ? { pnpm: stagePnpmConfig } : {}), |
| 896 | 909 | }; |
| 897 | 910 | |
| 898 | 911 | const stagePackageJsonString = yield* encodeJsonString(stagePackageJson); |
| 899 | 912 | yield* fs.writeFileString(path.join(stageAppDir, "package.json"), `${stagePackageJsonString}\n`); |
| 900 | 913 | |
| 914 | if (Object.keys(workspacePatchedDependencies).length > 0) { |
| 915 | yield* fs.copy(path.join(repoRoot, "patches"), path.join(stageAppDir, "patches")); |
| 916 | } |
| 917 | |
| 901 | 918 | yield* Effect.log("[desktop-artifact] Installing staged production dependencies..."); |
| 902 | 919 | yield* runCommand( |
| 903 | 920 | ChildProcess.make({ |