MDN Browser Compatibility Data (BCD) on the command line.


Keywords
mdn, developer, docs, browser, compatibility, data, cli, terminal, bcd, specs
License
MIT
Install
npm install mdncomp@2.5.1

Documentation

mdncompnx

npm Monthly Downloads from NPM

A Web Developer's friend showing MDN Browser Compatibility Data (and then some) on the command line.

$ mdncomp html*toblob --current

xterm color + languages output
Shown in various languages (English, Spanish, Norwegian, ...) and using option "--current"

[ cmd high contrast output ] [ cmder output ] [ macOS High Sierra ] [ Linux/Ubuntu 18 ]

Features

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)

    • Search APIs, CSS, HTML, HTTP, JavaScript, MathML, SVG, WebDriver, WebExtensions, XPath and XSLT.
    • Search and list features using keywords, paths, wildcards, fuzzy terms or regular expressions.
    • Search case (in)sensitive.
    • Deep Search option (wildcard search in notes, flags, alternative names, prefixes, links etc.).
    • Search using MDN documentation or specification links as search term incl. wildcards
    • Navigate and show information using path and branches.
    • Filter result lists using additional search terms.
    • Show result using custom defined browser list.
    • Include children features in table results.
    • Output data as ANSI colored text or as monochrome.
    • Outputs Markdown compatible tables (for MD flavors supporting tables)
    • Get feature status (standard, experimental or deprecated).
    • Show notes, flags, vendor prefixes, history and security issues.
    • Show additional links for information in notes.
    • Show optional detailed API specific support for a sub-feature (Worker support, SharedArrayBuffer support, CORS support, blob data, service workers etc.).
    • Sectioned tables for desktop, mobile and other browsers.
    • Show information for Node.js where relevant.
    • Show current browser versions directly in table output
    • Output as JSON raw data incl. specification list and summary description
    • Works offline
  • Browser status

    • List current browser versions
    • List current, esr, beta, nightly, planned and retired versions per browser.
    • List current, esr, beta, nightly, planned and retired versions per status.
    • List status and release dates per browser, including release notes (if any).
  • Additional documentation currently only available in the mdncomp dataset:

    • Show MDN documentation title (WIP at MDN) per feature
    • Show a optional summary description per feature
    • Includes a verified URL to the feature's documentation page on MDN
    • Show standards/specification references, status and links (W3C, WHATWG, KHRONOS, ECMA, IETF etc.)
  • Integrated data update mechanism

    • Fast update using "precompiled" compatibility data with additional data (summary description, specs, MDN title)
    • Compressed data transfers
  • 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

Options
The -h, --help output and available options

You can also see help in other languages *.


*) Help needed for translating and improving existing translations.


Installation

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

Data Update

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 

Examples

Using wildcard:

$ mdncomp j*let.

(the stop-dot "." above indicates that the resulting path line should end with this search term.)

wildcard example
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:

  • the URL is starting with https:// regardless of wildcard, regex etc. (except in combination with the "-d, --deep" option).
  • for specification links: it contains a hash part (e.g. "...#dom-canvas-toblob").

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.

Show data in a compact shorthand format using option `-s, --shorthand`:

$ mdncomp html*toblob -s

Shorthand format
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

example local filter
Filtered result list

List results using Custom Columns

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 custom header + filter
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.

List feature branches and status

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 of root list
Example listing valid root branches and statuses

List using one of the root branches:

mdncomp -l webext

example list an api
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

snapshot list with filter
Example list using additional result filter

List per status, for example: list all features with "experimental" status:

mdncomp -l experimental

example list on status
Example listing features based on status

List current browser versions:

mdncomp --browser current

example show current browsers
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 on browser
Example listing version history of a browser

Rich output with additional options

mdncomp sharedarraybuffer --desc --specs --ext --current

Description and specifications summary example
Description and specifications summary example

Or as minimal, turning off extra information

Here with options -NRF:

-R = no-children, -N = no-notes, -F = no-flags (also see -h, --help)

mdncomp sharedbuffer -RNF

Minimalistic example
Minimal output

Markdown enabled tables

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 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

Exploration

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

Global Configuration

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

A Note On JSON Output

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:

  • mdncomp adds property mdn_summary which is the summary/seo description from MDN.
  • mdncomp adds property mdn_title, the page entry title from MDN.
  • mdncomp adds property 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.

Development Environment

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).

Contributors

Support

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

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.

License

MIT License

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.

Epistemex