govuk-prototype-kit
govuk-prototype-kit copied to clipboard
Allow plugin authors to explicitly provide a name, organisation and documentation link
Context
The plugins list attempts to infer the origin of a plugin from its npm scope:
In this example we can see that:
-
@ministryofjustice
=> ‘Ministryofjustice’ (should be ‘Ministry of Justice’) -
@xgovuk
=> ‘X-GOV.UK’ (should be ‘X-GOVUK’)
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:
- https://prototype-kit.service.gov.uk/docs/
- https://design-patterns.service.justice.gov.uk
- 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"
],
...
}
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:
- Uniqueness - we won't have 2 plugins with the same name and org name, and
- Some level of verification - we can trust that a certain org on npm are who they claim to be
Any thoughts on those?
How about something like this:
Where
- plugin name is
config.name
elsepackage.name
with existing text transformation applied - hint text is always
package.name
, and something that can’t be altered by a plugin config
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.
nice thanks! We'll continue the conversation in the team and update here. Feel free to add more ideas if you have them!
raised a ticket to discuss as a team: https://github.com/alphagov/govuk-prototype-kit/issues/2222
+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.