forked from bytedance/xgplayer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcli.js
executable file
·61 lines (52 loc) · 1.61 KB
/
cli.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
59
60
61
#!/usr/bin/env node
const dev = require('./commands/dev')
const build = require('./commands/build')
const buildDemo = require('./commands/build-demo')
const link = require('./commands/link')
const changelog = require('./commands/changelog')
const release = require('./commands/release')
const cli = require('sade')('libd')
process.on('unhandledRejection', err => {
throw err
})
cli
.command('dev [dir]', 'Start dev server')
.option('-p, --port', 'Dev server port', 8081)
.option('-o, --open', 'Open browser window on startup')
.action((dir, { port, open }) => {
dev(dir, Number(port), open)
})
cli
.command('build [pkg]', 'Build package')
.option('-a, --all', 'build all packages')
.action((pkg, { all }) => {
build(pkg, { all })
})
cli
.command('build-demo <dir>', 'Build demo')
.action((dir) => {
buildDemo(dir)
})
cli
.command('link', 'Link all packages')
.action(() => {
link()
})
cli
.command('changelog', 'Generate or update CHANGELOG.md')
.option('-s, --single', 'monorepo only generates one CHANGELOG.md')
.action(({ single }) => {
changelog(single)
})
cli
.command('release', 'Release packages')
.option('-l, --skipLint', 'Skip lint step')
.option('-t, --skipTest', 'Skip test step')
.option('-b, --skipBuild', 'Skip build step')
.option('-p, --skipPublish', 'Skip publish step')
.option('-s, --buildScript', 'Custom build npm script')
.action(({ skipLint, skipTest, skipBuild, skipPublish, buildScript}) => {
release(skipLint, skipTest, skipBuild, skipPublish, buildScript)
})
cli.version(require('../package.json').version)
cli.parse(process.argv)