Skip to content

Drop sprockets and modernize - #134

Merged
hmdne merged 19 commits into
masterfrom
hmdne/drop-sprockets-and-modernize
Apr 9, 2026
Merged

hmdne merged 19 commits into
masterfrom
hmdne/drop-sprockets-and-modernize

Conversation

@hmdne

@hmdne hmdne commented Mar 21, 2026

Copy link
Copy Markdown
Member

This is a heavy rewrite of the current opal-rails to drop dependency on Sprockets. Unfortunately, it is likely to cause a lot of breakage. Current users will need to port their applications somewhat. This will necessitate a major version bump.

@AndyObtiva I will follow this up with patches against Glimmer.

@hmdne
hmdne force-pushed the hmdne/drop-sprockets-and-modernize branch from 6c0500f to b38783a Compare March 21, 2026 09:41
@hmdne
hmdne force-pushed the hmdne/drop-sprockets-and-modernize branch from f01f8d5 to 426b9ee Compare April 3, 2026 03:53
hmdne added 19 commits April 3, 2026 05:40
Start moving opal-rails toward a modern Rails asset flow by introducing entrypoint resolution, builder-driven asset generation, and an opal:build task with safe output tracking. Document the new configuration and add current-Ruby stdlib dependencies so the new build specs run reliably on modern toolchains.
Move the engine path-setup rules and automatic build task hooks into small
helpers so the boot integration stays simple, explicit, and directly testable.
Cover the new path and task-hook behavior with focused specs, and harden the
source-map integration spec around the extracted hook flow.
Make the new build pipeline safe in shared app/assets/builds directories by removing only Opal-tracked outputs and leaving unrelated artifacts alone. Document the cleanup flow and cover it with task and manifest specs so migration-friendly builds stay predictable.
Extend the new build pipeline with a watch mode that tracks Opal and app dependencies, rebuilds affected entrypoints, and falls back to full rebuilds when the dependency graph changes. Document the workflow, add the listen dependency, and cover the watch runner and task wiring with focused specs.
Move the installer away from manifest.js and Sprockets-era entrypoints so new apps get a build-based app/opal setup while migration-friendly layouts keep their existing structure. Also fold in the generator follow-ups around Turbo layout tags, existing multi-entrypoint layouts, mixed-stack application asset naming, and bin/dev scaffolding, with the README and generator specs updated to match.
Move the bundled Rails app and integration fixtures off Sprockets-era app/assets/javascripts entrypoints so the suite exercises the new app/opal -> app/assets/builds flow. Prebuild and prune test assets around the suite, keep source-map coverage aligned with built outputs, and document the build-based test setup while retaining only the minimal manifest needed for the current Sprockets-dependent major.
Drop the helper-side Opal loader integration and the remaining engine/runtime dependency on opal-sprockets and sprockets-rails so host apps use normal Rails asset includes and choose their own asset server. Keep the current test app on explicit Sprockets support, update the README and helper specs, and remove the old runtime coupling from the gem metadata and engine boot path.
Raise the declared Rails floor to 7.0 and the Ruby floor to 2.7 so the build-first branch matches the modern support policy. Simplify the appraisal and CI matrix by removing Rails 6 combinations, and document the new support window in the README and changelog.
Stop generating app/assets/javascripts/*.js.rb files and emit plain Opal source files into the active source root instead, reusing app/assets/opal for migration-friendly layouts. Refresh the generator template wording for the build-based flow, document the new behavior in the README, and cover both greenfield and migration paths with focused generator specs.
Add direct coverage for extra Opal load paths in both build and watch
flows so documented append_paths behavior is exercised explicitly.
Verify that builders receive append_paths and use_gems, that requires
can resolve through extra load paths, and that watch mode monitors
those directories so added files trigger rebuilds. Fix builder path
ordering to prefer entrypoints_path over source_path.
Stop the contributor sandbox from calling webpacker:install now that opal-rails uses a build-first asset flow. Make the sandbox scripts run an initial opal:build after setup, document the updated workflow in the README, and record the change in the changelog so the local sandbox matches the modern generator output.
Widen the declared Rails range to include 8.0 and 8.1, add matching
appraisal gemfiles, and expand CI so Rails 8 is exercised on Ruby 3.2
where Rails itself requires it. Pin appraisal sqlite3 dependencies by
Rails major, improve browser detection with a dedicated BrowserSupport
module, rewrite Cuprite driver configuration, and split the default
Rake spec harness into non-JS and JS phases so every active
Rails/Opal lane runs green on the current Ruby 4 environment.
Drop the closed-ended Opal < 2.0 runtime cap, add appraisal and CI lanes for Opal master alongside Opal 1.8, and narrow the explicit CI Ruby matrix to 3.2 and 4.0. Update the support docs to match and add the Opal 2.0 backtick magic comment to the test-app entrypoint so the master lanes stay clean.
Require Haml 6+ for the optional :opal filter, remove the legacy Haml 5 implementation, and make the loader fail clearly when an older Haml is present. Also cover the version guard with focused specs and document the new floor in the README and changelog.
v1 uses deprecated Node 12 and the set-output workflow command
which GitHub is removing.
Add a standalone 2.x -> 3.x porting guide covering the build-based
pipeline migration: fast path via the generator, manual checklist,
development/test workflow, and cleanup of old 2.x patterns.

Update README to link to PORTING.md and document the new manifest.js
and test-asset-debug generator behaviors.
Exercises the full opal-rails pipeline: create Rails app, install
opal-rails, write Opal code, run dev mode with bin/dev (opal:watch),
modify code and verify live rebuild, run tests via bin/rails test
(test:prepare triggers opal:build), precompile assets for production,
and serve production mode.  All builds are implicit — never calls
opal:build directly.

Excluded from the default suite (tagged :e2e); run with:
  bundle exec rspec spec/end_to_end/ --tag e2e
Document that running the generator on an already-installed 2.x app can leave a broken mixed setup, so users should pin opal-rails to 2.0 or follow PORTING.md instead.
Detect the legacy 2.x app shape before later build and asset failures happen, and point users to pin opal-rails to 2.0 or read PORTING.md instead. Allow already-ported apps to suppress the warning explicitly when leftover legacy files would otherwise trip the heuristic.
@hmdne
hmdne force-pushed the hmdne/drop-sprockets-and-modernize branch from 426b9ee to da50dc0 Compare April 3, 2026 06:29
@hmdne
hmdne merged commit b2491e9 into master Apr 9, 2026
12 checks passed
@hmdne
hmdne deleted the hmdne/drop-sprockets-and-modernize branch April 9, 2026 06:09
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