-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathstackbit.ts
More file actions
82 lines (80 loc) · 2.31 KB
/
stackbit.ts
File metadata and controls
82 lines (80 loc) · 2.31 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
import { Command } from 'commander';
import chalkTemplate from 'chalk-template';
import { logErrorAndExit } from '../../logging.js';
const stackbit = new Command('stackbit')
.description(
chalkTemplate`Generates {bold Stackbit} 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(
'--update-config',
chalkTemplate`whether to update existing config if it exists, or overwrite it, default {bold true}`,
true
)
.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(
'--components <componentNames...>',
chalkTemplate`components to classify as bloks`,
[
'cta',
'faq',
'features',
'gallery',
'image-text',
'logos',
'stats',
'teaser-card',
'testimonials',
'text',
'blog-teaser',
]
)
.option(
'--rc-only',
chalkTemplate`only read configuration from {bold .schema-stackbitrc.json}, skip prompts`,
true
)
.option(
'--revert',
chalkTemplate`revert command defined by {bold .schema-stackbitrc.json}, implies {bold --rc-only}`,
false
)
.option('--cleanup', 'clean up tmp dirs before running', true)
.option('--debug', 'show debugging output', false)
.action((options) =>
import('./../../tasks/cms/stackbit-task.js').then((runTask) => {
runTask
.default(
options.componentsPath,
options.configurationPath,
options.updateConfig,
options.templates,
options.globals,
options.components,
options.rcOnly,
options.revert,
options.cleanup,
options.debug
)
.catch(logErrorAndExit);
})
);
export default stackbit;