forked from vechain/nft-registry
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
58 lines (52 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
47
48
49
50
51
52
53
54
55
56
57
58
const { clean, build } = require('./script')
const { lint } = require('./validates')
const { redFont } = require('./utils')
const action = process.argv[2]
const net = process.argv[3]
async function buildAll() {
await clean()
await build('main')
await build('test')
}
async function lintAll() {
await lint('main')
await lint('test')
}
async function execFun(net) {
if (action === '-l') {
if (net === 'all') {
await lintAll()
} else {
await lint(net)
}
} else if (action === '-b') {
if (net === 'all') {
await lintAll()
await buildAll()
} else {
clean()
await lint(net)
await build(net)
}
}
}
async function start() {
switch (net) {
case 'main':
await execFun('main')
break
case 'test':
await execFun('test')
break
case 'clean':
await clean()
break
default:
await execFun('all')
break
}
}
start().catch((error) => {
console.error(redFont(error.message))
process.exit(1)
})