-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
47 lines (44 loc) · 1.01 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
#!/usr/bin/env node
import { createFile, drop, exists, write } from './lib/functions.js'
import inquirer from 'inquirer'
import 'colors'
inquirer.prompt([
{
type: 'input',
name: 'index',
message: 'Enter the main file name (index.js):',
default: 'index.js'
}
])
.then(async answers => {
const vercel = {
version: 2,
builds: [
{
src: answers.index,
use: "@vercel/node"
}
],
routes: [
{
src: "/(.*)",
dest: "/"
}
]
}
exists().then(async (file) => {
if (file === true) {
await drop().then(async () => {
await createFile()
await write(JSON.stringify(vercel)).then(() => {
console.log('[VERXPRESS]: vercel.json file created'.green)
})
})
} else {
await createFile()
await write(JSON.stringify(vercel)).then(() => {
console.log('[Verxpress]: vercel.json file created'.green)
})
}
})
})