Skip to content

Move TypeScript bindings to bindings/ts - #104

Merged
bubelov merged 1 commit into
masterfrom
feat/bindings-ts-dir
Aug 14, 2026
Merged

Move TypeScript bindings to bindings/ts#104
bubelov merged 1 commit into
masterfrom
feat/bindings-ts-dir

Conversation

@escapedcat

Copy link
Copy Markdown
Collaborator

Follow-up to #103, per post-merge feedback: keep the top-level bindings/ directory language-neutral so bindings for other languages (Kotlin, Swift, ...) can live alongside the TypeScript ones later.

What this does

  • Moves the committed bindings from bindings/ to bindings/ts/
  • Sets the default export directory via [env] in .cargo/config.toml (relative = true, so it resolves against the repo root regardless of where cargo runs). A plain cargo test keeps regenerating the committed files in place
  • devtools export-ts-types [dir] is unaffected: it sets TS_RS_EXPORT_DIR explicitly, and cargo's [env] default only applies when the variable is unset — verified both paths
  • The CI freshness check keeps watching all of bindings/, so future languages inherit it for free
  • README / AGENTS.md paths updated

The frontend branch (teambtcmap/btcmap.org#1243, unmerged) already points its pnpm types:api at bindings/ts — it fetches from master, so it needs this PR to land first.

Binary-size measurement for the perf question raised after #103 is running; numbers will follow as a comment.

🤖 Generated with Claude Code

Keeps the top-level bindings/ directory language-neutral so bindings for
other languages can live alongside. The default export dir is set via
[env] in .cargo/config.toml; an explicit TS_RS_EXPORT_DIR (devtools
export-ts-types) still overrides it.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@escapedcat

Copy link
Copy Markdown
Collaborator Author

Perf numbers for the question raised after #103, measured on the merge commit vs its first parent (identical toolchain, cargo build --release with the repo's native-CPU flags):

build target/release/btcmap-api
08b8c18^1 (pre ts-rs) 46,409,136 bytes
08b8c18 (with ts-rs) 46,408,416 bytes

Δ = −720 bytes — link-layout noise. The generated TS impls are only referenced by test code, so the linker dead-strips them from the release binary; runtime has no ts-rs code path at all. The only real cost is compile time for two extra crates (ts-rs + its proc-macro) on clean builds.

@escapedcat
escapedcat marked this pull request as ready for review August 13, 2026 07:46
@escapedcat
escapedcat requested a review from bubelov August 13, 2026 08:15
@bubelov
bubelov merged commit 04262c0 into master Aug 14, 2026
1 check passed
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.

2 participants