forked from react-fullstack/slush-react-fullstack
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathreactStore.js
More file actions
27 lines (26 loc) · 971 Bytes
/
reactStore.js
File metadata and controls
27 lines (26 loc) · 971 Bytes
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-store', function (done) {
var prompts = [{
name: 'storeName',
message: 'What is the name of the new store?'
}];
//Ask
inquirer.prompt(prompts, function (answers) {
if (!answers) {
return done();
}
answers.slugifiedStoreName = _.slugify(answers.storeName);
answers.underscoredStoreName = _.underscored(answers.slugifiedStoreName);
answers.classifiedStoreName = _.classify(answers.underscoredStoreName);
gulp.src(__dirname + '/../templates/react-store/react-store.js')
.pipe(template(answers, {interpolate: /<\?\?(.+?)\?>/g}))
.pipe(rename(answers.classifiedStoreName + '.js'))
.pipe(conflict('client/app/src/stores'))
.pipe(gulp.dest('client/app/src/stores'))
.on('end', function () {
done();
});
});
});
return gulp;
};