Repository navigation
Expand file tree
/
Copy pathquasar
More file actions
executable file
·80 lines (70 loc) · 1.41 KB
/
Copy pathquasar
File metadata and controls
executable file
·80 lines (70 loc) · 1.41 KB
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#!/usr/bin/env node
require('../lib/node-version-check')
require('../lib/helpers/cli-error-handling')
const commands = [
'dev',
'build',
'clean',
'inspect',
'describe',
'ext',
'run',
'mode',
'info',
'new',
'test',
'help'
]
let cmd = process.argv[2]
if (cmd) {
if (cmd.length === 1) {
const mapToCmd = {
d: 'dev',
b: 'build',
e: 'ext',
r: 'run',
c: 'clean',
m: 'mode',
i: 'info',
n: 'new',
t: 'test',
h: 'help'
}
cmd = mapToCmd[cmd]
}
if (commands.includes(cmd)) {
process.argv.splice(2, 1)
}
else {
if (cmd === '-v' || cmd === '--version') {
console.log(require('../package.json').version)
process.exit(0)
}
const { log, warn } = require('../lib/helpers/logger')
if (cmd === '-h' || cmd === '--help') {
cmd = 'help'
}
else if (cmd.indexOf('-') === 0) {
warn(`Command must come before the options`)
cmd = 'help'
}
else {
log(`Looking for Quasar App Extension "${process.argv[2]}" command${(process.argv[3] && (' "' + process.argv[3] + '"')) || ''}`)
const exit = process.exit
process.exit = (code, reason) => {
if (reason === 'ext-missing') {
require('./quasar-help')
exit(0)
}
else {
exit(code)
}
}
cmd = 'run'
}
}
}
else {
cmd = 'help'
}
require(`./quasar-${cmd}`)