generated from react-component/trigger
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathindex.ts
55 lines (52 loc) · 1.3 KB
/
index.ts
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 process from 'process'
import c from 'picocolors'
import { hideBin } from 'yargs/helpers'
import yargs from 'yargs'
import { CROSS, version, name } from './constants'
import { run } from './run'
function header() {
console.log(`\n${c.green(`${name} `)}${c.dim(`v${version}`)}`)
}
const instance = yargs(hideBin(process.argv))
.scriptName(name)
.usage('')
.command(
'*',
'Generate static css',
args => args
.option('output', {
alias: 'o',
description: 'Output file path',
type: 'string',
default: 'antd.min.css'
})
.option('input', {
alias: 'i',
description: 'Input file path',
type: 'string'
})
.option('overwrite', {
alias: 'w',
description: 'Overwrite existing files',
type: 'boolean'
})
.help(),
async (args) => {
header()
console.log()
try {
await run(args)
}
catch (error) {
console.error(c.inverse(c.red(' Failed to generate ')))
console.error(c.red(`${CROSS} ${String(error)}`))
process.exit(1)
}
},
)
.showHelpOnFail(false)
.alias('h', 'help')
.version('version', version)
.alias('v', 'version')
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
instance.help().argv