Skip to content

Commit

Permalink
Add babel subgenerator
Browse files Browse the repository at this point in the history
  • Loading branch information
fossamagna committed Aug 9, 2018
1 parent e6382d3 commit 6326840
Show file tree
Hide file tree
Showing 10 changed files with 53 additions and 35 deletions.
42 changes: 7 additions & 35 deletions generators/app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,40 +35,12 @@ module.exports = class extends Generator {
});
}

writing() {
this.fs.copyTpl(
this.templatePath('**'),
this.destinationPath(),
{
appName: this.props.appName,
githubUsername: this.props.githubUsername,
name: this.user.git.name(),
email: this.user.git.email()
}
);
this.fs.move(
this.destinationPath('_package.json'),
this.destinationPath('package.json')
);
this.fs.move(
this.destinationPath('_babelrc'),
this.destinationPath('.babelrc')
);
this.fs.move(
this.destinationPath('_gitignore'),
this.destinationPath('.gitignore')
);
this.fs.move(
this.destinationPath('_eslintrc.json'),
this.destinationPath('.eslintrc.json')
);
this.fs.move(
this.destinationPath('_clasp.json'),
this.destinationPath('.clasp.json')
);
}

install() {
this.installDependencies({bower: false});
configuring() {
this.composeWith(require.resolve('../babel'), {
appName: this.props.appName,
githubUsername: this.props.githubUsername,
name: this.user.git.name(),
email: this.user.git.email()
});
}
};
46 changes: 46 additions & 0 deletions generators/babel/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
'use strict';
const Generator = require('yeoman-generator');

module.exports = class extends Generator {

constructor(args, opts) {
super(args, opts);
}

writing() {
this.fs.copyTpl(
this.templatePath('**'),
this.destinationPath(),
{
appName: this.options.appName,
githubUsername: this.options.githubUsername,
name: this.options.name,
email: this.options.email
}
);
this.fs.move(
this.destinationPath('_package.json'),
this.destinationPath('package.json')
);
this.fs.move(
this.destinationPath('_babelrc'),
this.destinationPath('.babelrc')
);
this.fs.move(
this.destinationPath('_gitignore'),
this.destinationPath('.gitignore')
);
this.fs.move(
this.destinationPath('_eslintrc.json'),
this.destinationPath('.eslintrc.json')
);
this.fs.move(
this.destinationPath('_clasp.json'),
this.destinationPath('.clasp.json')
);
}

install() {
this.installDependencies({bower: false});
}
};
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 6326840

Please sign in to comment.