Skip to content

fix(bindx-ui): ship the CLI bundle the bin points to - #161

Merged
matej21 merged 2 commits into
mainfrom
fix/bindx-ui-cli-bin
Nov 4, 2026
Merged

matej21 merged 2 commits into
mainfrom
fix/bindx-ui-cli-bin

Conversation

@matej21

@matej21 matej21 commented Nov 4, 2026 •

Copy link
Copy Markdown
Member

Problem

The published @contember/bindx-ui declares "bin": { "bindx-ui": "./dist/cli/cli.js" }, but the 0.1.60 tarball contains only dist/types — no dist/cli. Running npx bindx-ui from an install fails.

The CLI bundle step lived only in the package's own build script. The publish workflow runs the root build, which runs tsc --build plus the compiler's build:js, so the CLI was never bundled before bun pm pack.

Fix

  • bindx-ui: move the CLI bundle into a build:js script (same convention as bindx-compiler).
  • Root build: tsc --build && bun run --filter '*' build:js — every workspace's JS bundle step runs, so a new package with a bundle step is picked up without editing the root script.
  • scripts/check-pack/run.ts (bun run check:pack): packs every non-private package with bun pm pack (the tool the publish script uses) and fails if any main / module / types / bin / exports / imports target of the packed package.json is missing from the tarball. Subpath patterns (./src/*) need at least one match.
  • CI: new Package Contents job (build + check:pack). Publish workflow: check:pack runs after build and before the first npm publish, so a broken tarball stops the release before any package is published.

Verification

Local, on a clean worktree:

  • npm pack @contember/bindx-ui@0.1.60 --dry-run — only dist/types/**, no dist/cli (the bug).
  • bun run build — bundles bindx-ui/dist/cli/cli.js (with shebang, executable) and bindx-compiler/dist/index.js.
  • bun run check:pack — all 11 published packages ok.
  • After removing bindx-ui/dist/cli: check:pack exits 1 with FAIL @contember/bindx-ui — missing: ./dist/cli/cli.js.
  • Packed all packages with bun pm pack, installed the tarballs with npm into an empty dir: node_modules/.bin/bindx-ui links to dist/cli/cli.js; npx bindx-ui --help prints usage, npx bindx-ui status reads the package root and prints No ejected components.

Status

  • Review round 1 (Claude Opus 5.5 subagent, b2f1b71): approve; 1 minor + 1 nit, both fixed in 78f9e30
  • CI: green on b2f1b71 (Lint, Typecheck, Package Contents, Unit & Integration, Browser); green on 78f9e30; rebased onto main 1818ca8, green on 4eb39cd (incl. Package Contents)
  • Merge approved; merged with a merge commit. No release yet.

🤖 Generated with Claude Code

@matej21

matej21 commented Nov 4, 2026

Copy link
Copy Markdown
Member Author

Review round 1

Reviewer: Claude agent (Opus 5.5, general-purpose subagent, independent brief without the author's conclusions)
Commit: b2f1b71
Verdict: approve

Verified by the reviewer: bun run build bundles bindx-ui/dist/cli/cli.js (755, shebang); bun run --filter '*' build:js fails the build when one package's build:js fails and skips packages without the script; check:pack reads the packed package.json, handles string bin, null conditions and * patterns; the packed CLI runs --help.

Findings

  1. minor — scripts/check-pack/run.ts:120: process.exit(1) inside try skips the finally cleanup, so every failing run leaves a bindx-check-pack-* temp dir with all tarballs. Fix: set process.exitCode = 1 instead.
  2. nit — scripts/check-pack/run.ts:28: the imports field (#bindx-ui/*) is not checked. Its targets use the same syntax as exports; add it to the collected targets.

@matej21

matej21 commented Nov 4, 2026

Copy link
Copy Markdown
Member Author

Response to review round 1

  1. minor — process.exit(1) skips cleanup: fixed in 78f9e30 (process.exitCode = 1). Re-verified: a failing run exits 1 and leaves no bindx-check-pack-* dir.
  2. nit — imports not checked: fixed in 78f9e30. All packages still pass.

matej21 and others added 2 commits November 4, 2026 17:41
The bindx-ui CLI was bundled only by the package's own build script,
which the publish flow never runs, so the published tarball lacked
dist/cli/cli.js. Move the bundle into a build:js script and make the
root build run every workspace's build:js.

Add check:pack: packs each published package with bun pm pack and fails
when a main/module/types/bin/exports target is missing from the tarball.
It runs as a CI job and in the publish workflow before any package is
published.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
process.exit() skipped the finally block, leaving the packed tarballs
in the temp dir after every failing run.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@matej21
matej21 force-pushed the fix/bindx-ui-cli-bin branch from 78f9e30 to 4eb39cd Compare November 4, 2026 16:41
@matej21
matej21 merged commit 229d581 into main Nov 4, 2026
5 checks 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.

1 participant