Yeoman generator to setup Babel effortlessly (with plugins, if you want)
JavaScript
Latest commit 95bb6b4 Apr 11, 2016 @iamstarkov Merge pull request #11 from iamstarkov/greenkeeper-ramda-0.21.0
Update ramda to version 0.21.0 🚀
Permalink
Failed to load latest commit information.
generators/app unnest stuff and fix this context issue Mar 13, 2016
.editorconfig init Nov 4, 2015
.eslintrc switch to airbnb-eslint/legacy Nov 4, 2015
.gitattributes init Nov 4, 2015
.gitignore
.travis.yml update travis config Nov 4, 2015
README.md docs: reflect babel-core/register -> babel-register changes in readme Mar 4, 2016
package.json chore(package): update ramda to version 0.21.0 Apr 9, 2016
test.js Revert "rewrite tests" Mar 15, 2016

README.md

generator-babel

NPM version Build Status Dependency Status

Yeoman generator to setup Babel effortlessly (with plugins, if you want).
Works great as cli and with other generators too.

By default, Babel doesn’t do anything! You need to configure it. So this package will create Babel’s configuration file .babelrc with default es2015 preset and install required babel-cli, babel-core to devDependencies in your project.

After this package’s work is finished, you can access babel-cli and babel-register from your npm scripts. It’s useful for:

  • transpilation: babel index.js --out-file index.es5.js
  • testing via hook: mocha --require babel-register, tape test.js --require babel-register, etc.

Install

npm install --global yo generator-babel

Usage

# default es2015 preset
yo babel

# your favorite presets
yo babel es2015 stage-0

# with plugins with --plugins/-p
yo babel -p add-module-exports
yo babel -p transform-strict-mode,transform-object-assign

The entire range of Babel presets are allowed.

Composability

Composability is a way to combine smaller parts to make one large thing. Sort of like Voltron®
Yeoman docs

Just plug in babel into your generator and let it setup your .babelrc and install required devDependencies for you. Everybody wins.

Install

npm install --save generator-babel

Compose

skip-install is used because babel install babel deps for you and you don’t need to test it in your own generator tests.

this.composeWith('babel', { options: {
  'skip-install': this.options['skip-install']
}}, {
  local: require.resolve('generator-babel/generators/app')
});

Add any extra fields you need to options.config to extend the default configuration. The entire range of Babel options are allowed.

this.composeWith('babel', { options: {
  'skip-install': this.options['skip-install'],
  config: {
    presets: ['es2015', 'stage-0'],
    plugins: ['transform-strict-mode', 'transform-object-assign'],
    sourceMaps: true
  }
}}, {
  local: require.resolve('generator-babel')
});

Required list of presets and plugins will be installed to devDependencies into your project with proper names: es2015 will be babel-preset-es2015 and transform-strict-mode will be babel-plugin-transform-strict-mode.

License

MIT © Vladimir Starkov