Investigate use of web-features (likely) v3.0.0 schema #63
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
@captainbrosset I played around with consuming data built from web-platform-dx/web-features#3000 and I'm leaving this here mostly to share some notes on what I learned when I tried to do that. I don't expect you'll merge this, in any form.
There are lots of imports directly from
web-features
in lots of places, so there will be lots of places to handle redirects.There are only a few hard-coded references to features. Most of the time this is not a problem, since most features are stable. For the additional data scripts, I suspect that you'll want to warn on simple moves and throw on splits (since the latter requires some decision making).
.eleventy.js
code modifiesfeatures
data directly (as opposed to, for example, wrappingfeature[id]
in an object with getters). Some of that modification won't be necessary (like wrapping spec URLs in arrays) thanks to Change schemastring | string[]
properties tostring[]
web-features#3184. But adding supplementary data this way is kinda painful in a world with redirects, since you need to look at the type of the feature data before modifying it.A possible model for the future would be to centralize the features data and always access there, so common data handling tasks (like appending extra data) can be done once and consistently. I've done it here as a proxy object, just as a demonstration.
In the brief time I spent with this, I wasn't able to figure how to make Eleventy generate a page that redirects to another. I imagine you'll want links to (for example) https://web-platform-dx.github.io/web-features-explorer/features/numeric-seperators/ to not be broken.
Likewise, I wasn't sure of the right way to handle feature splits. It'd be nice to have a disambiguation page, to link to multiple features, but I wasn't sure if the
feature.njk
template should have anif
condition based on the feature'skind
property or if there should be separateordinaryFeatures
andsplits
data objects, with distinct templates. This is mostly a question of style for you.