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

I scratched my own itch (again) and built a command line tool for “CanIUse …”.


This content originally appeared on Bram.us and was authored by Bramus!

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.

~


This content originally appeared on Bram.us and was authored by Bramus!


Print Share Comment Cite Upload Translate Updates
APA

Bramus! | Sciencx (2024-09-14T21:27:40+00:00) Introducing @bramus/caniuse-cli, a CLI tool for “Can I Use …”. Retrieved from https://www.scien.cx/2024/09/14/introducing-bramus-caniuse-cli-a-cli-tool-for-can-i-use/

MLA
" » Introducing @bramus/caniuse-cli, a CLI tool for “Can I Use …”." Bramus! | Sciencx - Saturday September 14, 2024, https://www.scien.cx/2024/09/14/introducing-bramus-caniuse-cli-a-cli-tool-for-can-i-use/
HARVARD
Bramus! | Sciencx Saturday September 14, 2024 » Introducing @bramus/caniuse-cli, a CLI tool for “Can I Use …”., viewed ,<https://www.scien.cx/2024/09/14/introducing-bramus-caniuse-cli-a-cli-tool-for-can-i-use/>
VANCOUVER
Bramus! | Sciencx - » Introducing @bramus/caniuse-cli, a CLI tool for “Can I Use …”. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2024/09/14/introducing-bramus-caniuse-cli-a-cli-tool-for-can-i-use/
CHICAGO
" » Introducing @bramus/caniuse-cli, a CLI tool for “Can I Use …”." Bramus! | Sciencx - Accessed . https://www.scien.cx/2024/09/14/introducing-bramus-caniuse-cli-a-cli-tool-for-can-i-use/
IEEE
" » Introducing @bramus/caniuse-cli, a CLI tool for “Can I Use …”." Bramus! | Sciencx [Online]. Available: https://www.scien.cx/2024/09/14/introducing-bramus-caniuse-cli-a-cli-tool-for-can-i-use/. [Accessed: ]
rf:citation
» Introducing @bramus/caniuse-cli, a CLI tool for “Can I Use …” | Bramus! | Sciencx | https://www.scien.cx/2024/09/14/introducing-bramus-caniuse-cli-a-cli-tool-for-can-i-use/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.