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

Upgrade to Rails 7 and latest JS/CSS Tooling #2290

Merged
merged 17 commits into from
Feb 3, 2022
Merged

Upgrade to Rails 7 and latest JS/CSS Tooling #2290

merged 17 commits into from
Feb 3, 2022

Conversation

iHiD
Copy link
Member

@iHiD iHiD commented Dec 18, 2021

Erik

  • Use correct host variable (Exercism.config.website_assets_host) in the icon/graphical_icon helper files
  • Fix MySQL stuff (maybe pair on this?)
  • Implement --watch flag for yarn build (there's various articles on this online)
  • Click around a lot and look for anything that's broken
  • Minify CSS in production
  • Minify JS in production

iHiD

  • Fix any media queries that won't work any more

Gemfile Outdated Show resolved Hide resolved
Procfile.dev Outdated Show resolved Hide resolved
Procfile.docker.dev Outdated Show resolved Hide resolved
Procfile.docker.dev Outdated Show resolved Hide resolved
app/css/builds/application.css Outdated Show resolved Hide resolved
app/javascript/application.js Outdated Show resolved Hide resolved
app/javascript/esbuild.js Outdated Show resolved Hide resolved
bin/dev Outdated Show resolved Hide resolved
bin/monitor_manifest Outdated Show resolved Hide resolved
config/application.rb Outdated Show resolved Hide resolved
dev.Dockerfile Outdated Show resolved Hide resolved
postcss.config.js Outdated Show resolved Hide resolved
@@ -13,6 +13,7 @@
"strict": true,
"noEmit": true,
"allowSyntheticDefaultImports": true,
"resolveJsonModule": true,
"types": ["webpack-env", "app/javascript/declarations"]
},
"exclude": [
Copy link
Member Author

@iHiD iHiD Jan 7, 2022

Choose a reason for hiding this comment

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

  1. Does this minify?
  2. Does it target the correct version of JS (and/or add polyfill for older browsers)?
  3. Anything else we should do? :)

Copy link
Member

Choose a reason for hiding this comment

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

  1. Yes, as it is just like any other bit of JavaScript (as JSON is JavaScript)
  2. No polyfill needed, as JSON is just regular JavaScript.
  3. Nope.

FYI The reason this has to be enabled explicitly is that they want to discourage people from reading big JSON files in their projects (which is usually better done via an XHR request). In our case, it's fine.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah, I meant the whole block here, sorry. I mean is esbuild minifying, targeting the correct version, etc.

Copy link
Member

Choose a reason for hiding this comment

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

I'll check.

@iHiD
Copy link
Member Author

iHiD commented Jan 10, 2022

Next up is getting the tests green I think.

app/javascript/channels/index.ts Show resolved Hide resolved
.github/workflows/tests.yml Outdated Show resolved Hide resolved
@ErikSchierboom ErikSchierboom force-pushed the rails-7 branch 2 times, most recently from 38b4d91 to 3a3c42f Compare January 13, 2022 08:17
Comment on lines +252 to +256
authored_exercises = Exercise.all.excluding(iHiD.authored_exercises).sort_by{rand}[0,3]
iHiD.authored_exercises += authored_exercises
Copy link
Member

Choose a reason for hiding this comment

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

This fixes an intermittent duplicate key exception, which was caused by the track syncing happening before this where you were already authoring some exercises. The excluding method is new in Rails 7 BTW: https://blog.saeloun.com/2021/03/08/rails-6-1-adds-excluding-to-active-record-relation.html

@@ -276,6 +289,10 @@ class ActionDispatch::IntegrationTest
include Devise::Test::IntegrationHelpers
include TurboAssertionsHelper

def setup
host! URI(Rails.application.routes.default_url_options[:host]).host
end
Copy link
Member Author

Choose a reason for hiding this comment

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

@ErikSchierboom Always call super in setup. A load of tests were breaking because the ActiveSupport::TestCase#setup method that we rely on (defined further up) wasn't getting called.

Copy link
Member

Choose a reason for hiding this comment

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

Ah, gotcha


unless ENV["EXERCISM_CI"]
listener = Listen.to(Rails.root / 'app' / 'images') { write_files }
if Rails.env.development?
Copy link
Member

Choose a reason for hiding this comment

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

docker/rails.Dockerfile Outdated Show resolved Hide resolved
: []),
],
bundle: true,
sourcemap: true,
Copy link
Member

Choose a reason for hiding this comment

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

Do we want sourcemaps in production?

Copy link
Member Author

Choose a reason for hiding this comment

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

Probably not?

Copy link
Member

Choose a reason for hiding this comment

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

I agree

? ['./app/javascript/packs/test.tsx']
: []),
],
bundle: true,
Copy link
Member

Choose a reason for hiding this comment

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

Is bundling something we want in development?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, I think so. Let's keep that consistent.

bundle: true,
sourcemap: true,
format: 'esm',
splitting: true,
Copy link
Member

Choose a reason for hiding this comment

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

Is splitting something we want in development?

@iHiD iHiD merged commit 93b4d92 into main Feb 3, 2022
@iHiD iHiD deleted the rails-7 branch February 3, 2022 15:05
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.

3 participants