Skip to content

📦 opentui package pin - resolves rendering on darwin64#18

Merged
benvinegar merged 2 commits intobenvinegar:mainfrom
sdougbrown:fix/opentui-app-pin
Apr 26, 2026
Merged

📦 opentui package pin - resolves rendering on darwin64#18
benvinegar merged 2 commits intobenvinegar:mainfrom
sdougbrown:fix/opentui-app-pin

Conversation

@sdougbrown
Copy link
Copy Markdown
Contributor

Summary

Fixes packaged/global termdraw rendering with incorrect colors by pinning OpenTUI runtime dependencies to exact versions.

The app CLI bundles OpenTUI JS into dist/cli.js, but the bundled code still dynamically loads the platform native OpenTUI package at runtime. With ^0.1.97 ranges, npm can install a newer @opentui/core / native optional dependency version than the one the CLI bundle was built against. In my case, the globally installed CLI still worked interactively, but the UI rendered only red on a black background.

This also updates the app CLI source import to use the workspace package entrypoint, @termdraw/opentui, instead of reaching into ../../opentui/src.

Reproduction

From the original package state:

cd packages/app
npm pack --ignore-scripts
npm install -g "$(ls -t *.tgz | head -1)"
termdraw

Observed: the UI opens and remains interactive, but colors render incorrectly as red on black.

After this change:

cd ~/Code/termdraw-fork
bun run build
cd packages/app
npm pack --ignore-scripts
npm install -g "$(ls -t *.tgz | head -1)"
termdraw

Observed: the UI renders with the expected full color palette.

Why

This appears to match an OpenTUI optional dependency/version mismatch issue described here:

anomalyco/opentui#29 (comment)

That comment notes that loose optional dependency versions could cause the wrong native package version to be downloaded, and that explicit versions fix it.

Since @termdraw/app publishes a bundled CLI but relies on OpenTUI’s installed native package at runtime, exact OpenTUI pins keep the JS bundle and native package aligned for npm consumers.

Screenshots

BEFORE:
Screenshot 2026-04-25 at 12 42 43 PM

AFTER:
Screenshot 2026-04-25 at 2 22 32 PM

Validation

bun run typecheck
bun run build

Manually verified by packing and globally installing the app tarball before and after the dependency pin change.

Also fixed a workspace relative link because it bugged me to see. Probably unrelated. 😅

Used codex to help diagnose. I'm on a plane rn. ✈️

sdougbrown and others added 2 commits April 25, 2026 22:56
it seems that leaving these deps "open to interpretation" causes some
unpredictable rendering bugs due to upstream module resolution
@benvinegar benvinegar force-pushed the fix/opentui-app-pin branch from 8427d1f to 14a36c5 Compare April 26, 2026 02:57
@benvinegar benvinegar merged commit bddbe65 into benvinegar:main Apr 26, 2026
1 check passed
@benvinegar
Copy link
Copy Markdown
Owner

Thanks @sdougbrown!

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