govuk_publishing_components
govuk_publishing_components copied to clipboard
Add checking what components use govuk-frontend to components audit
What
Adds checking to see what components use govuk-frontend to the components audit.
Why
Implemented this to double check that I wasn't missing out any component JS when making changes to applications to support govuk-frontend v5. Thought it could be useful if this was a standard feature in the auditing, so I have opened this PR.
Visual Changes
Before
After
Someone else is adding stuff to the auditing tools 🎉
Bit confused as to the purpose behind this - why do we need to know which applications use components that use govuk-frontend JS? I thought if we included a component JS in an application that included any govuk-frontend JS as well, or is that going to change?
Someone else is adding stuff to the auditing tools 🎉
Bit confused as to the purpose behind this - why do we need to know which applications use components that use govuk-frontend JS? I thought if we included a component JS in an application that included any govuk-frontend JS as well, or is that going to change?
In the approach I'm doing to ensure govuk-frontend isn't evaluated/run by browsers that don't support it (browsers that don't support type="module"), I'm moving the components that use the ES6 JS from govuk-frontend to a different file. This file will then be imported using a type="module" tag so that if browser doesn't support the tag then they won't run the modules.
This information just lets me know what components that are using ES6 need to be moved to a separate file and where they are so I can test them. If we are dividing the upgrading of applications between the teams that are responsible for maintaining them, then I thought others might find this information useful.
In that case can I suggest an alternative approach? Rather than add a whole new section, could you modify the existing 'gem components used by applications' to somehow highlight those components using govuk-frontend? Something like this maybe?
It also might be useful to have this information included in the main 'component files' section, although there's limited width there already so might not be practical.
In that case can I suggest an alternative approach? Rather than add a whole new section, could you modify the existing 'gem components used by applications' to somehow highlight those components using
govuk-frontend? Something like this maybe?
It also might be useful to have this information included in the main 'component files' section, although there's limited width there already so might not be practical.
Ah yep, that makes more sense actually! I'll make that change
@patrickpatrickpatrick would you like a review of this PR?
Ah yes please @andysellick ! Think this will be useful for anyone upgrading to v5 of govuk-frontend.
@patrickpatrickpatrick am closing this but have used it as the basis for https://github.com/alphagov/govuk_publishing_components/pull/4058, thanks for suggesting 👍
