-
Notifications
You must be signed in to change notification settings - Fork 4
/
index.js
executable file
·43 lines (35 loc) · 981 Bytes
/
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
#!/usr/bin/env node
'use strict'
const helpers = require('./helpers')
const readline = require('readline')
const names = require('random-tree-names')
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
})
let templates = [
{
name: 'simple',
template: 'A simple node.js script.'
},
{
name: 'API',
template: 'A node.js API using express framework.'
}
]
rl.question('GitHub user name: ', async (userNameAnswer) => {
let projectName = await names.random('de')
rl.question(`Project name (${projectName}): `, async (projectNameAnswer) => {
console.table(templates)
rl.question('Choose a template: ', async (modelAnswer) => {
const data = {
projectName: projectNameAnswer || projectName,
userName: userNameAnswer || 'johnDoe',
year: new Date().getFullYear(),
template: templates[modelAnswer].name,
}
helpers.makeProject(data)
rl.close()
})
})
})