alphagov / govuk-prototype-kit

Rapidly create HTML prototypes of GOV.UK services
https://prototype-kit.service.gov.uk
MIT License
306 stars 236 forks source link

Migration script does not always migrate `app/views/includes/{head, scripts}.html` #1817

Closed lfdebrux closed 1 year ago

lfdebrux commented 1 year ago

Description of the issue

When running npx govuk-prototype-kit@13.0.0 migrate in a prototype which has modified app/views/layout.html, the migration script won't try and migrate the file app/views/includes/head.html or app/views/includes/scripts.html. This could lead users who try to complete the migration on their own to not realise that they also need to update those files.

Steps to reproduce the issue

  1. Create a new v12 prototype
  2. Change app/views/layout.html, app/views/includes/head.html, and app/views/includes/scripts.html
  3. Run npx govuk-prototype-kit@13.0.0 migrate

Actual vs expected behaviour

I expect to see app/views/layout.html, app/views/includes/head.html, and app/views/includes/scripts.html mentioned in the output of the migration script, however only app/views/layout.html is mentioned.

Environment (where applicable)

BenSurgisonGDS commented 1 year ago

I have run this migrate several times and the output when the script.html and head.html are changed is as follows:

Migrating your prototype to v13

added 796 packages in 10s

27 packages are looking for funding
  run `npm fund` for details
Succeeded [Migrate config.js to config.json]
Succeeded [Delete /home/ben/GDS/govuk-prototype-kit-12.3.0/start.js]
Succeeded [Delete /home/ben/GDS/govuk-prototype-kit-12.3.0/VERSION.txt]
Succeeded [Delete /home/ben/GDS/govuk-prototype-kit-12.3.0/Procfile]
Succeeded [Delete /home/ben/GDS/govuk-prototype-kit-12.3.0/server.js]
Succeeded [Delete /home/ben/GDS/govuk-prototype-kit-12.3.0/listen-on-port.js]
Succeeded [Delete /home/ben/GDS/govuk-prototype-kit-12.3.0/app/assets/sass/application-ie8.scss]
Succeeded [Delete /home/ben/GDS/govuk-prototype-kit-12.3.0/app/assets/sass/unbranded-ie8.scss]
Succeeded [Deleted files that are no longer needed]
Succeeded [Delete app/assets/images/separator-2x.png]
Succeeded [Delete app/assets/images/unbranded.ico]
Succeeded [Delete app/assets/images/separator.png]
Succeeded [Delete app/views/includes/breadcrumb_examples.html]
Succeeded [Delete app/assets/sass/patterns/_contents-list.scss]
Succeeded [Delete app/assets/sass/unbranded.scss]
Succeeded [Delete app/assets/sass/patterns/_mainstream-guide.scss]
Succeeded [Delete app/assets/javascripts/jquery-1.11.3.js]
Succeeded [Delete app/assets/sass/patterns/_pagination.scss]
Succeeded [Delete app/assets/sass/patterns/_related-items.scss]
Succeeded [Delete app/assets/sass/patterns/_task-list.scss]
Succeeded [Delete app/assets/javascripts/auto-store-data.js]
Succeeded [Delete app/views/layout_unbranded.html]
Succeeded [Update application SCSS file]
Succeeded [Overwrite app/filters.js]
Succeeded [Remove unused directory lib]
Succeeded [Overwrite app/assets/javascripts/application.js]
Succeeded [Update routes file]
Succeeded [Remove unused directory docs]
Succeeded [Deleted directories that are no longer needed]
Failed [Delete app/views/includes/head.html]
Failed [Delete app/views/includes/scripts.html]
Succeeded [Remove old pattern includes from application SCSS file]
Succeeded [Remove empty directory /app/assets/sass/patterns]
Succeeded [Remove empty directory /app/assets/images]

The script is unable to fully migrate your prototype to version 13.

Contact the GOV.UK Prototype team for support.

https://prototype-kit.service.gov.uk/docs/support

The following messages in the above clearly state that the files have failed to be deleted. Is this not enough of a message?:

Failed [Delete app/views/includes/head.html]
Failed [Delete app/views/includes/scripts.html]
BenSurgisonGDS commented 1 year ago

This has now been fixed in the case where changes have been made to layout.html and the includes head.html and script.html.

Result is now as follows:

npx --package=alphagov/govuk-prototype-kit#migration-script-will-now-report-head-and-script-failures govuk-prototype-kit migrate
Need to install the following packages:
  github:alphagov/govuk-prototype-kit#migration-script-will-now-report-head-and-script-failures
Ok to proceed? (y) 
Succeeded [Check migration is being applied to a pre v13 prototype]
Migrating your prototype to v13

added 796 packages in 11s

27 packages are looking for funding
  run `npm fund` for details
Succeeded [Migrate config.js to config.json]
Succeeded [Delete server.js]
Succeeded [Delete start.js]
Succeeded [Delete VERSION.txt]
Succeeded [Delete listen-on-port.js]
Succeeded [Delete Procfile]
Succeeded [Delete app/assets/sass/application-ie8.scss]
Succeeded [Delete app/assets/sass/unbranded-ie8.scss]
Failed [Overwrite app/views/layout.html]
Succeeded [Deleted files that are no longer needed]
Succeeded [Delete app/assets/images/separator-2x.png]
Succeeded [Delete app/assets/images/separator.png]
Succeeded [Delete app/assets/images/unbranded.ico]
Succeeded [Delete app/assets/sass/unbranded.scss]
Succeeded [Delete app/views/includes/breadcrumb_examples.html]
Succeeded [Delete app/assets/sass/patterns/_mainstream-guide.scss]
Succeeded [Delete app/assets/javascripts/auto-store-data.js]
Succeeded [Delete app/assets/javascripts/jquery-1.11.3.js]
Succeeded [Delete app/assets/sass/patterns/_pagination.scss]
Succeeded [Delete app/assets/sass/patterns/_related-items.scss]
Succeeded [Delete app/assets/sass/patterns/_task-list.scss]
Succeeded [Delete app/assets/sass/patterns/_contents-list.scss]
Succeeded [Delete app/views/layout_unbranded.html]
Succeeded [Update application SCSS file]
Failed [Delete app/views/includes/scripts.html]
Failed [Delete app/views/includes/head.html]
Succeeded [Overwrite app/filters.js]
Succeeded [Remove unused directory lib]
Succeeded [Overwrite app/assets/javascripts/application.js]
Succeeded [Remove unused directory docs]
Succeeded [Deleted directories that are no longer needed]
Succeeded [Update routes file]
Succeeded [Remove old pattern includes from application SCSS file]
Succeeded [Remove empty directory app/assets/sass/patterns]
Succeeded [Remove empty directory app/assets/images]

The script is unable to fully migrate your prototype to version 13.

Contact the GOV.UK Prototype team for support.

https://prototype-kit.service.gov.uk/docs/support
BenSurgisonGDS commented 1 year ago

Please note that now all three files are reported:

Failed [Overwrite app/views/layout.html]
Failed [Delete app/views/includes/scripts.html]
Failed [Delete app/views/includes/head.html]