Fix theme directory path for bun bundler flat output#279
Conversation
The getThemesDir() function incorrectly navigated up one directory when resolving bundled theme paths in the dist build. This caused "Theme file not found" errors when using --theme with bundled themes like dracula in npm-installed packages. The bug was caused by outdated path logic that assumed bun's bundler would preserve directory structure (dist/tui/theme.js), when it actually produces flat output (dist/cli.js). The fix removes the unnecessary parent directory traversal. Fixes #277 https://claude.ai/code/session_01WrY1zjHuxQ1ddiJNDfqVqi
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
WalkthroughUpdates the path resolution logic in the theme directory lookup function to accommodate a flattened dist bundle layout. The resolution path for the bundled theme assets changes from a nested structure to a flat structure, while development mode behaviour remains unaffected. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #279 +/- ##
==========================================
- Coverage 43.70% 43.70% -0.01%
==========================================
Files 94 94
Lines 29021 29022 +1
==========================================
Hits 12684 12684
- Misses 16337 16338 +1
🚀 New features to boost your workflow:
|
…TCvtD Fix theme directory path for bun bundler flat output
Summary
Updated the theme directory resolution logic to correctly handle the bun bundler's flat output structure, where the compiled CLI is located at
dist/cli.jsrather than in a nested directory structure.Changes
../assets/themestoassets/themesto match bun's flat bundling outputdist/tui/theme.js) and bun's flat output (dist/cli.js)dist/assets/themeswhen running the bundled CLIImplementation Details
The fix leverages the existing
isInDistcheck that detects when code is running from the dist directory. Since bun produces a flat output structure wherecli.jsis directly in the dist root (rather than nested indist/tui/), the relative path to assets needs to be adjusted accordingly. The development path resolution remains unchanged.https://claude.ai/code/session_01WrY1zjHuxQ1ddiJNDfqVqi
Summary by CodeRabbit
Release Notes