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

Adding plugin metadata to validator #2297

Merged
merged 5 commits into from
Aug 17, 2023
Merged

Conversation

nataliecarey
Copy link
Contributor

@nataliecarey nataliecarey commented Aug 16, 2023

#2296

The format I've chosen is:

{
  "meta": {
    "description": "text goes here",
    "urls": {
      "documentation": "https://example.com/",
      "releaseNotes": "https://example.com/",
      "versionHistory": "https://example.com/"
    }
  }
}

I'm allowing for two variables in the URLs

{{version}} - the version number of the plugin
{{kitVersion}} - the version number of the kit that's running

I'm using both of these variables in the govuk-prototype-kit project which has the meta set to:

  "meta": {
    "description": "Quickly make interactive, accessible and realistic prototypes of GOV.UK services.",
    "urls": {
      "documentation": "https://prototype-kit.service.gov.uk/?linkFromKit={{kitVersion}}%3A{{version}}",
      "versionHistory": "https://github.com/alphagov/govuk-prototype-kit/releases",
      "releaseNotes": "https://github.com/alphagov/govuk-prototype-kit/releases/tag/v{{version}}"
    }
  }

These variables allow plugin developers to point to release-specific URLs, and also to tailor documentation to the kit version.

I've added ?linkFromKit={{kitVersion}}%3A{{version}} to the kit documentation link so that we can show warnings on the website if we need to later for specific versions.

@nataliecarey nataliecarey changed the title Plugin validator meta Adding plugin metadata to validator Aug 16, 2023
BenSurgisonGDS
BenSurgisonGDS previously approved these changes Aug 17, 2023
Copy link
Contributor

@BenSurgisonGDS BenSurgisonGDS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

errors.push(`meta.urls.${key} doesn't appear to be a public URL`)
}

const unknownVariables = (url.match(/\{\{(\w+)\}\}/g) || []).map(x => `${x}`).filter(variable => !allowedVariables.includes(variable))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Webstorm is reporting Redundant character escape '\}' in RegExp. The url.match can be replaced with url.match(/\{\{(\w+)}}/g)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed, would you mind re-reviewing?

@nataliecarey nataliecarey merged commit ed0a8b2 into main Aug 17, 2023
27 checks passed
@nataliecarey nataliecarey deleted the plugin-validator-meta branch August 17, 2023 14:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants