Commit 5035eda
authored
Add importmap support for Rails 7+ (#11)
* Add importmap support for Rails 7+
This adds full importmap support while maintaining backward compatibility
with npm/bundler workflows.
## Changes
### New Build System
- Add `esbuild.importmap.js` for unbundled ESM builds
- Add `build-importmap` script to package.json
- Create `dist/importmap/` with 14 unbundled component files
- Keep dependencies external for importmap usage
### Package Updates
- Add `exports` field to package.json for modern resolution
- Update build command to include all three outputs
- Maintain existing bundled ESM/CJS builds
### Documentation
- Add BUILD.md - Complete NPM/bundler setup guide
- Add IMPORTMAP.md - Complete Rails 7+ importmap guide
- Add PUBLISHING.md - Publishing and CDN deployment guide
- Update README.md with both installation options
- Update CLAUDE.md with dual build system documentation
- Add importmap.json with CDN reference URLs
## Benefits
- ✅ Native Rails 7+ importmap support
- ✅ No breaking changes for existing users
- ✅ Dual distribution (bundled + unbundled)
- ✅ Comprehensive documentation for both methods
- ✅ Automatic CDN availability via npm
## Build Outputs
- Bundled ESM: 102KB (for npm/bundler users)
- Bundled CJS: 102KB (for CommonJS users)
- Importmap: 30KB total (14 unbundled files)
Co-Authored-By: Claude <noreply@anthropic.com>
* Add automated tests and CI workflow
- Add comprehensive build tests (66 test cases)
- Test bundled builds include dependencies
- Test importmap builds keep dependencies external
- Test all 14 components are built correctly
- Test documentation files exist and are linked
- Add GitHub Actions workflow for CI
- Test on Node 18 and 20
- Add test status badge to README
All tests passing ✅
* Fix deprecated upload-artifact action
Update from v3 to v4 to fix CI build failures
* Improve CI test debugging and file counting
- Add step to verify build outputs exist
- Improve file counting logic to handle whitespace
- Add better error messages with file listings
- Use find instead of ls for more reliable counting
* Simplify CI to run once on Node 20
- Remove matrix build (was running 4 times)
- Only run on Node 20.x (latest LTS)
- Only trigger on PR and main branch pushes
- Reduces CI runs from 4 to 1 per push
* Update demo to use unbundled importmap build
- Switch from bundled to importmap distribution
- Add all required dependencies to importmap
- Add explanatory comment about dual build system
- Demo now showcases the Rails 7+ importmap approach
* Update dependencies to latest versions
- Update esbuild 0.20.0 → 0.25.10
- Update hotkeys-js 3.13.7 → 3.13.15
- Rebuild all outputs with updated dependencies
- Update all documentation with new versions
- All 66 tests passing1 parent 536f3f0 commit 5035eda
File tree
47 files changed
+2342
-25
lines changed- .claude
- .github/workflows
- dist
- importmap
- test
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
47 files changed
+2342
-25
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
0 commit comments