| ... | ... | @@ -10,7 +10,7 @@ import * as NodeRuntime from "@effect/platform-node/NodeRuntime"; |
| 10 | 10 | import * as NodeServices from "@effect/platform-node/NodeServices"; |
| 11 | 11 | import { Config, Data, Effect, FileSystem, Logger, Option, Path, Schema } from "effect"; |
| 12 | 12 | import { Command, Flag } from "effect/unstable/cli"; |
| 13 | | import { ChildProcess } from "effect/unstable/process"; |
| 13 | import { ChildProcess, ChildProcessSpawner } from "effect/unstable/process"; |
| 14 | 14 | |
| 15 | 15 | const BuildPlatform = Schema.Literals(["mac", "linux", "win"]); |
| 16 | 16 | const BuildArch = Schema.Literals(["arm64", "x64", "universal"]); |
| ... | ... | @@ -134,14 +134,12 @@ const AzureTrustedSigningOptionsConfig = Config.all({ |
| 134 | 134 | endpoint: Config.string("AZURE_TRUSTED_SIGNING_ENDPOINT"), |
| 135 | 135 | certificateProfileName: Config.string("AZURE_TRUSTED_SIGNING_CERTIFICATE_PROFILE_NAME"), |
| 136 | 136 | codeSigningAccountName: Config.string("AZURE_TRUSTED_SIGNING_ACCOUNT_NAME"), |
| 137 | | fileDigest: Config.string("AZURE_TRUSTED_SIGNING_FILE_DIGEST").pipe( |
| 138 | | Config.withDefault(() => "SHA256"), |
| 139 | | ), |
| 137 | fileDigest: Config.string("AZURE_TRUSTED_SIGNING_FILE_DIGEST").pipe(Config.withDefault("SHA256")), |
| 140 | 138 | timestampDigest: Config.string("AZURE_TRUSTED_SIGNING_TIMESTAMP_DIGEST").pipe( |
| 141 | | Config.withDefault(() => "SHA256"), |
| 139 | Config.withDefault("SHA256"), |
| 142 | 140 | ), |
| 143 | 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 | }); |
| 147 | 145 | |
| ... | ... | @@ -151,10 +149,10 @@ const BuildEnvConfig = Config.all({ |
| 151 | 149 | arch: Config.schema(BuildArch, "T3CODE_DESKTOP_ARCH").pipe(Config.option), |
| 152 | 150 | version: Config.string("T3CODE_DESKTOP_VERSION").pipe(Config.option), |
| 153 | 151 | outputDir: Config.string("T3CODE_DESKTOP_OUTPUT_DIR").pipe(Config.option), |
| 154 | | skipBuild: Config.boolean("T3CODE_DESKTOP_SKIP_BUILD").pipe(Config.withDefault(() => false)), |
| 155 | | keepStage: Config.boolean("T3CODE_DESKTOP_KEEP_STAGE").pipe(Config.withDefault(() => false)), |
| 156 | | signed: Config.boolean("T3CODE_DESKTOP_SIGNED").pipe(Config.withDefault(() => false)), |
| 157 | | verbose: Config.boolean("T3CODE_DESKTOP_VERBOSE").pipe(Config.withDefault(() => false)), |
| 152 | skipBuild: Config.boolean("T3CODE_DESKTOP_SKIP_BUILD").pipe(Config.withDefault(false)), |
| 153 | keepStage: Config.boolean("T3CODE_DESKTOP_KEEP_STAGE").pipe(Config.withDefault(false)), |
| 154 | signed: Config.boolean("T3CODE_DESKTOP_SIGNED").pipe(Config.withDefault(false)), |
| 155 | verbose: Config.boolean("T3CODE_DESKTOP_VERBOSE").pipe(Config.withDefault(false)), |
| 158 | 156 | }); |
| 159 | 157 | |
| 160 | 158 | const resolveBooleanFlag = (flag: Option.Option<boolean>, envValue: boolean) => |
| ... | ... | @@ -209,11 +207,13 @@ const commandOutputOptions = (verbose: boolean) => |
| 209 | 207 | }) as const; |
| 210 | 208 | |
| 211 | 209 | const 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; |
| 213 | 213 | |
| 214 | 214 | if (exitCode !== 0) { |
| 215 | 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 | }); |