Introducing @bramus/caniuse-cli, a CLI tool for “Can I Use …”

Last week I scratched my own itch (again) and built a (offline!) command line tool for “CanIUse …” and MDN’s browser-compat-data.

~

Installation and Usage

You can install @bramus/caniuse-cli through NPM (or whatever package manager you are using).

npm i -g @bramus/caniuse-cli

Once installed, you can call caniuse on the command line. The passed in argument is your search term.

caniuse viewport-units

The package differs from other attempts at this by not only using caniuse-db but by also integrating @mdn/browser-compat-data. That means you can also query for things like the upcoming calc-size() or @property.

caniuse calc-size
caniuse @property

Because both datasets are stored locally, @bramus/caniuse-cli requires no live internet connection once installed.

Furthermore it also collapses the releases in the output table, just like the “CanIUse …” website does it.

~

Source code

The source code is available on GitHub. PRs very welcome as this was thrown together in a jiffy, hacking on the original by @dsenkus.

One area I am specifically looking help for, is a way to provide an auto-update mechanism for the datasets. I think I have a solution for this, but I’m sure it could be done better – especially because my approach is limited to Node’s npm only.

~

Spread the word

Feel free to repost one of the posts from social media to give them more reach, or link to this post from your own blog.

~

Published by Bramus!

Bramus is a frontend web developer from Belgium, working as a Chrome Developer Relations Engineer at Google. From the moment he discovered view-source at the age of 14 (way back in 1997), he fell in love with the web and has been tinkering with it ever since (more …)

Unless noted otherwise, the contents of this post are licensed under the Creative Commons Attribution 4.0 License and code samples are licensed under the MIT License

Join the Conversation

1 Comment

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.