/
run.js
55 lines (48 loc) · 1.12 KB
/
run.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
import {
defaultResolveConfig,
build,
start,
watch,
runTestcafe,
merge
} from 'resolve-scripts'
import appConfig from './config.app'
import devConfig from './config.dev'
import prodConfig from './config.prod'
import testFunctionalConfig from './config.test_functional'
const launchMode = process.argv[2]
void (async () => {
switch (launchMode) {
case 'dev': {
await watch(merge(defaultResolveConfig, appConfig, devConfig))
break
}
case 'build': {
await build(merge(defaultResolveConfig, appConfig, prodConfig))
break
}
case 'start': {
await start(merge(defaultResolveConfig, appConfig, prodConfig))
break
}
case 'test:functional': {
await runTestcafe({
resolveConfig: merge(
defaultResolveConfig,
appConfig,
testFunctionalConfig
),
functionalTestsDir: 'test/functional',
browser: process.argv[3]
})
break
}
default: {
throw new Error('Unknown option')
}
}
})().catch(error => {
// eslint-disable-next-line no-console
console.log(error)
process.exit(1)
})