Browse Source

Update node version from ^16.0.0 to ^18.0.0 and ruby 3.1.2 to 3.1.4 (#1794)

* Update govuk-prototype-components

* Update node version

* Udate versions in the pipeline

* Do not fix to a specific buildpack version

* Update ruby version

* Upgrade govuk-frontend

* Update summary cards to use govuk frontend component
pull/1798/head
kosiakkatrina 1 year ago committed by GitHub
parent
commit
d87d6a7fb3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      .github/workflows/production_pipeline.yml
  2. 6
      .github/workflows/staging_pipeline.yml
  3. 2
      .nvmrc
  4. 2
      .ruby-version
  5. 4
      Dockerfile
  6. 2
      Dockerfile_dev
  7. 2
      Gemfile
  8. 2
      Gemfile.lock
  9. 10
      app/components/bulk_upload_error_row_component.html.erb
  10. 8
      app/components/check_answers_summary_list_card_component.html.erb
  11. 2
      app/frontend/application.js
  12. 2
      app/frontend/controllers/govukfrontend_controller.js
  13. 4
      app/views/form/_interruption_screen_question.html.erb
  14. 8
      app/views/form/review.html.erb
  15. 2
      config/cloud_foundry/review_manifest.yml
  16. 4
      docs/setup.md
  17. 2
      manifest.yml
  18. 6
      package.json
  19. 6
      spec/features/form/check_answers_page_lettings_logs_spec.rb
  20. 30
      spec/features/form/check_answers_page_sales_logs_spec.rb
  21. 2
      spec/views/bulk_upload_lettings_results/show.html.erb_spec.rb
  22. 2
      spec/views/bulk_upload_lettings_results/summary.html.erb_spec.rb
  23. 2
      spec/views/bulk_upload_sales_results/show.html.erb_spec.rb
  24. 2
      spec/views/bulk_upload_sales_results/summary.html.erb_spec.rb
  25. 2
      webpack.config.js
  26. 2138
      yarn.lock

4
.github/workflows/production_pipeline.yml

@ -68,7 +68,7 @@ jobs:
uses: actions/setup-node@v3 uses: actions/setup-node@v3
with: with:
cache: yarn cache: yarn
node-version: 16 node-version: 18
- name: Create database - name: Create database
run: | run: |
@ -127,7 +127,7 @@ jobs:
uses: actions/setup-node@v3 uses: actions/setup-node@v3
with: with:
cache: yarn cache: yarn
node-version: 16 node-version: 18
- name: Create database - name: Create database
run: | run: |

6
.github/workflows/staging_pipeline.yml

@ -60,7 +60,7 @@ jobs:
uses: actions/setup-node@v3 uses: actions/setup-node@v3
with: with:
cache: yarn cache: yarn
node-version: 16 node-version: 18
- name: Create database - name: Create database
run: | run: |
@ -118,7 +118,7 @@ jobs:
uses: actions/setup-node@v3 uses: actions/setup-node@v3
with: with:
cache: yarn cache: yarn
node-version: 16 node-version: 18
- name: Create database - name: Create database
run: | run: |
@ -149,7 +149,7 @@ jobs:
uses: actions/setup-node@v3 uses: actions/setup-node@v3
with: with:
cache: yarn cache: yarn
node-version: 16 node-version: 18
- name: Install packages and symlink local dependencies - name: Install packages and symlink local dependencies
run: | run: |

2
.nvmrc

@ -1 +1 @@
16 18

2
.ruby-version

@ -1 +1 @@
3.1.2 3.1.4

4
Dockerfile

@ -1,5 +1,5 @@
# Build compilation image # Build compilation image
FROM ruby:3.1.2-alpine as builder FROM ruby:3.1.4-alpine as builder
# The application runs from /app # The application runs from /app
WORKDIR /app WORKDIR /app
@ -45,7 +45,7 @@ RUN rm -rf node_modules log tmp && \
find /usr/local/bundle/gems -name "*.html" -delete find /usr/local/bundle/gems -name "*.html" -delete
# Build runtime image # Build runtime image
FROM ruby:3.1.2-alpine as production FROM ruby:3.1.4-alpine as production
# The application runs from /app # The application runs from /app
WORKDIR /app WORKDIR /app

2
Dockerfile_dev

@ -1,5 +1,5 @@
# Build compilation image # Build compilation image
FROM ruby:3.1.2-alpine FROM ruby:3.1.4-alpine
# The application runs from /app # The application runs from /app
WORKDIR /app WORKDIR /app

2
Gemfile

@ -3,7 +3,7 @@
source "https://rubygems.org" source "https://rubygems.org"
git_source(:github) { |repo| "https://github.com/#{repo}.git" } git_source(:github) { |repo| "https://github.com/#{repo}.git" }
ruby "3.1.2" ruby "3.1.4"
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails', branch: 'main' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails', branch: 'main'
gem "rails", "~> 7.0.2" gem "rails", "~> 7.0.2"

2
Gemfile.lock

@ -501,7 +501,7 @@ DEPENDENCIES
webmock webmock
RUBY VERSION RUBY VERSION
ruby 3.1.2p20 ruby 3.1.4p223
BUNDLED WITH BUNDLED WITH
2.3.14 2.3.14

10
app/components/bulk_upload_error_row_component.html.erb

@ -1,13 +1,13 @@
<div class="x-govuk-summary-card govuk-!-margin-bottom-6"> <div class="govuk-summary-card govuk-!-margin-bottom-6">
<div class="x-govuk-summary-card__header"> <div class="govuk-summary-card__title-wrapper">
<% if lettings? %> <% if lettings? %>
<h3 class="x-govuk-summary-card__title"><strong>Row <%= row %></strong> <%= tenant_code_html %> <%= property_ref_html %></h3> <h3 class="govuk-summary-card__title"><strong>Row <%= row %></strong> <%= tenant_code_html %> <%= property_ref_html %></h3>
<% else %> <% else %>
<h3 class="x-govuk-summary-card__title"><strong>Row <%= row %></strong> <%= purchaser_code_html %></h3> <h3 class="govuk-summary-card__title"><strong>Row <%= row %></strong> <%= purchaser_code_html %></h3>
<% end %> <% end %>
</div> </div>
<div class="x-govuk-summary-card__body"> <div class="govuk-summary-card__content">
<%= govuk_table do |table| %> <%= govuk_table do |table| %>
<% table.head do |head| %> <% table.head do |head| %>
<% head.row do |row| %> <% head.row do |row| %>

8
app/components/check_answers_summary_list_card_component.html.erb

@ -1,12 +1,12 @@
<% if applicable_questions.first %> <% if applicable_questions.first %>
<div class="x-govuk-summary-card govuk-!-margin-bottom-6"> <div class="govuk-summary-card govuk-!-margin-bottom-6">
<% if applicable_questions.first.check_answers_card_number != 0 && applicable_questions.first.check_answers_card_number.present? %> <% if applicable_questions.first.check_answers_card_number != 0 && applicable_questions.first.check_answers_card_number.present? %>
<div class="x-govuk-summary-card__header"> <div class="govuk-summary-card__title-wrapper">
<h3 class="x-govuk-summary-card__title"><%= check_answers_card_title(applicable_questions.first) %></h3> <h3 class="govuk-summary-card__title"><%= check_answers_card_title(applicable_questions.first) %></h3>
</div> </div>
<% end %> <% end %>
<div class="x-govuk-summary-card__body"> <div class="govuk-summary-card__content">
<%= govuk_summary_list do |summary_list| %> <%= govuk_summary_list do |summary_list| %>
<% applicable_questions.each do |question| %> <% applicable_questions.each do |question| %>
<% summary_list.row do |row| %> <% summary_list.row do |row| %>

2
app/frontend/application.js

@ -13,7 +13,7 @@ import 'regenerator-runtime/runtime'
// //
import { initAll as GOVUKFrontend } from 'govuk-frontend' import { initAll as GOVUKFrontend } from 'govuk-frontend'
import { initAll as GOVUKPrototypeComponents } from 'govuk-prototype-components' import { initAll as GOVUKPrototypeComponents } from '@x-govuk/govuk-prototype-components'
import './controllers' import './controllers'
import './cookie-banner' import './cookie-banner'
import './styles/application.scss' import './styles/application.scss'

2
app/frontend/controllers/govukfrontend_controller.js

@ -1,5 +1,5 @@
import { initAll as GOVUKFrontend } from 'govuk-frontend' import { initAll as GOVUKFrontend } from 'govuk-frontend'
import { initAll as GOVUKPrototypeComponents } from 'govuk-prototype-components' import { initAll as GOVUKPrototypeComponents } from '@x-govuk/govuk-prototype-components'
import { Controller } from '@hotwired/stimulus' import { Controller } from '@hotwired/stimulus'
export default class extends Controller { export default class extends Controller {

4
app/views/form/_interruption_screen_question.html.erb

@ -3,8 +3,8 @@
<h1 class="govuk-heading-m"> <h1 class="govuk-heading-m">
Make sure these answers are correct: Make sure these answers are correct:
</h1> </h1>
<div class="x-govuk-summary-card govuk-!-margin-bottom-6"> <div class="govuk-summary-card govuk-!-margin-bottom-6">
<div class="x-govuk-summary-card__body"> <div class="govuk-summary-card__content">
<%= render partial: "form/check_answers_summary_list", locals: { <%= render partial: "form/check_answers_summary_list", locals: {
lettings_log:, lettings_log:,

8
app/views/form/review.html.erb

@ -14,11 +14,11 @@
<h2 class="govuk-heading-m"><%= section.label %></h2> <h2 class="govuk-heading-m"><%= section.label %></h2>
<% section.subsections.map do |subsection| %> <% section.subsections.map do |subsection| %>
<% if total_applicable_questions(subsection, @log, current_user).any? %> <% if total_applicable_questions(subsection, @log, current_user).any? %>
<div class="x-govuk-summary-card govuk-!-margin-bottom-6"> <div class="govuk-summary-card govuk-!-margin-bottom-6">
<div class="x-govuk-summary-card__header"> <div class="govuk-summary-card__title-wrapper">
<h3 class="x-govuk-summary-card__title"><%= subsection.label %></h3> <h3 class="govuk-summary-card__title"><%= subsection.label %></h3>
</div> </div>
<div class="x-govuk-summary-card__body"> <div class="govuk-summary-card__content">
<%= render partial: "form/check_answers_summary_list", locals: { subsection:, questions: total_applicable_questions(subsection, @log, current_user), referrer: "check_answers" } %> <%= render partial: "form/check_answers_summary_list", locals: { subsection:, questions: total_applicable_questions(subsection, @log, current_user), referrer: "check_answers" } %>
</div> </div>
</div> </div>

2
config/cloud_foundry/review_manifest.yml

@ -1,7 +1,7 @@
--- ---
defaults: &defaults defaults: &defaults
buildpacks: buildpacks:
- https://github.com/cloudfoundry/ruby-buildpack.git#v1.8.59 - https://github.com/cloudfoundry/ruby-buildpack.git
processes: processes:
- type: web - type: web
command: bundle exec rake cf:on_first_instance db:migrate db:seed && bin/rails server command: bundle exec rake cf:on_first_instance db:migrate db:seed && bin/rails server

4
docs/setup.md

@ -64,8 +64,8 @@ We recommend using [nvm](https://github.com/nvm-sh/nvm) to manage NodeJS version
4. Install Ruby and Bundler 4. Install Ruby and Bundler
```bash ```bash
rbenv install 3.1.2 rbenv install 3.1.4
rbenv global 3.1.2 rbenv global 3.1.4
source ~/.bashrc source ~/.bashrc
gem install bundler gem install bundler
``` ```

2
manifest.yml

@ -1,7 +1,7 @@
--- ---
defaults: &defaults defaults: &defaults
buildpacks: buildpacks:
- https://github.com/cloudfoundry/ruby-buildpack.git#v1.8.59 - https://github.com/cloudfoundry/ruby-buildpack.git
processes: processes:
- type: web - type: web
command: bundle exec rake cf:on_first_instance db:migrate && bin/rails server command: bundle exec rake cf:on_first_instance db:migrate && bin/rails server

6
package.json

@ -2,7 +2,7 @@
"name": "data-collector", "name": "data-collector",
"private": true, "private": true,
"engines": { "engines": {
"node": "^16.0.0" "node": "^18.0.0"
}, },
"dependencies": { "dependencies": {
"@babel/core": "^7.17.7", "@babel/core": "^7.17.7",
@ -11,6 +11,7 @@
"@hotwired/stimulus": "^3.0.0", "@hotwired/stimulus": "^3.0.0",
"@stimulus/polyfills": "^2.0.0", "@stimulus/polyfills": "^2.0.0",
"@webcomponents/webcomponentsjs": "^2.6.0", "@webcomponents/webcomponentsjs": "^2.6.0",
"@x-govuk/govuk-prototype-components": "^2.0.1",
"accessible-autocomplete": "^2.0.3", "accessible-autocomplete": "^2.0.3",
"babel-loader": "^8.2.3", "babel-loader": "^8.2.3",
"babel-plugin-macros": "^3.1.0", "babel-plugin-macros": "^3.1.0",
@ -19,8 +20,7 @@
"css-loader": "^6.7.1", "css-loader": "^6.7.1",
"custom-event-polyfill": "^1.0.7", "custom-event-polyfill": "^1.0.7",
"file-loader": "^6.2.0", "file-loader": "^6.2.0",
"govuk-frontend": "4.2.0", "govuk-frontend": "4.7.0",
"govuk-prototype-components": "^0.4.0",
"html5shiv": "^3.7.3", "html5shiv": "^3.7.3",
"intersection-observer": "^0.12.0", "intersection-observer": "^0.12.0",
"mini-css-extract-plugin": "^2.6.0", "mini-css-extract-plugin": "^2.6.0",

6
spec/features/form/check_answers_page_lettings_logs_spec.rb

@ -148,14 +148,14 @@ RSpec.describe "Lettings Log Check Answers Page" do
it "does not group questions into summary cards if the questions in the subsection don't have a check_answers_card_number attribute" do it "does not group questions into summary cards if the questions in the subsection don't have a check_answers_card_number attribute" do
visit("/lettings-logs/#{completed_lettings_log.id}/household-needs/check-answers") visit("/lettings-logs/#{completed_lettings_log.id}/household-needs/check-answers")
assert_selector ".x-govuk-summary-card__title", count: 0 assert_selector ".govuk-summary-card__title", count: 0
end end
context "when the user is checking their answers for the household characteristics subsection" do context "when the user is checking their answers for the household characteristics subsection" do
it "they see a separate summary card for each member of the household" do it "they see a separate summary card for each member of the household" do
visit("/lettings-logs/#{completed_lettings_log.id}/#{subsection}/check-answers") visit("/lettings-logs/#{completed_lettings_log.id}/#{subsection}/check-answers")
assert_selector ".x-govuk-summary-card__title", text: "Lead tenant", count: 1 assert_selector ".govuk-summary-card__title", text: "Lead tenant", count: 1
assert_selector ".x-govuk-summary-card__title", text: "Person 2", count: 1 assert_selector ".govuk-summary-card__title", text: "Person 2", count: 1
end end
end end

30
spec/features/form/check_answers_page_sales_logs_spec.rb

@ -36,33 +36,33 @@ RSpec.describe "Sales Log Check Answers Page" do
it "does not group questions into summary cards if the questions in the subsection don't have a check_answers_card_number attribute" do it "does not group questions into summary cards if the questions in the subsection don't have a check_answers_card_number attribute" do
visit("/sales-logs/#{completed_sales_log_joint_purchase.id}/household-needs/check-answers") visit("/sales-logs/#{completed_sales_log_joint_purchase.id}/household-needs/check-answers")
assert_selector ".x-govuk-summary-card__title", count: 0 assert_selector ".govuk-summary-card__title", count: 0
end end
context "when the user is checking their answers for the household characteristics subsection" do context "when the user is checking their answers for the household characteristics subsection" do
context "and the log is for a joint purchase" do context "and the log is for a joint purchase" do
it "they see a separate summary card for each member of the household" do it "they see a separate summary card for each member of the household" do
visit("/sales-logs/#{completed_sales_log_joint_purchase.id}/#{subsection}/check-answers") visit("/sales-logs/#{completed_sales_log_joint_purchase.id}/#{subsection}/check-answers")
assert_selector ".x-govuk-summary-card__title", text: "Buyer 1", count: 1 assert_selector ".govuk-summary-card__title", text: "Buyer 1", count: 1
assert_selector ".x-govuk-summary-card__title", text: "Buyer 2", count: 1 assert_selector ".govuk-summary-card__title", text: "Buyer 2", count: 1
assert_selector ".x-govuk-summary-card__title", text: "Person 1", count: 0 assert_selector ".govuk-summary-card__title", text: "Person 1", count: 0
assert_selector ".x-govuk-summary-card__title", text: "Person 2", count: 0 assert_selector ".govuk-summary-card__title", text: "Person 2", count: 0
assert_selector ".x-govuk-summary-card__title", text: "Person 3", count: 1 assert_selector ".govuk-summary-card__title", text: "Person 3", count: 1
assert_selector ".x-govuk-summary-card__title", text: "Person 4", count: 1 assert_selector ".govuk-summary-card__title", text: "Person 4", count: 1
assert_selector ".x-govuk-summary-card__title", text: "Person 5", count: 1 assert_selector ".govuk-summary-card__title", text: "Person 5", count: 1
end end
end end
context "and the log is for a non-joint purchase" do context "and the log is for a non-joint purchase" do
it "they see a separate summary card for each member of the household" do it "they see a separate summary card for each member of the household" do
visit("/sales-logs/#{completed_sales_log_non_joint_purchase.id}/#{subsection}/check-answers") visit("/sales-logs/#{completed_sales_log_non_joint_purchase.id}/#{subsection}/check-answers")
assert_selector ".x-govuk-summary-card__title", text: "Buyer 1", count: 1 assert_selector ".govuk-summary-card__title", text: "Buyer 1", count: 1
assert_selector ".x-govuk-summary-card__title", text: "Buyer 2", count: 0 assert_selector ".govuk-summary-card__title", text: "Buyer 2", count: 0
assert_selector ".x-govuk-summary-card__title", text: "Person 1", count: 0 assert_selector ".govuk-summary-card__title", text: "Person 1", count: 0
assert_selector ".x-govuk-summary-card__title", text: "Person 2", count: 1 assert_selector ".govuk-summary-card__title", text: "Person 2", count: 1
assert_selector ".x-govuk-summary-card__title", text: "Person 3", count: 1 assert_selector ".govuk-summary-card__title", text: "Person 3", count: 1
assert_selector ".x-govuk-summary-card__title", text: "Person 4", count: 1 assert_selector ".govuk-summary-card__title", text: "Person 4", count: 1
assert_selector ".x-govuk-summary-card__title", text: "Person 5", count: 1 assert_selector ".govuk-summary-card__title", text: "Person 5", count: 1
end end
end end
end end

2
spec/views/bulk_upload_lettings_results/show.html.erb_spec.rb

@ -16,7 +16,7 @@ RSpec.describe "bulk_upload_lettings_results/show.html.erb" do
fragment = Capybara::Node::Simple.new(rendered) fragment = Capybara::Node::Simple.new(rendered)
expect(fragment.find_css(".x-govuk-summary-card__title strong").map(&:inner_text)).to eql(["Row 10", "Row 14"]) expect(fragment.find_css(".govuk-summary-card__title strong").map(&:inner_text)).to eql(["Row 10", "Row 14"])
end end
end end

2
spec/views/bulk_upload_lettings_results/summary.html.erb_spec.rb

@ -16,7 +16,7 @@ RSpec.describe "bulk_upload_lettings_results/summary.html.erb" do
fragment = Capybara::Node::Simple.new(rendered) fragment = Capybara::Node::Simple.new(rendered)
expect(fragment.find_css(".x-govuk-summary-card__title strong").map(&:inner_text)).to eql(["Row 10", "Row 14"]) expect(fragment.find_css(".govuk-summary-card__title strong").map(&:inner_text)).to eql(["Row 10", "Row 14"])
end end
end end

2
spec/views/bulk_upload_sales_results/show.html.erb_spec.rb

@ -16,7 +16,7 @@ RSpec.describe "bulk_upload_sales_results/show.html.erb" do
fragment = Capybara::Node::Simple.new(rendered) fragment = Capybara::Node::Simple.new(rendered)
expect(fragment.find_css(".x-govuk-summary-card__title strong").map(&:inner_text)).to eql(["Row 10", "Row 14"]) expect(fragment.find_css(".govuk-summary-card__title strong").map(&:inner_text)).to eql(["Row 10", "Row 14"])
end end
end end

2
spec/views/bulk_upload_sales_results/summary.html.erb_spec.rb

@ -16,7 +16,7 @@ RSpec.describe "bulk_upload_sales_results/summary.html.erb" do
fragment = Capybara::Node::Simple.new(rendered) fragment = Capybara::Node::Simple.new(rendered)
expect(fragment.find_css(".x-govuk-summary-card__title strong").map(&:inner_text)).to eql(["Row 10", "Row 14"]) expect(fragment.find_css(".govuk-summary-card__title strong").map(&:inner_text)).to eql(["Row 10", "Row 14"])
end end
end end

2
webpack.config.js

@ -40,7 +40,7 @@ module.exports = {
resolve: { resolve: {
alias: { alias: {
'govuk-frontend-styles': path.resolve(__dirname, 'node_modules/govuk-frontend/govuk/all.scss'), 'govuk-frontend-styles': path.resolve(__dirname, 'node_modules/govuk-frontend/govuk/all.scss'),
'govuk-prototype-styles': path.resolve(__dirname, 'node_modules/govuk-prototype-components/x-govuk/all.scss') 'govuk-prototype-styles': path.resolve(__dirname, 'node_modules/@x-govuk/govuk-prototype-components/x-govuk/all.scss')
}, },
modules: ['node_modules', 'node_modules/govuk-frontend/govuk'] modules: ['node_modules', 'node_modules/govuk-frontend/govuk']
}, },

2138
yarn.lock

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save