authorgravatar for julius0216@outlook.comJulius Marminge <julius0216@outlook.com> 2026-03-02 20:59:56-08:00
committergravatar for julius0216@outlook.comJulius Marminge <julius0216@outlook.com> 2026-03-02 20:59:56-08:00
loga1c7b98f98b69242b50e9df2916d1d8161e9af48
tree19cc3fff3534487a252a3dafedb82db4aa793cb4
parent99ea16a9696e95065c8b556f78468a07712d97d3

fix build script


1 files changed, 12 insertions(+), 12 deletions(-)

scripts/build-desktop-artifact.ts+12-12
...@@ -10,7 +10,7 @@ import * as NodeRuntime from "@effect/platform-node/NodeRuntime";...@@ -10,7 +10,7 @@ import * as NodeRuntime from "@effect/platform-node/NodeRuntime";
10import * as NodeServices from "@effect/platform-node/NodeServices";10import * as NodeServices from "@effect/platform-node/NodeServices";
11import { Config, Data, Effect, FileSystem, Logger, Option, Path, Schema } from "effect";11import { Config, Data, Effect, FileSystem, Logger, Option, Path, Schema } from "effect";
12import { Command, Flag } from "effect/unstable/cli";12import { Command, Flag } from "effect/unstable/cli";
13import { ChildProcess } from "effect/unstable/process";13import { ChildProcess, ChildProcessSpawner } from "effect/unstable/process";
1414
15const BuildPlatform = Schema.Literals(["mac", "linux", "win"]);15const BuildPlatform = Schema.Literals(["mac", "linux", "win"]);
16const BuildArch = Schema.Literals(["arm64", "x64", "universal"]);16const BuildArch = Schema.Literals(["arm64", "x64", "universal"]);
...@@ -134,14 +134,12 @@ const AzureTrustedSigningOptionsConfig = Config.all({...@@ -134,14 +134,12 @@ const AzureTrustedSigningOptionsConfig = Config.all({
134 endpoint: Config.string("AZURE_TRUSTED_SIGNING_ENDPOINT"),134 endpoint: Config.string("AZURE_TRUSTED_SIGNING_ENDPOINT"),
135 certificateProfileName: Config.string("AZURE_TRUSTED_SIGNING_CERTIFICATE_PROFILE_NAME"),135 certificateProfileName: Config.string("AZURE_TRUSTED_SIGNING_CERTIFICATE_PROFILE_NAME"),
136 codeSigningAccountName: Config.string("AZURE_TRUSTED_SIGNING_ACCOUNT_NAME"),136 codeSigningAccountName: Config.string("AZURE_TRUSTED_SIGNING_ACCOUNT_NAME"),
137 fileDigest: Config.string("AZURE_TRUSTED_SIGNING_FILE_DIGEST").pipe(137 fileDigest: Config.string("AZURE_TRUSTED_SIGNING_FILE_DIGEST").pipe(Config.withDefault("SHA256")),
138 Config.withDefault(() => "SHA256"),
139 ),
140 timestampDigest: Config.string("AZURE_TRUSTED_SIGNING_TIMESTAMP_DIGEST").pipe(138 timestampDigest: Config.string("AZURE_TRUSTED_SIGNING_TIMESTAMP_DIGEST").pipe(
141 Config.withDefault(() => "SHA256"),139 Config.withDefault("SHA256"),
142 ),140 ),
143 timestampRfc3161: Config.string("AZURE_TRUSTED_SIGNING_TIMESTAMP_RFC3161").pipe(141 timestampRfc3161: Config.string("AZURE_TRUSTED_SIGNING_TIMESTAMP_RFC3161").pipe(
144 Config.withDefault(() => "http://timestamp.acs.microsoft.com"),142 Config.withDefault("http://timestamp.acs.microsoft.com"),
145 ),143 ),
146});144});
147145
...@@ -151,10 +149,10 @@ const BuildEnvConfig = Config.all({...@@ -151,10 +149,10 @@ const BuildEnvConfig = Config.all({
151 arch: Config.schema(BuildArch, "T3CODE_DESKTOP_ARCH").pipe(Config.option),149 arch: Config.schema(BuildArch, "T3CODE_DESKTOP_ARCH").pipe(Config.option),
152 version: Config.string("T3CODE_DESKTOP_VERSION").pipe(Config.option),150 version: Config.string("T3CODE_DESKTOP_VERSION").pipe(Config.option),
153 outputDir: Config.string("T3CODE_DESKTOP_OUTPUT_DIR").pipe(Config.option),151 outputDir: Config.string("T3CODE_DESKTOP_OUTPUT_DIR").pipe(Config.option),
154 skipBuild: Config.boolean("T3CODE_DESKTOP_SKIP_BUILD").pipe(Config.withDefault(() => false)),152 skipBuild: Config.boolean("T3CODE_DESKTOP_SKIP_BUILD").pipe(Config.withDefault(false)),
155 keepStage: Config.boolean("T3CODE_DESKTOP_KEEP_STAGE").pipe(Config.withDefault(() => false)),153 keepStage: Config.boolean("T3CODE_DESKTOP_KEEP_STAGE").pipe(Config.withDefault(false)),
156 signed: Config.boolean("T3CODE_DESKTOP_SIGNED").pipe(Config.withDefault(() => false)),154 signed: Config.boolean("T3CODE_DESKTOP_SIGNED").pipe(Config.withDefault(false)),
157 verbose: Config.boolean("T3CODE_DESKTOP_VERBOSE").pipe(Config.withDefault(() => false)),155 verbose: Config.boolean("T3CODE_DESKTOP_VERBOSE").pipe(Config.withDefault(false)),
158});156});
159157
160const resolveBooleanFlag = (flag: Option.Option<boolean>, envValue: boolean) =>158const resolveBooleanFlag = (flag: Option.Option<boolean>, envValue: boolean) =>
...@@ -209,11 +207,13 @@ const commandOutputOptions = (verbose: boolean) =>...@@ -209,11 +207,13 @@ const commandOutputOptions = (verbose: boolean) =>
209 }) as const;207 }) as const;
210208
211const runCommand = Effect.fn(function* (command: ChildProcess.Command) {209const runCommand = Effect.fn(function* (command: ChildProcess.Command) {
212 const exitCode = yield* ChildProcess.exitCode(command);210 const commandSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
211 const child = yield* commandSpawner.spawn(command);
212 const exitCode = yield* child.exitCode;
213213
214 if (exitCode !== 0) {214 if (exitCode !== 0) {
215 return yield* new BuildScriptError({215 return yield* new BuildScriptError({
216 message: "Command exited with non-zero exit code",216 message: `Command exited with non-zero exit code (${exitCode})`,
217 });217 });
218 }218 }
219});219});