Commit af71821
committed
Introduce
Introduces the private `@codama-internal/spec-generators` workspace package and uses it to fully regenerate the `@codama/node-types` source surface from the encoded `@codama/spec` description.
The new generator package houses every code generator the monorepo needs behind a single orchestrator entrypoint. Each generator is self-contained — it knows which spec major it targets, which output directory it writes to, and which compatibility knobs it needs — and exposes a no-argument `generate()` from its `index.ts`. The orchestrator at `src/index.ts` runs every registered generator sequentially. This first cut ships only the gen-ts-node-types generator, ported from the spec repo with imports rewritten to consume `@codama/fragments/javascript`; the v1 driver supplies the legacy compatibility tables (`narrowableDataAttributes`, `genericParamOrder`) needed to keep the existing public type surface stable. Adding a future generator (migrators, JSON schema, …) is a matter of dropping a folder under `src/`, exposing its own `generate()`, and wiring it into the orchestrator.
The regenerated `@codama/node-types/src/` replaces the hand-maintained interfaces wholesale: the generator wipes its target `generated/` directory before writing, so stale files cannot survive. Hand-written content lives at the top of `src/` as siblings of `generated/`, never inside it. Two compatibility shims are added there — `Docs = Array<string>` and `ProgramVersion = Version` — to keep `@codama/nodes` and `@codama/nodes-from-anchor` compiling against the slimmer generated surface; both can be removed in a future major if desired.
Array fields are emitted as `Array<T>` rather than `T[]` so an inline-union element type like `array(literalUnion(true, false))` doesn't need extra parentheses to preserve precedence with `|`. The shape changes that fall out of regeneration are documented in the accompanying changeset.@codama-internal/spec-generators and regenerate @codama/node-types
1 parent 2e4ba53 commit af71821
247 files changed
Lines changed: 4129 additions & 850 deletions
File tree
- .changeset
- packages
- node-types
- src
- contextualValueNodes
- countNodes
- discriminatorNodes
- generated
- contextualValueNodes
- countNodes
- discriminatorNodes
- linkNodes
- pdaSeedNodes
- typeNodes
- valueNodes
- linkNodes
- pdaSeedNodes
- typeNodes
- valueNodes
- nodes-from-anchor/src
- v00
- v01
- spec-generators
- bin
- src
- nodeTypes
- fragments
- utils
- test/nodeTypes
- fragments
- utils
- validators/test
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
0 commit comments