-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathreact-init.js
More file actions
31 lines (29 loc) · 1.03 KB
/
react-init.js
File metadata and controls
31 lines (29 loc) · 1.03 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
28
29
30
31
'use strict';
const depsMap = require('../deps/deps-map.js');
const installBuilder = require('../deps/install-list-generator.js');
const projectService = require('../service/project-service.js');
const logger = require('../log/logger.js');
module.exports = function init(program, inquirer) {
program
.command('init [app-name]')
.description('create react application with interactive.')
.action((name) => {
inquirer.prompt([
{
type: 'confirm',
name: 'shouldInstallUnitTest',
message: 'Will you write unit tests?'
}
]).then((answers) => {
logger.sayHello();
projectService.createProject(
name,
answers,
installBuilder.generateInstallList(depsMap, answers)
);
logger.sayGoodbye();
}).catch((err) => {
logger.printError(err.stack);
});
});
};