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: add support for v5 of the Design System #528

Merged
merged 10 commits into from
Jan 8, 2024

Conversation

gregtyler
Copy link
Contributor

@gregtyler gregtyler commented Oct 27, 2023

This has now been released in version 2.0.0


This is a work-in-progress to allow services using the MOJPL to test v5 of the Design System

Allows the Pattern Library to be used with v5 of the Design System, and uses v5 by default in the documentation.

Changes

We currently continue to support IE8 by providing a copy of the govuk-if-ie8 mixin which was removed in v5 of the Design System. This is so we can continue to support services which still support IE8 and use v5 of the Design System, though we may also drop support in a subsequent update.

Status

The build is currently failing because of a private peer dependency in govuk-frontend. That is being moved to a dev dependency, which should unblock this build.

@gregtyler gregtyler force-pushed the support-govuk-frontend-5 branch 5 times, most recently from ac6ecf1 to 579ee53 Compare November 3, 2023 17:38
@gregtyler
Copy link
Contributor Author

gregtyler commented Nov 3, 2023

Because govuk-frontend has moved their files (into a dist folder), our current code cannot support both ≤v4 and ≥v5. To mitigate this I've removed the direct import. This means that anyone building our SCSS into their bundle needs to include the govuk-frontend code beforehand which I believe should be commonplace already and, if not, is a one-line fix.

This is a breaking change and makes this a major release. That means this also might be a good opportunity to remove support for IE8 in line with govuk-frontend (our IE8 support is already weakened by some govuk functions removing support themselves).

This might also be a good opportunity to update support for Node versions: Node 16 just left maintenance and the current LTS is Node 20.

@gregtyler gregtyler force-pushed the support-govuk-frontend-5 branch 2 times, most recently from c07764d to 6e19e78 Compare November 3, 2023 17:50
gregtyler added a commit to ministryofjustice/opg-sirius-lpa-frontend that referenced this pull request Nov 6, 2023
Testing with the changes to govuk-frontend in version 5 of the Design System, alongside related changes in MOJ Pattern Library.

NB: to test locally, you must copy the contents of the MOJPL `package` folder from [its WIP branch](ministryofjustice/moj-frontend#528) into a folder in the root of this repo called `./moj-frontend`.

Changes we have to make:
 - Update path of dist files in govuk-frontend
 - Remove `data-module="govuk-details"` (it no longer does anything)
 - Use `[disabled]` attribute rather than `govuk-button--disabled` class (which has been removed)
 - Update body class initialisation

I haven't added `type="module"` to the `<script>` tag because we don't _need_ to, but we might like to do so for closer alignment with GDS guidance.

#major
Allows the Pattern Library to be used with v5 of the Design System, and
uses v5 by default in the documentation.

This currently continues to support IE8 by providing a copy of the
`govuk-if-ie8` mixin.
This is how the GOV.UK Design System recommends installing v5+.
Doing so also ensures that we can support ES modules for our users, and
highlighted an issue with an undefined variable in the Password reveal JavaScript.
Directly requiring individual govuk-frontend SCSS files is risky, as govuk-frontend could
move their internal files and break our compatibility. This has happened in v5 of
govuk-frontend, and we cannot support both ≤v4 and v5 at the same time with the current
method.

Instead, we will require users to separately import govuk-frontend before moj-frontend. In
reality users should already be doing this, as using moj-frontend code without govuk-frontend
will cause an inconsistent UI. Anyone who _isn't_ doing so already will just need a one line
import:

```scss
@import "node_modules/govuk-frontend/dist/govuk/all";
```

To still be able to build our distributable version, which also requires govuk-frontend code
to be built, create a wrapper `dist.scss` with the specific imports required.

BREAKING CHANGE: If you are building moj-frontend from SCSS, you must include govuk-frontend
beforehand
It's the current LTS so we should be using it in tests
Switch to v5.0.0 of `govuk-frontend` now that it has been released
To give people an easier upgrade path rather than needing to do a paired upgrade.

BREAKING CHANGE: if you build your CSS from this package's SCSS, you may need to update your import
path
Stop building IE8 CSS distributions. Remove IE8-specific rules from SCSS.

BREAKING CHANGE: This package no longer provides support for IE8
@ttbarnes
Copy link

@gregtyler Anything I can do to help progress this?

@gregtyler
Copy link
Contributor Author

@ttbarnes If you can try out the pre-release on your service to check it works alongside v5 of the GOV.UK Design System, any feedback would be helpful. I haven't seen much feedback—positive or negative—but if we don't hear anything negative soon then hoping to release in the first weeks of 2024.

@ttbarnes
Copy link

Thank you @gregtyler great stuff. I have just tested the pre-release - we're only using a couple of MOJ components, but all seems great including JS/SCSS compilation alongside the latest GOV design system 👍

@thomasleese
Copy link

We're using the timeline component in our service and it also looks good under this pre-release.

richrace added a commit to ministryofjustice/bichard7-next-ui that referenced this pull request Jan 5, 2024
We have to wait for '@ministryofjustice/frontend' to support 'govuk-frontend' to support v5

Work is going on to support v5 ministryofjustice/moj-frontend#528
@gregtyler gregtyler marked this pull request as ready for review January 8, 2024 10:16
@gregtyler gregtyler requested a review from a team as a code owner January 8, 2024 10:16
@gregtyler gregtyler changed the title [WIP] feat: add support for v5 of the Design System feat: add support for v5 of the Design System Jan 8, 2024
@gregtyler gregtyler merged commit 6bfd2a3 into main Jan 8, 2024
9 checks passed
@gregtyler gregtyler deleted the support-govuk-frontend-5 branch January 8, 2024 10:53
gregtyler pushed a commit that referenced this pull request Jan 8, 2024
# [2.0.0](v1.8.1...v2.0.0) (2024-01-08)

### Features

* add support for v5 of the Design System ([#528](#528)) ([6bfd2a3](6bfd2a3))

### BREAKING CHANGES

* This package no longer supports v3 or v4 of govuk-frontend
* This package no longer supports Internet Explorer 8
@gregtyler
Copy link
Contributor Author

🎉 This PR is included in version 2.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants