Bundle alchemy_admin JS into a single pre-built artifact#3769
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3769 +/- ##
=======================================
Coverage 97.47% 97.47%
=======================================
Files 319 319
Lines 8476 8476
=======================================
Hits 8262 8262
Misses 214 214 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
5285daf to
a9a2eb1
Compare
The admin interface loaded ~73 individual JavaScript files via importmap on every page load. Bundling them into a single file reduces HTTP requests and improves page load performance while keeping the importmap available for extensions. Vendor libs remain external and are resolved by the importmap at runtime so host apps and extensions can still pin their own modules. Adds a public API for extensions: RemoteSelect, on, ImageCropper, ImageOverlay, pictureSelector, and NodeTree are re-exported from the bundle with alias pins so existing import paths keep working. ERB templates updated to use named imports for bundled modules. Explicit Turbo import replaces the implicit window.Turbo global. Dev watch mode via Procfile.dev rebuilds on source changes.
Prevents committed build artifacts from bloating PR diffs and skewing GitHub language statistics.
Adds a check_build_artifacts job that rebuilds JS and CSS artifacts and verifies they match what is committed. RSpec and Vitest are gated on this check so tests skip when artifacts are stale, avoiding wasted CI time.
a9a2eb1 to
b3b7948
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is this pull request for?
Replaces the per-file importmap loading of alchemy_admin JavaScript (~73 individual files) with a single pre-built
alchemy_admin.min.jsbundle using Rollup. This reduces HTTP requests on every admin page load while keeping the importmap available for extensions and host apps.Notable changes
rollup.admin.config.mjs— dedicated Rollup config for the admin bundle, separate from the vendor lib configpin_all_fromreplaced with explicit pins for the bundle and alias pins for submodules used by extensions (RemoteSelect,on,ImageCropper,ImageOverlay,pictureSelector,NodeTree)<script type="module">imports changed from default to named imports to work with the bundle's exportswindow.Turboglobal reference in the entrypointbuild:admin:devscript added to Procfile.dev for automatic rebuilds during developmentcheck_build_artifactsjob verifies committed build artifacts match source; RSpec and Vitest are gated on this check.gitattributes— marks build artifacts as linguist-generated to keep PR diffs cleanExtensions that import
RemoteSelectfromalchemy_admin/components/remote_selectcontinue to work without changes via alias pins. Gem consumers are unaffected — the pre-built artifact ships with the gem.Checklist