-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Tweak [AUR] and add static examples #2405
Conversation
@@ -66,17 +67,15 @@ class AurLicense extends BaseAurService { | |||
static get route() { | |||
return { | |||
base: 'aur/license', | |||
format: '(.+)', | |||
capture: ['pkg'], | |||
pattern: ':packageName', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
packageName
for consistency with other badges (and because package
is reserved).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because
package
is reserved
Indeed it is. I'm fairly sure there are some other badges where I used pkg
for this reason when I refactored them but I can't remember what they are.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense. This one used package
in the examples and pkg
in capture
. It'll be simpler to use one or the other, and when we're building a form in the frontend, I suppose package name seems nicer than pkg which is why I went with that.
Generated by 🚫 dangerJS |
Three main goals: 1. In the front end: a. Show form fields and automatically assemble badge URLs (#701) c. Group together examples for the same service b. Show deprecated services 2. Make it easy to changing the schema of `examples`, thanks to 100% validation. One challenge with frameworks is that when there are typos things fail silently which is pretty unfriendly to developers. The validation should really help with that. (This caught one bug in AUR, though I fixed it in #2405 which landed first.) 3. Produce a service definition export for external tool builders. (#776) 4. Build toward harmony between the front-end data structure and the `examples` key in the service classes. I aliased `staticPreview` to `staticExample` which starts this process. The old format: - Lacked a consistent machine-readable representation of the fields. - Flattened multiple examples for the same service were flattened. - Excluded deprecated services. The new format improves a few things, too: - It cleans up the naming. Since this file evolved over time, the names were a bit muddled (i.e. what was an example vs a preview). - It duplicated information (like `.svg`). (I can imagine dropping the `.svg` from our badge URLs someday, which would make the URLs easier to read and maintain.) - For a human reading the YAML file, providing the static example as a deconstructed object is more readable. Here are a couple snippets: ```yml - category: build name: AppVeyorCi isDeprecated: false route: format: '([^/]+/[^/]+)(?:/(.+))?' queryParams: [] examples: - title: AppVeyor example: {path: /appveyor/ci/gruntjs/grunt, queryParams: {}} preview: {label: build, message: passing, color: brightgreen} keywords: [] - title: AppVeyor branch example: {path: /appveyor/ci/gruntjs/grunt/master, queryParams: {}} preview: {label: build, message: passing, color: brightgreen} keywords: [] - category: downloads name: AmoDownloads isDeprecated: false examples: - title: Mozilla Add-on example: {path: /amo/d/dustman, queryParams: {}} preview: {path: /amo/d/dustman, queryParams: {}} keywords: [amo, firefox] ```
Ref #1358 #1961