-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtypes.ts
More file actions
43 lines (41 loc) · 1.32 KB
/
types.ts
File metadata and controls
43 lines (41 loc) · 1.32 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
import { Command } from 'commander';
import chalkTemplate from 'chalk-template';
import runTask from '../../tasks/schema/types-task.js';
import { logErrorAndExit } from '../../logging.js';
const types = new Command('types')
.description(
chalkTemplate`Generates {bold TypeScript} type definitions from your {bold JSON Schema} component definitions`
)
.option(
'--components-path <path>',
chalkTemplate`relative path from project root to your components directory, default {bold ./src/components}`,
'src/components'
)
.option(
'--merge-schemas',
chalkTemplate`merge allOf declarations in processed {bold JSON Schemas} / {bold component APIs}, default {bold false}`,
false
)
.option(
'--rc-only',
chalkTemplate`only read configuration from {bold .schema-typesrc.json}, skip prompts`,
true
)
.option(
'--revert',
chalkTemplate`revert command defined by {bold .schema-typesrc.json}, implies {bold --rc-only}`,
false
)
.option('--cleanup', 'clean up tmp dirs before running', true)
.option('--debug', 'show debugging output', false)
.action((options) => {
runTask(
options.componentsPath,
options.mergeSchemas,
options.rcOnly,
options.revert,
options.cleanup,
options.debug
).catch(logErrorAndExit);
});
export default types;