MDN Browser Compatibility Data (BCD) on the command line.
npm install mdncomp@2.5.1
A Web Developer's friend showing MDN Browser Compatibility Data (and then some) on the command line.
$ mdncomp html*toblob --current
Shown in various languages (English, Spanish, Norwegian, ...) and using option "--current"
[ cmd high contrast output ] [ cmder output ] [ macOS High Sierra ] [ Linux/Ubuntu 18 ]
Refactored core code with improved search algorithm to get you faster and more flexible to the compatibility data.
Browser Compatibility Data (BCD from Mozilla Developer Network)
Browser status
Additional documentation currently only available in the mdncomp dataset:
Integrated data update mechanism
Set often used options permanently to avoid entering them each time (can be temporary suspended when needed).
Copied text from terminal is easy to paste to Q&A sites, forums etc. to document feature support.
Localized user interface.
Built-in help per mdncomp option.
Cross-platform (where node and npm is available).
Usage documentation included as wiki pages
The -h, --help
output and available options
You can also see help in other languages *.
*) Help needed for translating and improving existing translations.
Make sure to have Node.js 8+ and npm
installed (included with node).
Then install latest version globally:
$ npm i -g mdncomp
Linux and macOS (Darwin) users may have to use the sudo command to install.
To try out current development version:
$ npm i -g https://gitlab.com/epistemex/mdncomp.git
Update weekly or so using the built-in --update
option:
$ mdncomp --update
In case you want to update regardless of there being new data or not you can use forced update:
$ mdncomp --fupdate
Using wildcard:
$ mdncomp j*let.
(the stop-dot ".
" above indicates that the resulting path line should end with this search term.)
Example of wildcard usage
or using the absolute feature path:
$ mdncomp javascript.statements.let
or as an regular expression, for example word-bound searches (\b):
$ mdncomp /\blet\b/
or as a fuzzy-expression (here for api.HTMLCanvasElement.toBlob
):
$ mdncomp -z ahcb.
$ mdncomp ahcb.
Note: From version 2 you can run without the --fuzzy
option: if the term has no results
a second search search pass is performed using the same expression but as a fuzzy term (unless
the term contains wildcards or starts with forward-slash for RegExp).
Search using links for specifications or MDN documentation
From version 2.3 you can use a URL as search term. The scope is either a MDN documentation link or a specification link. The link may contain wildcards, regex etc.
To search using a link make sure:
https://
regardless of wildcard, regex etc. (except in
combination with the "-d, --deep" option).Example using a specification link:
mdncomp https://html.spec.whatwg.org/multipage/scripting.html#dom-canvas-toblob
Example using a wildcard specification link:
mdncomp https://*dom-canvas-toblob
Example using a full documentation link from MDN (locale may be included):
mdncomp https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob
Note: Only features that has a MDN link will have searchable links.
$ mdncomp html*toblob -s
Example of the shorthand option output
You can from version 2 do filtering of the result by simply adding one or several keywords (or search-terms)
to the argument list. For example: this will only list child features containing "stroke" or "fill"
in the CanvasRenderingContext2D
API (using only the last part of the name, here "t2d
"):
$ mdncomp t2d stroke fill
Filtered result list
From version 2 you can define custom columns using the new option "-u, --columns".
Simply specify a comma separated (or space, semi-column, column) list. For example,
a custom column result using search term ("t2d
") and a result filter ("path
"):
mdncomp t2d path -u "chrome,edge,firefox"
Example of a custom header + filter
To get a list of valid browser IDs use the option -b, --browser
.
Tip: See config file section below for how you can store custom columns permanently.
You can navigate using branches and dot notation to find where a feature resides.
To list root simply add the option --list
(or shorthand -l
) with no argument:
mdncomp --list
Example listing valid root branches and statuses
List using one of the root branches:
mdncomp -l webext
Example of listing 1. level branches on a root branch using partial name
You can go to next branch by adding the name of the branch, fully or partly (if unique):
mdncomp -l api.audiobu
or simply by adding the index number in one of the following ways:
mdncomp --list api --index 7
mdncomp --list api -i 7
mdncomp -l api 7
(this usage of shorthand index also applies to the regular search).
One can further filter the result list:
mdncomp -l api window
Example list using additional result filter
List per status, for example: list all features with "experimental" status:
mdncomp -l experimental
Example listing features based on status
mdncomp --browser current
Example showing current browser versions
Tip: You can combine the option with -N, --no-notes
to hide the links at the end.
List release history for a single browser:
mdncomp -Nb edge
Example listing version history of a browser
mdncomp sharedarraybuffer --desc --specs --ext --current
Description and specifications summary example
Here with options -NRF
:
-R
= no-children, -N
= no-notes, -F
= no-flags (also see -h, --help
)
mdncomp sharedbuffer -RNF
Minimal output
The ASCII tables can be pasted directly into a markdown document and will show
as rendered HTML tables in markdown-flavors which support tables - live preview
combined with the unicode
config setting:
DESKTOP > | Chrome | Edge | Firefox | IE | Opera | Safari |
---|---|---|---|---|---|---|
HTMLCanvasElement | 4 | ✓ | 3.6 | 9 | 9° | 3.1 |
captureStream ! | 51 | ? | 43 | ˟ | 36 | ? |
getContext | ✓ | 12 | 3.6 | 9 | 9 | 3.1 |
height | 4 | 12 | 3.6 | 9 | 9 | 3.1 |
mozFetchAsStream x? | ˟ | ˟ | 13-43 | ˟ | ˟ | ˟ |
mozGetAsFile x? | ˟ | ˟ | 4 | ˟ | ˟ | ˟ |
mozOpaque ? | ˟ | ˟ | 3.5 | ˟ | ˟ | ˟ |
toBlob | 50 | ˟ | 19 | 10¹ | 37 | ✓² |
toDataURL | 4 | 12 | 3.6 | 9 | 9 | 4 |
transferControlToOffscreen ! | ˟ | ˟ | 44§ | ˟ | ˟ | ˟ |
width | 4 | 12 | 3.6 | 9 | 9 | 3.1 |
And in compact shorthand format:
BROWSERS > | C | E | F | IE | O | S | C/a | E/m | F/a | O/a | S/i | W/a |
---|---|---|---|---|---|---|---|---|---|---|---|---|
toBlob | 50 | - | 19 | 10* | 37 | Y* | 50 | - | 4 | 37 | - | 50 |
Image quality parameter | 50 | - | 25 | - | Y | - | - | - | 25 | - | ? | 50 |
Feel like exploring? Find new features and APIs using the --random
options:
$ mdncomp --random
combine it with a summary description:
$ mdncomp --random --desc
You can create a limiting scope by providing a keyword or search term. Here, find a random feature that contains "audio" in its path:
$ mdncomp --random audio
Often used options can be permanently stored in a config file in the user's home
directory in JSON format (see option --configpath
to see where it's located).
The use of config file can be suspended at any time with the -G, --no-config
option.
To set or clear an option you can do:
mdncomp --set lang=es
mdncomp --set lang=en-us
A config file is created automatically if none exist.
To clear a setting from the config file use an empty value:
mdncomp --set lang=
mdncomp --set lang
So for example, if you always want a description to be shown:
mdncomp --set desc=true
or if you don't want to see neither hints nor legends:
mdncomp --set expert=2
Using 1 here will disabled hints, but not legends.
To see a list of valid keys that can be used:
mdncomp --set ?
Tip: You can as an alternative, define alias commands in some terminals with specific options set for different purposes.
Note: On macOS/Linux you'll likely have to use sudo
to set options as it writes
to a config file stored in the user area.
sudo mdncomp --set unicode=1
There are a few differences between the mdncomp dataset and the original BCD ref. option -j, --json
:
Since version 2.5 these are now normalized via -j, --json
to be equal to BCD but with these
additional properties:
mdn_summary
which is the summary/seo description from MDN.mdn_title
, the page entry title from MDN.spec_urls
which is an array holding objects for each spec entry, if any.Note that the mdncomp data-format version is still considered alpha as BCD itself is, so this as well as other fields may change in the future.
Tip: To pretty-format and colorize the raw JSON output, you can use for example our tool munk:
mdncomp h*toblob -j | munk
Which gives this result.
Node: 10 (from mdncomp ver 2.5 - was 8 LTS which is still supported).
IDE: JetBrains WebStorm.
Test environments: Windows 8.1+, Linux (Ubuntu), macOS High Sierra
The pre-compiled data and patch repositories can be found here (primary atm) and here (redundancy repo).
This product is provided AS-IS and comes with no support nor warranty. You use it at your own risk. It's continued development depends largely on user interest and feedback.
The primary git repository can be found at GitLab:
Issues that is related to mdncomp itself can be reported here:
However, please don't use the above link to report the following:
Issues with BCD data:
Issues related to the data itself must be reported directly to BCD, or contribute with a PR.
Issues with MDN data:
Issues with MDN titles, missing or erroneous specification links, or errors or missing summary description must be reported or fixed directly at MDN, or simply log in at MDN and edit the page in question yourself.
If you have first verified that the BCD and MDN data are fine (the latter may require you to look at the page source in the page's editor, as well as the JSON version), and you still suspect it is an actual issue with mdncomp, then feel free to report it to GitLab issues via the link provided above.
BCD and MDN data are currently updated weekly.
Copyright (c) 2018 Epistemex
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.