Declare & install Babel plugins & transforms the easy way
babel-install is convenience for folks who are frequently trying out Babel plugins and presets. It installs and saves them to the appropriate place in your .babelrc and package.json file. It warns you when you're installing a module that has already been saved to your .babelrc. It also allows you to pass the module names using shorhand via CLI flags powered by yargs-parser.
From the command line
npm i babel-install -DE
If you haven't already, add this to your ~/.zshrc or ~/.bashrc and reload your shell. It allows your to run local Node bins as if they were globally installed.
babel-install babel-preset-es2015 babel-plugin-transform-async-to-generator babel-plugin-transform-es2015-arrow-functions# orbabel-install --presets es2015 --plugins transform-async-to-generator transform-es2015-arrow-functions
...which results in
There are several aliases installed to cover common typos
I didn't provide an even shorter command ala
bi to prevent conflicts with other libraries. However, if you'd like a shorter command, I recommend creating an alias.
You can specify specific versions of Babel modules using both the full and short forms. E.g.
babel-install --plugins firstname.lastname@example.org # is the same as babel-install email@example.com
Install pre-commit hook
npm run install-precommit
- Evaluating adding a
--transformsflag that's a special subset of