npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

generator-babel

v2.0.2

Published

Yeoman generator to setup Babel effortlessly (with plugins, if you want)

Downloads

27

Readme

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