-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.js
55 lines (53 loc) · 1.17 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
#!/usr/bin/env node
const name = 'create-zigzag-app';
const fs = require('fs-extra');
const path = require('path');
const inquirer = require('inquirer');
const ora = require('ora');
const spinner = ora({
spinner: {
interval: 200,
frames: [
'Downloading...😄',
'Downloading...😝',
]
}
});
inquirer
.prompt({
name,
type: 'list',
message: 'Select one!',
choices: [
'vanilla',
'react',
'react-material-ui',
'nextjs',
'nextjs-material-ui'
]
})
.then((value) => {
const target = value[name];
switch (target) {
case 'vanilla':
case 'react':
spinner.start();
fs.copy(
path.resolve(__dirname, target),
path.resolve(process.cwd(), target)
)
.then(() => {
spinner.stop();
console.log('Success!!');
})
.catch((e) => {
spinner.stop();
console.error(e);
})
.finally(() => process.exit());
break;
default:
console.log(`아직 개발이 안됐어요... ${target} 버전 개발해주세요 :)`);
process.exit();
}
});