Skip to content

feat(ts): lib mode — emit an npm package - #9

Merged
Kinflou merged 1 commit into
mainfrom
feat/ts-lib-mode
Sep 2, 2026
Merged

feat(ts): lib mode — emit an npm package#9
Kinflou merged 1 commit into
mainfrom
feat/ts-lib-mode

Conversation

@Kinflou

@Kinflou Kinflou commented Sep 2, 2026

Copy link
Copy Markdown
Member

comline generate --mode lib --target typescript now produces an installable package instead of erroring:

File
package.json name (lowercased) + version from PackageMeta, "type": "module", an exports map, a build: tsc script, and "@comline/runtime": "^0.1.0" when any schema has a protocol
tsconfig.json NodeNext, declaration, outDir: dist
src/index.ts an export * from "./<ns>.js" barrel
src/<ns>.ts the same per-schema output as code mode

Nested namespaces are rejected for now (would need a src/ tree — a follow-up shared with the Rust generator).

@comline/runtime is not on npm yet, so a generated package needs it linked / from a local registry until it publishes; the generator's RUNTIME_VERSION const carries the intended range. Verified by hand: a generated package tsc-builds clean against the linked runtime — dist/{index,<ns>}.{js,d.ts}.

Conformance (code mode only) is unaffected — no golden change.

The TypeScript target is now feature-complete for code and lib generation.

`comline generate --mode lib --target typescript` now produces an
installable package instead of erroring:

  - package.json — name (lowercased) + version from PackageMeta,
    "type": "module", an exports map, a `build: tsc` script, and
    "@comline/runtime": "^0.1.0" as a dependency when any schema has a
    protocol (omitted otherwise).
  - tsconfig.json — NodeNext, declaration, outDir dist.
  - src/index.ts — an `export * from "./<ns>.js"` barrel.
  - src/<ns>.ts — the same per-schema output as `code` mode.

Nested namespaces are rejected for now (a `src/` tree — a follow-up shared
with the Rust generator). `@comline/runtime` is not on npm yet, so a
generated package needs it linked / from a local registry until it
publishes; the generator's RUNTIME_VERSION const carries the intended
range.

Verified by hand: a generated package `tsc`-builds clean against the
linked runtime.
@Kinflou
Kinflou merged commit 5c20074 into main Sep 2, 2026
4 checks passed
@Kinflou
Kinflou deleted the feat/ts-lib-mode branch September 2, 2026 09:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant