-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathindex.ts
More file actions
102 lines (91 loc) · 2.36 KB
/
index.ts
File metadata and controls
102 lines (91 loc) · 2.36 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
import { program } from 'commander';
import { build } from './build.ts';
import { dev } from './dev.ts';
import { fix } from './fix.ts';
import { release } from './release.ts';
import { resnap } from './resnap.ts';
import { test } from './test.ts';
import { withErrorHandling, withTiming } from './util.ts';
program.name('vex').description('vexml dev CLI');
program
.command('dev')
.description('start the demo site dev server')
.action(
withErrorHandling(async () => {
await dev();
})
);
program
.command('fix')
.description('format, lint, and typecheck')
.option('--check', 'check without fixing issues', false)
.action(
withErrorHandling(
withTiming(async (opts: { check: boolean }) => {
await fix({ check: opts.check });
})
)
);
program
.command('test')
.description('run jest in Docker')
.allowUnknownOption(true)
.option('-l, --local', 'run jest locally instead of in Docker', false)
.option('--ci', 'run in CI mode (no TTY, forwards --ci to jest)', false)
.argument('[args...]', 'extra args forwarded to jest', [])
.action(
withErrorHandling(
withTiming(async (args: string[], opts: { local: boolean; ci: boolean }) => {
await test({ local: opts.local, ci: opts.ci, args });
})
)
);
program
.command('resnap')
.description('regenerate obsolete jest image snapshots from origin/master')
.action(
withErrorHandling(async () => {
await resnap();
})
);
const buildCommand = program.command('build').description('build vexml artifacts');
buildCommand
.command('lib')
.description('build the library (types, cjs, esm)')
.action(
withErrorHandling(
withTiming(async () => {
await build.lib();
})
)
);
buildCommand
.command('site')
.description('build the demo site')
.action(
withErrorHandling(
withTiming(async () => {
await build.site();
})
)
);
buildCommand
.command('image')
.description('build the Docker image used for tests')
.action(
withErrorHandling(
withTiming(async () => {
await build.image();
})
)
);
program
.command('release')
.description('publish to npm with a version bump')
.argument('<type>', 'version bump (patch, minor, major)')
.action(
withErrorHandling(async (type: string) => {
await release(type);
})
);
program.parse();