-
Notifications
You must be signed in to change notification settings - Fork 10
/
index.js
executable file
·57 lines (47 loc) · 1.21 KB
/
index.js
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#! /usr/bin/env node
const { Nulla, i18n } = require('./src/modules');
const inquirer = require('inquirer');
const { program } = require('commander');
const { version } = require('./package.json');
program
.name('create-nullstack-app')
.version(version, '-v, --version', version)
program.parse();
let projectName = program.args.map(n => n.trim()).filter(n => n).join('_');
inquirer.prompt([
{
type: 'input',
name: 'projectName',
message: i18n.questionName,
when: () => !projectName
},
{
type: 'list',
name: 'template',
message: i18n.template.questionName,
choices: [
i18n.template.blank,
i18n.template.blankTs,
i18n.template.tawild,
i18n.template.tawildTs,
],
},
])
.then((answers) => {
let isTS = false;
let isTailwind = false;
switch (answers.template) {
case i18n.template.blankTs:
isTS = true;
break;
case i18n.template.tawild:
isTailwind = true;
break;
case i18n.template.tawildTs:
isTS = true;
isTailwind = true;
break;
}
projectName = (projectName || answers.projectName).replace(/ /g, '_').trim();
Nulla.tryRun(projectName, isTS, isTailwind);
});