forked from react-fullstack/slush-react-fullstack
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathreactDispatcher.js
More file actions
27 lines (26 loc) · 1.02 KB
/
reactDispatcher.js
File metadata and controls
27 lines (26 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
module.exports = function (_, conflict, gulp, inquirer, install, mkdirp, rename, template) {
gulp.task('react-dispatcher', function (done) {
var prompts = [{
name: 'dispatcherName',
message: 'What is the name of the new dispatcher?'
}];
//Ask
inquirer.prompt(prompts, function (answers) {
if (!answers) {
return done();
}
answers.slugifiedDispatcherName = _.slugify(answers.dispatcherName);
answers.underscoredDispatcherName = _.underscored(answers.slugifiedDispatcherName);
answers.classifiedDispatcherName = _.classify(answers.underscoredDispatcherName);
gulp.src(__dirname + '/../templates/react-dispatcher/react-dispatcher.js')
.pipe(template(answers, {interpolate: /<\?\?(.+?)\?>/g}))
.pipe(rename(answers.classifiedDispatcherName + '.js'))
.pipe(conflict('client/app/src/dispatchers'))
.pipe(gulp.dest('client/app/src/dispatchers'))
.on('end', function () {
done();
});
});
});
return gulp;
};