-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Utilities for querying and updating the data as a set of files #6585
Comments
Other nice-to-haves that could follow:
|
I added the "Semantic BCD diffs" use case to the list. In general, this suggests that it would be nice to have ways to query or traverse BCD data that maps more closely to its semantics than the literal objects, too. In other words, spare ourselves from having to do a lot of type checking to do routine things such as:
|
This is to not have any doubt about whether other packages can depend on utilities we add for maintaining BCD. In particular, when experimenting with scripts for querying/updating the data it would be nice to know it's internal to BCD only. See mdn#6585.
I've sent some work-in-progress utilities in #9257 and but bringing back some of the discussion here and looping in @Elchi3. Here's what I've found useful in many different contexts and I think we should turn into shared utilities first:
I think we should update @ddbeck is that something you've already written utilities for? |
I haven't messed with wildcards yet, but I've got utility functions for
I've also been playing with a couple of other utilities, though more incomplete:
I'll open a PR with actual code shortly. |
Sounds great @ddbeck! |
OK "shortly" has been a bit longer coming than I anticipated. That said, I did clean things up a little and you can catch a glimpse of what I've already written here: ddbeck/bcd-utils. In addition to the utilities in One thing that I haven't confronted yet: I've got a certain vocabulary for traversing BCD. When I open a PR to add, for instance, |
@ddbeck I would be very happy to see all of that merged into BCD as-is, no need to rename in anticipation of future changes. If we exclude this from the NPM package we can change it quite freely. |
How about we add it under |
I think #9441 resolves this so I'm going to go ahead and close this. It'd be nice to publish the utilities in the future, but that's another issue for another day! |
Background: BCD is organized as a set of JSON files split across many directories, which are combined into a single object with all data for data consumers.
Problem: The mapping from files to a single object is not easily reversible. Code in this repository (linter) and elsewhere (mdn-bcd-collector, mdn-confluence) sometimes wants to work with the data as a whole, but then report on or update the files themselves.
Concrete use cases / examples (please edit to add):
javascript.builtins.Intl.ListFormat.formatToParts
and saving the change to filejavascript/builtins/intl/ListFormat.json
(note "Intl" vs. "intl") (Provide utils to save in-memory BCD to files #3617)something.writeToFile()
and have that work.api.DOMTokenList
is supported ifapi.Element.classList
is and reporting it as an error on api/DOMTokenList.json if not. (Linter: check consistency of dependent features #6571)npm run mirror
already doesInspired by the discussion in #6571 and supersedes #3617.
The text was updated successfully, but these errors were encountered: