alphagov / govuk-prototype-kit

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

Allow plugin authors to explicitly provide a name, organisation and documentation link #2186

Open paulrobertlloyd opened 1 year ago

paulrobertlloyd commented 1 year ago

Context

The plugins list attempts to infer the origin of a plugin from its npm scope:

Screenshot 2023-05-21 at 15 43 19

In this example we can see that:

It should also be noted that while government departments will often change their names, npm organisation scopes may not be updated to match. Or they may use a shortened handle (DLHUC’s GitHub organisation name is communities, for example).

Further still, package names might not be enough to identity a plugin, for example ‘Frontend’,

There is also no link to any documentation related to these plugins. In the above screenshot these would be:

  1. https://prototype-kit.service.gov.uk/docs/
  2. https://design-patterns.service.justice.gov.uk
  3. https://x-govuk.github.io/govuk-prototype-components/

Alternatives

Given that plugins need to include a govuk-prototype-kit.config.json file, allow plugin authors to explicitly declare values for plugin name, organisation and documentation.

For example:

{
  "name": "Ministry of Justice Frontend",
  "organisation": "Ministry of Justice",
  "documentation": "https://design-patterns.service.justice.gov.uk",
  "nunjucksFilters": [
    "/moj/filters/prototype-kit-13-filters.js"
  ],
  "scripts": [
    "/moj/all.jquery.min.js",
    "/moj/init.js"
  ],
  ...
}
joelanman commented 1 year ago

Thanks! Good timing, we are looking into these issues at the moment, great to get your input. I agree naming via config gives more flexibility and control, however some points naming via npm give us:

  1. Uniqueness - we won't have 2 plugins with the same name and org name, and
  2. Some level of verification - we can trust that a certain org on npm are who they claim to be

Any thoughts on those?

paulrobertlloyd commented 1 year ago

How about something like this:

Screenshot 2023-05-23 at 18 57 26

Where

So, without any changes, MOJ Frontend would appear as

Frontend
@ministryofjustice/frontend

But if config.name is provided:

Ministry of Justice Frontend
@ministryofjustice/frontend

With this approach, you wouldn’t need an organisation name in the config, either.

joelanman commented 1 year ago

nice thanks! We'll continue the conversation in the team and update here. Feel free to add more ideas if you have them!

joelanman commented 1 year ago

raised a ticket to discuss as a team: https://github.com/alphagov/govuk-prototype-kit/issues/2222

36degrees commented 1 year ago

+1 to the suggestions above.

Some libraries might want to provide multiple links for documentation or other resources. For example, it might make sense to link from the GOV.UK Frontend plugin to both the Design System and Frontend Docs.