feat(ts): lib mode — emit an npm package - #9
Merged
Merged
Conversation
`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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
comline generate --mode lib --target typescriptnow produces an installable package instead of erroring:package.jsonPackageMeta,"type": "module", anexportsmap, abuild: tscscript, and"@comline/runtime": "^0.1.0"when any schema has a protocoltsconfig.jsondeclaration,outDir: distsrc/index.tsexport * from "./<ns>.js"barrelsrc/<ns>.tscodemodeNested namespaces are rejected for now (would need a
src/tree — a follow-up shared with the Rust generator).@comline/runtimeis not on npm yet, so a generated package needs it linked / from a local registry until it publishes; the generator'sRUNTIME_VERSIONconst carries the intended range. Verified by hand: a generated packagetsc-builds clean against the linked runtime —dist/{index,<ns>}.{js,d.ts}.Conformance (
codemode only) is unaffected — no golden change.The TypeScript target is now feature-complete for
codeandlibgeneration.