Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warn instead of raising on missing manifest.js #546

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

mamhoff
Copy link
Contributor

@mamhoff mamhoff commented Feb 14, 2025

With a pristine (rails new) Rails 8.0 app, the app/assets/config/manifest.js file is no longer automatically generated. For engines still using sprockets, that is not a huge issue, because they have and add their own manifest files for their assets to the list of precompiled assets.

However, scripts like the Solidus bin/sandbox script first run rails new, then add the needed engines to the sandbox's Gemfile, then run rails db:migrate and their respective install generators. With Rails 8, these scripts now fail before anything is possible in Ruby, because the initializer of Sprockets::Railtie will raise an error on startup.

This commit changes the behavior of the Railtie to issue a deprecation warning instead of raising an Exception.

Bundler `latest` has stopped working with older Rubies. We need to
specify the Bundler version for the older Rubies to still build.
@mamhoff mamhoff force-pushed the warn-not-raise-missing-manifest branch from 7bacda1 to 4b59d14 Compare February 15, 2025 10:36
@mamhoff
Copy link
Contributor Author

mamhoff commented Feb 15, 2025

Rebased on #547 to get the CI green.

@mamhoff mamhoff force-pushed the warn-not-raise-missing-manifest branch 5 times, most recently from c4144a3 to 3288686 Compare February 15, 2025 10:56
With a pristine (`rails new`) Rails 8.0 app, the `app/assets/config/manifest.js` file
is no longer automatically generated. For engines still using sprockets,
that is not a huge issue, because they have and add their own manifest
files for their assets to the list of precompiled assets.

However, scripts like the Solidus bin/sandbox script[1] first run `rails
new`, then add the needed engines to the sandbox's `Gemfile`, then run
`rails db:migrate` and their respective install generators. With Rails
8, these scripts now fail before anything is possible in Ruby, because
the initializer of `Sprockets::Railtie` will raise an error on startup.

This commit changes the behavior of the Railtie to issue a deprecation
warning instead of raising an Exception.

[1] https://github.com/solidusio/solidus/blob/main/bin/sandbox#L44-L99
@mamhoff mamhoff force-pushed the warn-not-raise-missing-manifest branch from 3288686 to 3b36794 Compare February 15, 2025 12:05
Copy link

@tvdeyen tvdeyen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. This will help every Rails 8 app to even boot when a gem depends on sprockets-rails. Please merge this 🙏🏻

tvdeyen added a commit to blish/solidus that referenced this pull request Feb 18, 2025
Due to a bug in sprockets-rails[1] we need to manually
add the sprockets manifest into the generated rails
app before running any rails commands inside the rails
app folder.

[1](rails/sprockets-rails#546)
tvdeyen added a commit to blish/solidus that referenced this pull request Feb 18, 2025
Due to a bug in sprockets-rails[1] we need to manually
add the sprockets manifest into the generated rails
app before running any rails commands inside the rails
app folder.

[1](rails/sprockets-rails#546)
tvdeyen added a commit to blish/solidus that referenced this pull request Feb 18, 2025
Due to a bug in sprockets-rails[1] we need to manually
add the sprockets manifest into the generated rails
app before running any rails commands inside the rails
app folder.

[1](rails/sprockets-rails#546)
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