bump effect to latest beta (#1866)
Co-authored-by: Claude Opus 4.6 (1M context) <[email protected]> Co-authored-by: Julius Marminge <[email protected]> Co-authored-by: codex <[email protected]>
This commit is contained in:
174 files changed
+1853
-1870
No files matched your search
@@ -0,0 +1,45 @@
|
||||
import * as NodeServices from "@effect/platform-node/NodeServices";
|
||||
import { assert, it } from "@effect/vitest";
|
||||
import { ConfigProvider, Effect, Option } from "effect";
|
||||
|
||||
import { resolveBuildOptions } from "./build-desktop-artifact.ts";
|
||||
|
||||
it.layer(NodeServices.layer)("build-desktop-artifact", (it) => {
|
||||
it.effect("preserves explicit false boolean flags over true env defaults", () =>
|
||||
Effect.gen(function* () {
|
||||
const resolved = yield* resolveBuildOptions({
|
||||
platform: Option.some("mac"),
|
||||
target: Option.none(),
|
||||
arch: Option.some("arm64"),
|
||||
buildVersion: Option.none(),
|
||||
outputDir: Option.some("release-test"),
|
||||
skipBuild: Option.some(false),
|
||||
keepStage: Option.some(false),
|
||||
signed: Option.some(false),
|
||||
verbose: Option.some(false),
|
||||
mockUpdates: Option.some(false),
|
||||
mockUpdateServerPort: Option.none(),
|
||||
}).pipe(
|
||||
Effect.provide(
|
||||
ConfigProvider.layer(
|
||||
ConfigProvider.fromEnv({
|
||||
env: {
|
||||
T3CODE_DESKTOP_SKIP_BUILD: "true",
|
||||
T3CODE_DESKTOP_KEEP_STAGE: "true",
|
||||
T3CODE_DESKTOP_SIGNED: "true",
|
||||
T3CODE_DESKTOP_VERBOSE: "true",
|
||||
T3CODE_DESKTOP_MOCK_UPDATES: "true",
|
||||
},
|
||||
}),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
assert.equal(resolved.skipBuild, false);
|
||||
assert.equal(resolved.keepStage, false);
|
||||
assert.equal(resolved.signed, false);
|
||||
assert.equal(resolved.verbose, false);
|
||||
assert.equal(resolved.mockUpdates, false);
|
||||
}),
|
||||
);
|
||||
});
|
||||
@@ -214,11 +214,13 @@ const BuildEnvConfig = Config.all({
|
||||
});
|
||||
|
||||
const resolveBooleanFlag = (flag: Option.Option<boolean>, envValue: boolean) =>
|
||||
Option.getOrElse(Option.filter(flag, Boolean), () => envValue);
|
||||
Option.getOrElse(flag, () => envValue);
|
||||
const mergeOptions = <A>(a: Option.Option<A>, b: Option.Option<A>, defaultValue: A) =>
|
||||
Option.getOrElse(a, () => Option.getOrElse(b, () => defaultValue));
|
||||
|
||||
const resolveBuildOptions = Effect.fn("resolveBuildOptions")(function* (input: BuildCliInput) {
|
||||
export const resolveBuildOptions = Effect.fn("resolveBuildOptions")(function* (
|
||||
input: BuildCliInput,
|
||||
) {
|
||||
const path = yield* Path.Path;
|
||||
const repoRoot = yield* RepoRoot;
|
||||
const env = yield* BuildEnvConfig.asEffect();
|
||||
@@ -838,8 +840,10 @@ const buildDesktopArtifactCli = Command.make("build-desktop-artifact", {
|
||||
|
||||
const cliRuntimeLayer = Layer.mergeAll(Logger.layer([Logger.consolePretty()]), NodeServices.layer);
|
||||
|
||||
Command.run(buildDesktopArtifactCli, { version: "0.0.0" }).pipe(
|
||||
Effect.scoped,
|
||||
Effect.provide(cliRuntimeLayer),
|
||||
NodeRuntime.runMain,
|
||||
);
|
||||
if (import.meta.main) {
|
||||
Command.run(buildDesktopArtifactCli, { version: "0.0.0" }).pipe(
|
||||
Effect.scoped,
|
||||
Effect.provide(cliRuntimeLayer),
|
||||
NodeRuntime.runMain,
|
||||
);
|
||||
}
|
||||
@@ -121,7 +121,9 @@ it.layer(NodeServices.layer)("dev-runner", (it) => {
|
||||
Effect.gen(function* () {
|
||||
const env = yield* createDevRunnerEnv({
|
||||
mode: "dev",
|
||||
baseEnv: {},
|
||||
baseEnv: {
|
||||
T3CODE_LOG_WS_EVENTS: "1",
|
||||
},
|
||||
serverOffset: 0,
|
||||
webOffset: 0,
|
||||
t3Home: undefined,
|
||||
|
||||
+3
-44
@@ -356,35 +356,6 @@ interface DevRunnerCliInput {
|
||||
readonly turboArgs: ReadonlyArray<string>;
|
||||
}
|
||||
|
||||
const readOptionalBooleanEnv = (name: string): boolean | undefined => {
|
||||
const value = process.env[name];
|
||||
if (value === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
if (value === "1" || value.toLowerCase() === "true") {
|
||||
return true;
|
||||
}
|
||||
if (value === "0" || value.toLowerCase() === "false") {
|
||||
return false;
|
||||
}
|
||||
return undefined;
|
||||
};
|
||||
|
||||
const resolveOptionalBooleanOverride = (
|
||||
explicitValue: boolean | undefined,
|
||||
envValue: boolean | undefined,
|
||||
): boolean | undefined => {
|
||||
if (explicitValue === true) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (explicitValue === false) {
|
||||
return envValue;
|
||||
}
|
||||
|
||||
return envValue;
|
||||
};
|
||||
|
||||
export function runDevRunnerWithInput(input: DevRunnerCliInput) {
|
||||
return Effect.gen(function* () {
|
||||
const { portOffset, devInstance } = yield* OffsetConfig.asEffect().pipe(
|
||||
@@ -406,12 +377,6 @@ export function runDevRunnerWithInput(input: DevRunnerCliInput) {
|
||||
}),
|
||||
});
|
||||
|
||||
const envOverrides = {
|
||||
noBrowser: readOptionalBooleanEnv("T3CODE_NO_BROWSER"),
|
||||
autoBootstrapProjectFromCwd: readOptionalBooleanEnv("T3CODE_AUTO_BOOTSTRAP_PROJECT_FROM_CWD"),
|
||||
logWebSocketEvents: readOptionalBooleanEnv("T3CODE_LOG_WS_EVENTS"),
|
||||
};
|
||||
|
||||
const { serverOffset, webOffset } = yield* resolveModePortOffsets({
|
||||
mode: input.mode,
|
||||
startOffset: offset,
|
||||
@@ -425,15 +390,9 @@ export function runDevRunnerWithInput(input: DevRunnerCliInput) {
|
||||
serverOffset,
|
||||
webOffset,
|
||||
t3Home: input.t3Home,
|
||||
noBrowser: resolveOptionalBooleanOverride(input.noBrowser, envOverrides.noBrowser),
|
||||
autoBootstrapProjectFromCwd: resolveOptionalBooleanOverride(
|
||||
input.autoBootstrapProjectFromCwd,
|
||||
envOverrides.autoBootstrapProjectFromCwd,
|
||||
),
|
||||
logWebSocketEvents: resolveOptionalBooleanOverride(
|
||||
input.logWebSocketEvents,
|
||||
envOverrides.logWebSocketEvents,
|
||||
),
|
||||
noBrowser: input.noBrowser,
|
||||
autoBootstrapProjectFromCwd: input.autoBootstrapProjectFromCwd,
|
||||
logWebSocketEvents: input.logWebSocketEvents,
|
||||
host: input.host,
|
||||
port: input.port,
|
||||
devUrl: input.devUrl,
|
||||
|
||||
Reference in new issue
Block a user