-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathuniform.ts
More file actions
55 lines (53 loc) · 1.71 KB
/
uniform.ts
File metadata and controls
55 lines (53 loc) · 1.71 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
import { Command } from 'commander';
import chalkTemplate from 'chalk-template';
import runTask from '../../tasks/cms/uniform-task.js';
import { logErrorAndExit } from '../../logging.js';
const uniform = new Command('uniform')
.description(
chalkTemplate`Generates {bold Uniform} configuration 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(
'--configuration-path <path>',
chalkTemplate`relative path from project root to the folder where your generated configuration should be stored, default {bold ./src/cms}`,
'src/cms'
)
.option(
'--templates <templateNames...>',
chalkTemplate`components to classify as page templates`,
['page', 'blog-post', 'blog-overview', 'settings']
)
.option(
'--globals <globalNames...>',
chalkTemplate`components to classify as global components`,
['header', 'footer', 'seo']
)
.option(
'--rc-only',
chalkTemplate`only read configuration from {bold .schema-uniformrc.json}, skip prompts`,
true
)
.option(
'--revert',
chalkTemplate`revert command defined by {bold .schema-uniformrc.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.configurationPath,
options.templates,
options.globals,
options.rcOnly,
options.revert,
options.cleanup,
options.debug
).catch(logErrorAndExit);
});
export default uniform;