Tool for creating and working with MDN's GroupData.json
file. Eventually I'd like this to have an assortment of commands to manage these files but for now it only has one subcommand: taking a specification, pulling out the WebIDL, and generating the GroupData.json
formatted data for it.
Before you can use gdtool
, you need to install the dependencies:
npm install
To install gdtool
as a globally available command line tool:
npm intall -g
gdtool generate <specification> [options]
-v
,--version
: Outputs the version number ofgdtool
-a <name>
,--api-name <name>
: Specifies the name to give the API in the output JSON. This should correspond to the name of the specification-c <mode>
,--callback-mode <mode>
: Specifies how and if to include callbacks in the output. Possible values areignore
(don't include callbacks),type
(include callbacks as members of the "types" list), orcallback
(include callbacks in a seaprate "callbacks" list)-o <file>
,--output-file <file>
: Sets the name of the file to create with the generated GroupData format content; if not specified, the output goes tostdout
-h
,--help
: Outputs usage information
gdtool generate localfile.webidl
This outputs to console the GroupData.json
formatted JSON that represents the contents of the WebIDL found in localfile.webidl
.
gdtool generate -a "WebRTC" -o webrtc.json -c type https://w3c.github.io/webrtc-pc/
Creates a file named webrtc.json
containing the GroupData.json
data for the WebRTC API, fetching the specification directly from the current editor's draft on the Web. The API name is set to "WebRTC", and callbacks are included among the "types"
rather than having their own section.