New Sep 14, 2024

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

More Front-end Bloggers All from Bram.us View Introducing @bramus/caniuse-cli, a CLI tool for “Can I Use …” on bram.us

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.

 

 

~

Scroll to top