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

Add traverse script #4120

Merged
merged 12 commits into from
May 13, 2019
Merged

Add traverse script #4120

merged 12 commits into from
May 13, 2019

Conversation

queengooborg
Copy link
Contributor

After taking the script that @Elchi3 wrote and modifying it for easier browser/value changes, I figured I might as well add yargs into the mix and submit it as an official script. I'm certain it will benefit others as well!

@queengooborg queengooborg added the infra Infrastructure issues (npm, GitHub Actions, releases) of this project label May 9, 2019
@queengooborg queengooborg requested a review from Elchi3 May 9, 2019 18:28
@Elchi3
Copy link
Member

Elchi3 commented May 12, 2019

This is really cool and helps getting lists of things to work on for our year goal.

I wonder if we want to add a folder the argument as well, because currently this only works for css/.
Maybe it could be added at the second position: '$0 <browser> <folder> [value]'

@queengooborg
Copy link
Contributor Author

Oh yeah, that's a really good point, haha! That also makes me think that maybe the folder argument would be optional, so that it checks everything in BCD if not specified. Commit for those changes coming right up!

@Elchi3
Copy link
Member

Elchi3 commented May 12, 2019

The code looks good!
Sorry if it is obvious (I haven't used yargs intensively), but how do I actually provide multiple folders or values with this yargs positional implementation?

@queengooborg
Copy link
Contributor Author

You actually brought up a really good point! I thought that you could just comma-separate it, as that what everyone's saying, but apparently that only works for optional arguments, not positional ones. So, that unfortunately leaves a tiny bit of work for us to do. Comma separation seems to be the most common method, so I'm setting it up to act as such!

Copy link
Member

@Elchi3 Elchi3 left a comment

Choose a reason for hiding this comment

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

Comma separation works for me and feels natural with this positional approach. (I was thinking we might need to change to use named arguments or so, but this is fine with me). Now we just need to make sure we work with proper strings throughout.

scripts/traverse.js Outdated Show resolved Hide resolved
scripts/traverse.js Outdated Show resolved Hide resolved
scripts/traverse.js Outdated Show resolved Hide resolved
scripts/traverse.js Outdated Show resolved Hide resolved
scripts/traverse.js Outdated Show resolved Hide resolved
Co-Authored-By: Florian Scholz <fscholz@mozilla.com>
Copy link
Member

@Elchi3 Elchi3 left a comment

Choose a reason for hiding this comment

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

This is really cool now. I can use it to also query things that will ship in Firefox this month, for example.

npm run traverse firefox api,css,html,http,javascript 67

api.EXT_float_blend
api.InputEvent.data
api.InputEvent.dataTransfer
api.InputEvent.inputType.insertFromPasteAsQuotation
api.Notification.secure_context_required
api.OES_fbo_render_mipmap
api.RTCIceCandidate.usernameFragment
api.RTCIceCandidateInit.usernameFragment
api.WorkerGlobalScope.importScripts.mime_checks
css.at-rules.media.prefers-color-scheme
css.properties.-moz-binding
css.properties.word-break.break-word
css.types.global_keywords.revert
html.elements.iframe.external_protocol_urls_blocked
html.global_attributes.autocomplete.new-password
http.headers.Feature-Policy.display-capture
javascript.builtins.RegExp.@@matchAll
javascript.builtins.String.matchAll
javascript.builtins.Symbol.matchAll
javascript.grammar.hashbang_comments
javascript.statements.import.dynamic_import
javascript.statements.import.dynamic_import
22

@Elchi3 Elchi3 merged commit 33bc6fe into mdn:master May 13, 2019
@queengooborg queengooborg deleted the traverse-script branch May 13, 2019 09:03
@a2sheppy
Copy link
Contributor

The only thing that would make this better -- an option to add smarts that know how to reformat these into the form we'd use in "real life". That is, take "css.properties.word-break.break-word" and turn it into "CSS word-break: break-word" or "CSS word-break property value break-word" or something; or "api.InputEvent.dataTransfer" to "InputEvent.dataTransfer property" or whatever.

@queengooborg queengooborg added the scripts Issues or pull requests regarding the scripts in scripts/. label Jan 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
infra Infrastructure issues (npm, GitHub Actions, releases) of this project scripts Issues or pull requests regarding the scripts in scripts/.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants