govuk_publishing_components icon indicating copy to clipboard operation
govuk_publishing_components copied to clipboard

Add checking what components use govuk-frontend to components audit

Open patrickpatrickpatrick opened this issue 2 years ago • 6 comments

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

Screenshot 2023-11-14 at 14 50 07

After

Screenshot 2023-11-14 at 14 49 55

patrickpatrickpatrick avatar Nov 14 '23 10:11 patrickpatrickpatrick

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?

andysellick avatar Nov 14 '23 10:11 andysellick

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.

patrickpatrickpatrick avatar Nov 14 '23 11:11 patrickpatrickpatrick

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?

Screenshot 2023-11-14 at 11 58 47

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.

andysellick avatar Nov 14 '23 12:11 andysellick

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?

Screenshot 2023-11-14 at 11 58 47

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 avatar Nov 14 '23 12:11 patrickpatrickpatrick

@patrickpatrickpatrick would you like a review of this PR?

andysellick avatar Jan 08 '24 14:01 andysellick

Ah yes please @andysellick ! Think this will be useful for anyone upgrading to v5 of govuk-frontend.

patrickpatrickpatrick avatar Jan 08 '24 15:01 patrickpatrickpatrick

@patrickpatrickpatrick am closing this but have used it as the basis for https://github.com/alphagov/govuk_publishing_components/pull/4058, thanks for suggesting 👍

andysellick avatar Jun 12 '24 12:06 andysellick