'use strict';
var _ = require('lodash');
var generators = require('yeoman-generator');

module.exports = generators.Base.extend({
  writing: {
    package: function () {
      var pkg = this.fs.readJSON(this.destinationPath('package.json'), {});

      pkg.devDependencies = pkg.devDependencies || {};

      _.extend(pkg.devDependencies, {meow: '^3.3.0'});
      _.extend(pkg, {
        bin: this.options.babel ? 'dist/cli.js' : 'lib/cli.js'
      });

      this.fs.writeJSON(this.destinationPath('package.json'), pkg);
    },

    cli: function () {
      this.fs.copyTpl(
        this.templatePath('cli.js'),
        this.destinationPath('lib/cli.js'), {
          pkgSafeName: _.camelCase(this.options.name),
          babel: this.options.babel
        }
      );
    }
  }
});

@@ -123,16 +123,342 @@
 xtend(%7B%0A
+  constructor: function () %7B%0A    generators.Base.apply(this, arguments);%0A%0A    this.option('name', %7B%0A      type: String,%0A      required: true,%0A      desc: 'The module name'%0A    %7D);%0A%0A    this.option('babel', %7B%0A      type: Boolean,%0A      required: false,%0A      defaults: false,%0A      desc: 'pre-compile with Babel'%0A    %7D);%0A  %7D,%0A%0A
   writin

Define options in node:cli