Skip to content

Commit

Permalink
Add babel prepublish step
Browse files Browse the repository at this point in the history
  • Loading branch information
SBoudrias committed Jul 11, 2015
1 parent e6b927e commit 49d1816
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
8 changes: 7 additions & 1 deletion generators/babel/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,16 @@
var generators = require('yeoman-generator');

module.exports = generators.Base.extend({
initializing: function () {
writing: function () {
this.fs.copy(
this.templatePath('babelrc'),
this.destinationPath('.babelrc')
);

var pkg = this.fs.readJSON(this.destinationPath('package.json'), {});
pkg.script = pkg.script || {};
pkg.script.prepublish = 'gulp babel';

this.fs.writeJSON(this.destinationPath('package.json'), pkg);
}
});
4 changes: 4 additions & 0 deletions test/babel.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,8 @@ describe('node:babel', function () {
it('creates .babelrc', function () {
assert.file('.babelrc');
});

it('setup prepublish step', function () {
assert.fileContent('package.json', '"prepublish": "gulp babel"');
});
});

0 comments on commit 49d1816

Please sign in to comment.