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

Specify compatibility with govuk-frontend v5 #154

Merged
merged 2 commits into from
Dec 8, 2023

Conversation

frankieroberto
Copy link
Contributor

The plugin works with either v4 or v5 of govuk-frontend

The plugin works with either v4 or v5 of govuk-frontend
@frankieroberto
Copy link
Contributor Author

v5 of govuk-frontend is coming (and can be tested already using a prerelease). The plugin works with v5 already, so we can specify this to avoid these warnings:

npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR! 
npm ERR! While resolving: @x-govuk/[email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/govuk-frontend
npm ERR!   govuk-frontend@"github:alphagov/govuk-frontend#5b2bfde4f" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer govuk-frontend@"^4.1.0" from @x-govuk/[email protected]
npm ERR! node_modules/@x-govuk/govuk-prototype-components
npm ERR!   @x-govuk/govuk-prototype-components@"^2.0.3" from the root project
npm ERR! 
npm ERR! Conflicting peer dependency: [email protected]
npm ERR! node_modules/govuk-frontend
npm ERR!   peer govuk-frontend@"^4.1.0" from @x-govuk/[email protected]
npm ERR!   node_modules/@x-govuk/govuk-prototype-components
npm ERR!     @x-govuk/govuk-prototype-components@"^2.0.3" from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.

Alternatively - we could remove the dependency on govuk-frontend entirely, as we already depend on govuk-prototype-kit which itself depends on govuk-frontend?

cc @paulrobertlloyd @colinrotherham

(I'm a little bit out of my depth on this stuff)

@colinrotherham
Copy link

Thinking about @paulrobertlloyd's comments in #110 a bit more:

Move govuk-frontend to peerDependencies. We need to indicate that this package only works with v4.1.0 or later (due to ESM changes in govuk-frontend and SCSS dependencies).

The warning above is doing exactly as designed, I think?

I'd wonder if you need optionalDependencies but do widen govuk-frontend if you need it at all?

-  "optionalDependencies": {
-    "govuk-prototype-kit": "^13.13.1"
-  },
  "peerDependencies": {
-   "govuk-frontend": "^4.1.0"
+   "govuk-frontend": "^4.1.0 || ^5.0.0"
  },

I'd assume you can temporarily use "^4.0.0 || ^5.0.0 || ^5.0.0-testing" to test out the preview

@colinrotherham
Copy link

Watch out for other plugins requesting govuk-frontend via govuk-prototype-kit too

For example, running npm ls govuk-frontend in govuk-prototype-filters outputs:

@paulrobertlloyd
Copy link
Contributor

Brainy hurty. Meanwhile: alphagov/govuk-frontend#4353

@paulrobertlloyd paulrobertlloyd self-assigned this Oct 27, 2023
@frankieroberto frankieroberto merged commit 21071d6 into main Dec 8, 2023
2 checks passed
@frankieroberto frankieroberto deleted the specify-compatibility-with-govuk-frontend-v5 branch December 8, 2023 16:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

3 participants