(input: DevRunnerCliInput)
| 480 | } |
| 481 | |
| 482 | export function runDevRunnerWithInput(input: DevRunnerCliInput) { |
| 483 | return Effect.gen(function* () { |
| 484 | const { portOffset, devInstance } = yield* OffsetConfig.pipe( |
| 485 | Effect.mapError( |
| 486 | (cause) => |
| 487 | new DevRunnerConfigurationError({ |
| 488 | configKeys: ["T3CODE_PORT_OFFSET", "T3CODE_DEV_INSTANCE"], |
| 489 | cause, |
| 490 | }), |
| 491 | ), |
| 492 | ); |
| 493 | |
| 494 | const { offset, source } = yield* resolveOffset({ portOffset, devInstance }); |
| 495 | |
| 496 | const { serverOffset, webOffset } = yield* resolveModePortOffsets({ |
| 497 | mode: input.mode, |
| 498 | startOffset: offset, |
| 499 | hasExplicitServerPort: input.port !== undefined, |
| 500 | hasExplicitDevUrl: input.devUrl !== undefined, |
| 501 | }); |
| 502 | |
| 503 | const hostEnvironment = yield* HostProcessEnvironment; |
| 504 | const env = yield* createDevRunnerEnv({ |
| 505 | mode: input.mode, |
| 506 | baseEnv: hostEnvironment, |
| 507 | serverOffset, |
| 508 | webOffset, |
| 509 | t3Home: input.t3Home, |
| 510 | noBrowser: input.noBrowser, |
| 511 | autoBootstrapProjectFromCwd: input.autoBootstrapProjectFromCwd, |
| 512 | logWebSocketEvents: input.logWebSocketEvents, |
| 513 | host: input.host, |
| 514 | port: input.port, |
| 515 | devUrl: input.devUrl, |
| 516 | }); |
| 517 | |
| 518 | const selectionSuffix = |
| 519 | serverOffset !== offset || webOffset !== offset |
| 520 | ? ` selectedOffset(server=${serverOffset},web=${webOffset})` |
| 521 | : ""; |
| 522 | |
| 523 | yield* Effect.logInfo( |
| 524 | `[dev-runner] mode=${input.mode} source=${source}${selectionSuffix} serverPort=${String(env.T3CODE_PORT)} webPort=${String(env.PORT)} baseDir=${String(env.T3CODE_HOME)}`, |
| 525 | ); |
| 526 | |
| 527 | if (input.dryRun) { |
| 528 | return; |
| 529 | } |
| 530 | |
| 531 | const spawnCommand = yield* resolveSpawnCommand( |
| 532 | "vp", |
| 533 | [...MODE_ARGS[input.mode], ...input.runArgs], |
| 534 | { env }, |
| 535 | ); |
| 536 | const processContext = { |
| 537 | mode: input.mode, |
| 538 | executable: "vp" as const, |
| 539 | argumentCount: spawnCommand.args.length, |
no test coverage detected