-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Attempt at publishing the gem with compiled assets #2397
Attempt at publishing the gem with compiled assets #2397
Conversation
This looks like a great start. I think shipping with compiled dependencies is likely my preferred approach, as any other involves a lot of extra work (when releasing, or for end users). Could you take a start at documenting how this might be for end users? I'd love to see what it's like when integrating for the first time (after that, we'll want to make sure we have a migration guide in place, if it's needed.) As you've been doing this, have you seen any cases where we can drop some of the JavaScript/CSS dependencies? |
//= link administrate/application.js | ||
//= link administrate/application.css | ||
//= link administrate/docs.css |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you know why Hound is barking at .js and .rb files? My first time using it and I think we could ignore this one for manifest.js
I tested locally today with some new Rails apps and both Other than that, there is generator called I've changed the original CSS and JavaScript file paths in this branch to match the usage of jsbundling and cssbundling (main difference is
I haven't seen any cases yet. These are the current dependencies to compile Administrate's assets:
|
I'd be interested in helping get this over the finish line. If you need help, let me know! |
Hi @jordanstephens, thank you! I think the PR is ready for review. When you get a chance, testing this gem in any Rails apps you have would be helpful! To build and install the gem locally, I VERSION=$(ruby -r ./lib/administrate/version.rb -e "puts Administrate::VERSION")
echo "Version $VERSION"
yarn run build
yarn run build:css
gem build administrate.gemspec
gem install administrate-${VERSION}.gem (Notice it has the Then, in a Rails app that has Then you can build the current version with When running your Rails app, make sure to clean up any compiled assets with You can also keep the |
Hey @elias19r ! Thanks for your work on this. I just wanted to report that I tried out your branch on two rails apps—one using sprockets and one only using import maps—and administrate appears to work as expected in both cases. 🎉 Let me know if there's anything specific I can investigate for you or anything else I can do to help push this effort forward. |
I tested it on a demo project using propshaft and it works. propshaft is a better alternative for cssbundling and jsbundling, hope administrate can push this improvement to adapt to propshaft. |
To add another voice, I'm testing this on the same setup as @chloerei and it works great. |
Thank you for this work @elias19r, and apologies that it's taking so long to have it reviewed. I had a look today, and I really want to push this through the finish line. I've been tinkering and I have my own version at main...pablobm:administrate:publish-gem-with-precompiled-assets-2--digests, which some changes. I still want to test this with some apps, as well as on production-like environments. It's promising so far! Would you be able to rebase? There have been a few changes since July, so we should get up to date with that. I changed the I also added |
Thank you @pablobm! Sure, I'll rebase it soon |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pablobm I just merged your branch into mine and left comments about the things I didn't pick from you branch. Thank you!
I'll be removing comments from the Hound bot for now because they are noisy. We can rerun it later |
EXCITING! I can't wait to try this out! Thank you all (@elias19r, @pablobm, @nickcharlton, and others!) for all of the hard work |
Issue #2311
I've been looking at how Avo handles the gem's assets and decided to
try a similar solution for Administrate's issue with asset management.
In this PR, I'm using jsbundling-rails with
esbuild
andcssbundling-rails with
saas
to build Administrate's asset files.For that, I've removed the
jquery-rails
,saasc-rails
, andselectize-rails
gems and replaced them with NPM packages, updatingimports and moving files as needed.
The goal is to be able to run
yarn run build
andyarn run build:css
to build Administrate's assets and then build the gem, including the
contents from
app/assets/builds
in the gem files.So, the application using
administrate
won't need to compile thoseassets because they are ready-to-use
.js
and.css
files.The application will be just adding them to its pipeline, generating
digests, and serving the files.
Let me know what you think about this approach!
I'm new to Rails Engine and Administrate, so I may have overlooked something.