authorgravatar for julius0216@outlook.comJulius Marminge <julius0216@outlook.com> 2026-02-24 14:17:52-08:00
committergravatar for jmarminge@gmail.comJulius Marminge <jmarminge@gmail.com> 2026-02-26 13:20:36-08:00
logc9b0da63a11f6668619c0fc1c3901a5e84fe1d65
tree5e8d0658d2195ff69a35bb6b5a15909b2afb67d8
parent33ca29c2656ec6acd8986c210516f66b4a898fa9

niceee


2 files changed, 7 insertions(+), 8 deletions(-)

apps/server/src/main.test.ts+1-1
...@@ -24,7 +24,7 @@ const testLayer = Layer.mergeAll(...@@ -24,7 +24,7 @@ const testLayer = Layer.mergeAll(
24 cwd: "/tmp/t3-test-workspace",24 cwd: "/tmp/t3-test-workspace",
25 fixPath: Effect.void,25 fixPath: Effect.void,
26 findAvailablePort,26 findAvailablePort,
27 resolveStaticDir: () => Effect.undefined,27 resolveStaticDir: Effect.undefined,
28 } satisfies CliConfigShape),28 } satisfies CliConfigShape),
29 Layer.succeed(Server, {29 Layer.succeed(Server, {
30 createServer,30 createServer,
apps/server/src/main.ts+6-7
...@@ -26,7 +26,7 @@ export interface CliConfigShape {...@@ -26,7 +26,7 @@ export interface CliConfigShape {
26 readonly cwd: string;26 readonly cwd: string;
27 readonly fixPath: Effect.Effect<unknown, never>;27 readonly fixPath: Effect.Effect<unknown, never>;
28 readonly findAvailablePort: (preferred: number) => Effect.Effect<number, StartupError>;28 readonly findAvailablePort: (preferred: number) => Effect.Effect<number, StartupError>;
29 readonly resolveStaticDir: () => Effect.Effect<string | undefined>;29 readonly resolveStaticDir: Effect.Effect<string | undefined>;
30}30}
3131
32export class CliConfig extends ServiceMap.Service<CliConfig, CliConfigShape>()(32export class CliConfig extends ServiceMap.Service<CliConfig, CliConfigShape>()(
...@@ -141,7 +141,7 @@ const resolveCliConfig = Effect.fn(function* (input: CliInput) {...@@ -141,7 +141,7 @@ const resolveCliConfig = Effect.fn(function* (input: CliInput) {
141 const devUrl = env.devUrl;141 const devUrl = env.devUrl;
142 const noBrowser = env.noBrowser ?? mode === "desktop";142 const noBrowser = env.noBrowser ?? mode === "desktop";
143 const authToken = Option.getOrUndefined(input.token) ?? env.authToken;143 const authToken = Option.getOrUndefined(input.token) ?? env.authToken;
144 const staticDir = devUrl ? undefined : yield* cliConfig.resolveStaticDir();144 const staticDir = devUrl ? undefined : yield* cliConfig.resolveStaticDir;
145145
146 return {146 return {
147 mode,147 mode,
...@@ -245,11 +245,10 @@ export const CliConfigLive = Layer.effect(...@@ -245,11 +245,10 @@ export const CliConfigLive = Layer.effect(
245 cwd: process.cwd(),245 cwd: process.cwd(),
246 fixPath: Effect.sync(fixPath),246 fixPath: Effect.sync(fixPath),
247 findAvailablePort,247 findAvailablePort,
248 resolveStaticDir: () =>248 resolveStaticDir: resolveStaticDir().pipe(
249 resolveStaticDir().pipe(249 Effect.provideService(FileSystem.FileSystem, fileSystem),
250 Effect.provideService(FileSystem.FileSystem, fileSystem),250 Effect.provideService(Path.Path, path),
251 Effect.provideService(Path.Path, path),251 ),
252 ),
253 } satisfies CliConfigShape;252 } satisfies CliConfigShape;
254 }),253 }),
255);254);