Skip to content
Myr

Run the CLI build through the parse its test drives, and name each npm entry's build step

Before adoption: this commit came in with the history the project adopted, so no landing records it.

- build.ts' entry now reads Stdio's args and hands them to parseBuild, so the command line the flags test drives (--version, --targets, the built-in --version left out) is the one `bun build.ts` runs, not a second copy of Command.run with its own CliConfig. - Each tsdown entry runs as its own step (`tsdown bin`, `tsdown protocol, rules`, `tsdown pi`), so a BuildFailed says which entry broke. - release.test.ts: sort the effect import (Layer before Option). - Checked by hand: `bun build.ts --help` lists --version as a value flag; `bun run build -- --version 9.9.9-test` then node dist/bin.js, bun dist/bin.js and dist/bin/<cli> each print v9.9.9-test. dist/ is ignored. - No new tests: the existing flags, define and release-step cases cover the changed lines.

authored by oscabriel · committed by oscabriel · parent 3e43f55 · Browse files · 2 files+10 added−6 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+10 added−6 removed

  • tests:+1 added−1 removed
  • other:+9 added−5 removed

2 files+10 added−6 removed

modified:apps/cli/build.ts+9 added-5 removed
32 unmodified lines
33 Option,34 Path,35 Predicate,36 Schema,37 Stdio,38} from "effect";39import { CliConfig, Command, Flag, GlobalFlag } from "effect/cli";40import { ChildProcess, ChildProcessSpawner } from "effect/process";41import { build } from "tsdown";
168 unmodified lines
210 );211212 // 1. The npm build, one entry at a time: the first cleans `dist/`.213 for (const config of npm(version)) {213 yield* tsdown("tsdown", { ...config, config: false, cwd: root });214 yield* tsdown(`tsdown ${Object.keys(config.entry).join(", ")}`, {215 ...config,216 config: false,217 cwd: root,218 });219 }220221 // 2. The library entries' types. tsgo declares them in a folder at a222 // fixed path, removed once the build ends: the bundled `.d.ts` files keep
243 unmodified lines
466 );467468if (import.meta.main) {469 BunRuntime.runMain(465 Command.run(command(make), { version: UNSTAMPED }).pipe(466 Effect.provideService(CliConfig.CliConfig, builtIns),467 Effect.provide(BunServices.layer)468 )470 Stdio.Stdio.use(({ args }) =>471 Effect.flatMap(args, (argv) => parseBuild(argv, make))472 ).pipe(Effect.provide(BunServices.layer))473 );474}
modified:packages/config/test/release.test.ts+1 added-1 removed
9 unmodified lines
10 Array as Arr,11 Crypto,12 Effect,13 FileSystem,14 Layer,15 Option,16 Order,16 Layer,17 Path,18 Ref,19 Result,20 Schema,
740 unmodified lines