1.2.3 • Published 7 years ago

better-babel-cli v1.2.3

Weekly downloads
3
License
ISC
Repository
github
Last release
7 years ago

Better Babel CLI

The babel 6 cli is actively user hostile. They "encourage" you to install it locally for every project. Installing it globally is a waste of time.

Did I mention a local install of babel-cli and nothing else takes up 39 Megabytes? And that doesn't even include any of the plugins that actually make babel useful. Why is that acceptable to anyone?

This is a replacement which includes all the plugins, is global happy, works great on the command-line and in makefiles, doesn't require .babelrc files to configure, and somehow only takes up 20 Megabytes (which is still excessive but that's node for you.)

Install

[sudo] npm uninstall -g babel-cli
[sudo] npm install -g better-babel-cli

Example

You can either run it on the command line or put it in your makefile.

Makefile:

out/%.js : src/%.jsx
    babel --react --es2015 --object-rest-spread -o $@ -- $< 

out/%.js : src/%.js
    babel --es2015 -o $@ -- $< 

Commandline:

babel --verbose --es2015 --stage-0
(reads stdin, writes to stdout)

Use --preset or --plugin to enable transformations. You can also use --no-plugin to disable a plugin (if it was part of a preset, for example.). --foo and --transform-foo are equivalent to require(babel-plugin-transform-foo).

run babel --help, babel --help-presets, or babel --help-plugins to see a list of presets and plugins.

Configuration

Some plugins allow configuration options. Run babel --help-config for details. These may be specified as optional sub-arguments on the command-line.

For example:

babel --transform-es2015-template-literals loose=true,spec=false
babel --transform-es2015-template-literals loose,spec=false

loose is equivalent to loose=true. --loose and --spec set the loose and spec properties, respectively, for all plugins.

--transform-es2015-modules-umd is a special case. This .babelrc

{
  "plugins": [
    ["transform-es2015-modules-umd", {
      "globals": {
        "es6-promise": "Promise"
      }
    }]
  ]
}

is handled as:

babel --transform-es2015-modules-umd es6-promise=Promise,...
babel-corebabel-generatorbabel-helper-builder-react-jsxbabel-helper-regexbabel-helper-vue-jsx-merge-propsbabel-helpersbabel-plugin-check-es2015-constantsbabel-plugin-external-helpersbabel-plugin-infernobabel-plugin-lodashbabel-plugin-minify-builtinsbabel-plugin-minify-constant-foldingbabel-plugin-minify-dead-code-eliminationbabel-plugin-minify-flip-comparisonsbabel-plugin-minify-guarded-expressionsbabel-plugin-minify-infinitybabel-plugin-minify-mangle-namesbabel-plugin-minify-numeric-literalsbabel-plugin-minify-replacebabel-plugin-minify-simplifybabel-plugin-minify-type-constructorsbabel-plugin-mjsxbabel-plugin-syntax-async-functionsbabel-plugin-syntax-async-generatorsbabel-plugin-syntax-class-constructor-callbabel-plugin-syntax-class-propertiesbabel-plugin-syntax-decoratorsbabel-plugin-syntax-do-expressionsbabel-plugin-syntax-dynamic-importbabel-plugin-syntax-exponentiation-operatorbabel-plugin-syntax-export-extensionsbabel-plugin-syntax-flowbabel-plugin-syntax-function-bindbabel-plugin-syntax-function-sentbabel-plugin-syntax-jsxbabel-plugin-syntax-object-rest-spreadbabel-plugin-syntax-trailing-function-commasbabel-plugin-transform-async-functionsbabel-plugin-transform-async-generator-functionsbabel-plugin-transform-async-to-generatorbabel-plugin-transform-async-to-module-methodbabel-plugin-transform-class-constructor-callbabel-plugin-transform-class-propertiesbabel-plugin-transform-decoratorsbabel-plugin-transform-decorators-legacybabel-plugin-transform-do-expressionsbabel-plugin-transform-es2015-arrow-functionsbabel-plugin-transform-es2015-block-scoped-functionsbabel-plugin-transform-es2015-block-scopingbabel-plugin-transform-es2015-classesbabel-plugin-transform-es2015-computed-propertiesbabel-plugin-transform-es2015-destructuringbabel-plugin-transform-es2015-duplicate-keysbabel-plugin-transform-es2015-for-ofbabel-plugin-transform-es2015-function-namebabel-plugin-transform-es2015-instanceofbabel-plugin-transform-es2015-literalsbabel-plugin-transform-es2015-modules-amdbabel-plugin-transform-es2015-modules-commonjsbabel-plugin-transform-es2015-modules-systemjsbabel-plugin-transform-es2015-modules-umdbabel-plugin-transform-es2015-object-superbabel-plugin-transform-es2015-parametersbabel-plugin-transform-es2015-shorthand-propertiesbabel-plugin-transform-es2015-spreadbabel-plugin-transform-es2015-sticky-regexbabel-plugin-transform-es2015-template-literalsbabel-plugin-transform-es2015-typeof-symbolbabel-plugin-transform-es2015-unicode-regexbabel-plugin-transform-es3-member-expression-literalsbabel-plugin-transform-es3-property-literalsbabel-plugin-transform-es5-property-mutatorsbabel-plugin-transform-evalbabel-plugin-transform-exponentiation-operatorbabel-plugin-transform-export-extensionsbabel-plugin-transform-flow-commentsbabel-plugin-transform-flow-strip-typesbabel-plugin-transform-function-bindbabel-plugin-transform-inline-consecutive-addsbabel-plugin-transform-inline-environment-variablesbabel-plugin-transform-jscriptbabel-plugin-transform-member-expression-literalsbabel-plugin-transform-merge-sibling-variablesbabel-plugin-transform-minify-booleansbabel-plugin-transform-node-env-inlinebabel-plugin-transform-object-assignbabel-plugin-transform-object-rest-spreadbabel-plugin-transform-object-set-prototype-of-to-assignbabel-plugin-transform-property-literalsbabel-plugin-transform-proto-to-assignbabel-plugin-transform-react-constant-elementsbabel-plugin-transform-react-display-namebabel-plugin-transform-react-inline-elementsbabel-plugin-transform-react-jsxbabel-plugin-transform-react-jsx-compatbabel-plugin-transform-react-jsx-selfbabel-plugin-transform-react-jsx-sourcebabel-plugin-transform-regeneratorbabel-plugin-transform-regexp-constructorsbabel-plugin-transform-remove-consolebabel-plugin-transform-remove-debuggerbabel-plugin-transform-remove-undefinedbabel-plugin-transform-runtimebabel-plugin-transform-simplify-comparison-operatorsbabel-plugin-transform-strict-modebabel-plugin-transform-undefined-to-voidbabel-plugin-transform-vue-jsxbabel-plugin-undeclared-variables-checkbabel-runtimebabel-templatebabel-traversebabel-typeslodashsysexits
1.2.3

7 years ago

1.2.2

7 years ago

1.2.1

8 years ago

1.2.0

8 years ago

1.1.2

8 years ago

1.1.1

8 years ago

1.1.0

8 years ago

1.0.0

8 years ago