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

feat: move to ViewComponent 3 + Rails 8 #196

Merged
merged 9 commits into from
Jan 6, 2025
Merged

feat: move to ViewComponent 3 + Rails 8 #196

merged 9 commits into from
Jan 6, 2025

Conversation

freesteph
Copy link
Collaborator

Alors le plus dur c'était surtout la dummy app et de transitionner de Sprockets aux nouveaux trucs. En attendant un avis sur #195, voilà une PR qui nous ramène à l'horizon de la modernité.

Closes #176

@freesteph freesteph requested a review from adipasquale January 3, 2025 11:30
@@ -10,7 +10,7 @@ jobs:
fail-fast: false
matrix:
ruby: ['3.2.6', '3.3.6']
rails: ['6.1.5', '7.0.3']
rails: ['8.0.1']
Copy link
Member

Choose a reason for hiding this comment

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

Vraiment top cette introduction de Rails 8 et ce passage à view component 3

En revanche, view component 3 supporte aussi Rails 7.2 est encore supporté pour longtemps.
Est-ce qu’on ne pourrait pas garder Rails 7 aussi ?

En revanche très partant pour dropper Rails 6 qui n’est plus maintenu.

Copy link
Collaborator Author

@freesteph freesteph Jan 3, 2025

Choose a reason for hiding this comment

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

alors, idéalement oui, le truc c'est qu'en fait cette dépendance à Rails (7 ou 8) n'existe que dans le cadre de développement de dsfr-view-components. D'ailleurs je me rends compte bien trop tard que l'upgrade à VC3 aurait sûrement pu se faire sans upgrader la dummy app.

Mais sinon, tu peux installer dsfr-view-components dans un projet Rails7 sans problème :

FROM ruby:3.3.6-slim

RUN apt-get update && apt-get install -y build-essential git

RUN gem install rails -v 7.0.0 && \
    rails new --minimal app

WORKDIR /app

RUN bundle add dsfr-view-components --github="betagouv/dsfr-view-components" --branch="feat/rails8"

RUN bundle exec gem dep dsfr-view-components | grep -v "development"

# NDLR ceci^ donne ceci :

# #9 [6/6] RUN bundle exec gem dep dsfr-view-components | grep -v "development)"
#9 0.327 Gem dsfr-view-components-2.0.0
#9 0.327   html-attributes-utils (~> 1)
#9 0.327   pagy (~> 6)
#9 0.327   view_component (~> 3)
#9 0.327 
#9 DONE 0.3s

CMD ["./bin/rails", "s"]
docker build le_code_au_dessus -t yolo && docker run -t yolo
=> Rails 7.0.8.7 application starting in development 
=> Run `bin/rails server --help` for more startup options
Puma starting in single mode...
* Puma version: 5.6.9 (ruby 3.3.6-p108) ("Birdie's Version")
*  Min threads: 5
*  Max threads: 5
*  Environment: development
*          PID: 1
* Listening on http://127.0.0.1:3000
* Listening on http://[::1]:3000
Use Ctrl-C to stop

et viva la vida

@freesteph
Copy link
Collaborator Author

Calling once

@freesteph
Copy link
Collaborator Author

Calling twice

Copy link
Collaborator

@adipasquale adipasquale left a comment

Choose a reason for hiding this comment

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

entière confiance @freesteph on s’arrangera pour faire marcher si ça ne passe plus chez RDVSP.

Merci d’être toujours motivé pour cette gem, longue vie ruby

@@ -111,5 +111,5 @@
# config.active_record.database_resolver_context = ActiveRecord::Middleware::DatabaseSelector::Resolver::Session
config.public_file_server.enabled = true
config.assets.paths << Rails.root.join('node_modules')
config.assets.paths << Rails.root.join('node_modules', 'govuk-frontend', 'govuk', 'assets', 'fonts')
config.assets.paths << Rails.root.join("node_modules/govuk-frontend/govuk/assets/fonts")
Copy link
Collaborator

Choose a reason for hiding this comment

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

faudra qu’on supprime cette dépendance sur govuk

@adipasquale
Copy link
Collaborator

je n’ai pas bien saisi la dépendance à bun que tu introduis ici, faudra que je me replonge dedans !

@freesteph
Copy link
Collaborator Author

je n’ai pas bien saisi la dépendance à bun que tu introduis ici, faudra que je me replonge dedans !

c'est dans le bootstrap code de Rails8/CSSBundling j'ai pas tout capté mais de toute façon ça saute juste après rails/rails#49241

@freesteph freesteph merged commit f431bab into main Jan 6, 2025
7 checks passed
@freesteph freesteph deleted the feat/rails8 branch January 6, 2025 14:33
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.

Rails 8.0 support
3 participants