storyblok 4.10.0 → 4.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/config/index.d.mts +207 -0
- package/dist/config/index.d.ts +207 -0
- package/dist/config/index.mjs +6 -0
- package/dist/config/index.mjs.map +1 -0
- package/dist/index.mjs +708 -111
- package/dist/index.mjs.map +1 -1
- package/package.json +17 -4
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
declare const regionCodes: readonly ["eu", "us", "cn", "ca", "ap"];
|
|
2
|
+
type RegionCode = typeof regionCodes[number];
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Interface representing the default options for a CLI command.
|
|
6
|
+
*/
|
|
7
|
+
interface CommandOptions {
|
|
8
|
+
/**
|
|
9
|
+
* Indicates whether verbose output is enabled.
|
|
10
|
+
*/
|
|
11
|
+
verbose: boolean;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Interface representing the options for the `components pull` command.
|
|
16
|
+
*/
|
|
17
|
+
interface PullComponentsOptions extends CommandOptions {
|
|
18
|
+
/**
|
|
19
|
+
* The filename to save the file as.
|
|
20
|
+
* Defaults to `components`. The file will be saved as `<filename>.<space>.json`.
|
|
21
|
+
* @default `components
|
|
22
|
+
*/
|
|
23
|
+
filename?: string;
|
|
24
|
+
/**
|
|
25
|
+
* The suffix to add to the filename.
|
|
26
|
+
* Defaults to the space ID.
|
|
27
|
+
* @default space
|
|
28
|
+
*/
|
|
29
|
+
suffix?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Indicates whether to save each component to a separate file.
|
|
32
|
+
* @default false
|
|
33
|
+
*/
|
|
34
|
+
separateFiles?: boolean;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
interface PushComponentsOptions extends CommandOptions {
|
|
38
|
+
/**
|
|
39
|
+
* The glob pattern filter to apply to components before pushing.
|
|
40
|
+
* Matching components and all their dependencies (groups, tags, other components)
|
|
41
|
+
* will be collected and pushed together.
|
|
42
|
+
* @default `.*`
|
|
43
|
+
*/
|
|
44
|
+
filter?: string;
|
|
45
|
+
/**
|
|
46
|
+
* Indicates whether to save each component to a separate file.
|
|
47
|
+
* @default false
|
|
48
|
+
*/
|
|
49
|
+
separateFiles?: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* The source space id.
|
|
52
|
+
*/
|
|
53
|
+
from?: string;
|
|
54
|
+
/**
|
|
55
|
+
* Suffix to add to the component name.
|
|
56
|
+
*/
|
|
57
|
+
suffix?: string;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
interface MigrationsGenerateOptions extends CommandOptions {
|
|
61
|
+
suffix?: string;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
interface MigrationsRunOptions extends CommandOptions {
|
|
65
|
+
dryRun?: boolean;
|
|
66
|
+
filter?: string;
|
|
67
|
+
query?: string;
|
|
68
|
+
startsWith?: string;
|
|
69
|
+
publish?: 'all' | 'published' | 'published-with-changes';
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Interface representing the options for the `datasources pull` command.
|
|
74
|
+
*/
|
|
75
|
+
interface PullDatasourcesOptions extends CommandOptions {
|
|
76
|
+
/**
|
|
77
|
+
* The filename to save the file as.
|
|
78
|
+
* Defaults to `DEFAULT_DATASOURCES_FILENAME`. The file will be saved as `<filename>.<space>.json`.
|
|
79
|
+
* @default DEFAULT_DATASOURCES_FILENAME
|
|
80
|
+
*/
|
|
81
|
+
filename?: string;
|
|
82
|
+
/**
|
|
83
|
+
* The suffix to add to the filename.
|
|
84
|
+
* Defaults to the space ID.
|
|
85
|
+
* @default space
|
|
86
|
+
*/
|
|
87
|
+
suffix?: string;
|
|
88
|
+
/**
|
|
89
|
+
* Indicates whether to save each datasource to a separate file.
|
|
90
|
+
* @default false
|
|
91
|
+
*/
|
|
92
|
+
separateFiles?: boolean;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
interface PushDatasourcesOptions extends CommandOptions {
|
|
96
|
+
/**
|
|
97
|
+
* The glob pattern filter to apply to datasources before pushing.
|
|
98
|
+
* @default `.*`
|
|
99
|
+
*/
|
|
100
|
+
filter?: string;
|
|
101
|
+
/**
|
|
102
|
+
* Indicates whether to save each component to a separate file.
|
|
103
|
+
* @default false
|
|
104
|
+
*/
|
|
105
|
+
separateFiles?: boolean;
|
|
106
|
+
/**
|
|
107
|
+
* The source space id.
|
|
108
|
+
*/
|
|
109
|
+
from?: string;
|
|
110
|
+
/**
|
|
111
|
+
* Suffix to add to the component name.
|
|
112
|
+
*/
|
|
113
|
+
suffix?: string;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
interface GenerateTypesOptions {
|
|
117
|
+
separateFiles?: boolean;
|
|
118
|
+
strict?: boolean;
|
|
119
|
+
typePrefix?: string;
|
|
120
|
+
typeSuffix?: string;
|
|
121
|
+
filename?: string;
|
|
122
|
+
path?: string;
|
|
123
|
+
suffix?: string;
|
|
124
|
+
customFieldsParser?: string;
|
|
125
|
+
compilerOptions?: string;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Makes all properties in T optional recursively
|
|
130
|
+
*/
|
|
131
|
+
type DeepPartial<T> = T extends object ? {
|
|
132
|
+
[P in keyof T]?: DeepPartial<T[P]>;
|
|
133
|
+
} : T;
|
|
134
|
+
|
|
135
|
+
type PlainObject = Record<string, any>;
|
|
136
|
+
interface ApiConfig {
|
|
137
|
+
maxRetries: number;
|
|
138
|
+
maxConcurrency: number;
|
|
139
|
+
}
|
|
140
|
+
interface LogConsoleConfig {
|
|
141
|
+
enabled: boolean;
|
|
142
|
+
level: string;
|
|
143
|
+
}
|
|
144
|
+
interface LogFileConfig {
|
|
145
|
+
enabled: boolean;
|
|
146
|
+
level: string;
|
|
147
|
+
maxFiles: number;
|
|
148
|
+
}
|
|
149
|
+
interface LogConfig {
|
|
150
|
+
console: LogConsoleConfig;
|
|
151
|
+
file: LogFileConfig;
|
|
152
|
+
}
|
|
153
|
+
interface ReportConfig {
|
|
154
|
+
enabled: boolean;
|
|
155
|
+
maxFiles: number;
|
|
156
|
+
}
|
|
157
|
+
interface UiConfig {
|
|
158
|
+
enabled: boolean;
|
|
159
|
+
}
|
|
160
|
+
interface GlobalConfig {
|
|
161
|
+
region?: RegionCode;
|
|
162
|
+
api: ApiConfig;
|
|
163
|
+
log: LogConfig;
|
|
164
|
+
report: ReportConfig;
|
|
165
|
+
ui: UiConfig;
|
|
166
|
+
verbose: boolean;
|
|
167
|
+
}
|
|
168
|
+
type StripCommandOption<T> = T extends CommandOptions ? Omit<T, keyof CommandOptions> : T;
|
|
169
|
+
type CommandConfig<T> = Partial<StripCommandOption<T>>;
|
|
170
|
+
interface ComponentsModuleConfig extends Record<string, unknown> {
|
|
171
|
+
space?: number;
|
|
172
|
+
path?: string;
|
|
173
|
+
pull?: CommandConfig<PullComponentsOptions>;
|
|
174
|
+
push?: CommandConfig<PushComponentsOptions>;
|
|
175
|
+
}
|
|
176
|
+
interface DatasourcesModuleConfig extends Record<string, unknown> {
|
|
177
|
+
space?: number;
|
|
178
|
+
path?: string;
|
|
179
|
+
pull?: CommandConfig<PullDatasourcesOptions>;
|
|
180
|
+
push?: CommandConfig<PushDatasourcesOptions>;
|
|
181
|
+
}
|
|
182
|
+
interface MigrationsModuleConfig extends Record<string, unknown> {
|
|
183
|
+
space?: number;
|
|
184
|
+
path?: string;
|
|
185
|
+
generate?: CommandConfig<MigrationsGenerateOptions>;
|
|
186
|
+
run?: CommandConfig<MigrationsRunOptions>;
|
|
187
|
+
}
|
|
188
|
+
interface TypesModuleConfig extends Record<string, unknown> {
|
|
189
|
+
space?: number;
|
|
190
|
+
path?: string;
|
|
191
|
+
generate?: CommandConfig<GenerateTypesOptions>;
|
|
192
|
+
}
|
|
193
|
+
type ModulesConfig = Record<string, PlainObject> & {
|
|
194
|
+
components?: ComponentsModuleConfig;
|
|
195
|
+
datasources?: DatasourcesModuleConfig;
|
|
196
|
+
migrations?: MigrationsModuleConfig;
|
|
197
|
+
types?: TypesModuleConfig;
|
|
198
|
+
};
|
|
199
|
+
interface StoryblokConfig extends DeepPartial<GlobalConfig> {
|
|
200
|
+
space?: number;
|
|
201
|
+
path?: string;
|
|
202
|
+
modules?: ModulesConfig;
|
|
203
|
+
}
|
|
204
|
+
declare function defineConfig<T extends StoryblokConfig>(config: T): T;
|
|
205
|
+
|
|
206
|
+
export { defineConfig };
|
|
207
|
+
export type { ComponentsModuleConfig, DatasourcesModuleConfig, MigrationsModuleConfig, ModulesConfig, StoryblokConfig, TypesModuleConfig };
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
declare const regionCodes: readonly ["eu", "us", "cn", "ca", "ap"];
|
|
2
|
+
type RegionCode = typeof regionCodes[number];
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Interface representing the default options for a CLI command.
|
|
6
|
+
*/
|
|
7
|
+
interface CommandOptions {
|
|
8
|
+
/**
|
|
9
|
+
* Indicates whether verbose output is enabled.
|
|
10
|
+
*/
|
|
11
|
+
verbose: boolean;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Interface representing the options for the `components pull` command.
|
|
16
|
+
*/
|
|
17
|
+
interface PullComponentsOptions extends CommandOptions {
|
|
18
|
+
/**
|
|
19
|
+
* The filename to save the file as.
|
|
20
|
+
* Defaults to `components`. The file will be saved as `<filename>.<space>.json`.
|
|
21
|
+
* @default `components
|
|
22
|
+
*/
|
|
23
|
+
filename?: string;
|
|
24
|
+
/**
|
|
25
|
+
* The suffix to add to the filename.
|
|
26
|
+
* Defaults to the space ID.
|
|
27
|
+
* @default space
|
|
28
|
+
*/
|
|
29
|
+
suffix?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Indicates whether to save each component to a separate file.
|
|
32
|
+
* @default false
|
|
33
|
+
*/
|
|
34
|
+
separateFiles?: boolean;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
interface PushComponentsOptions extends CommandOptions {
|
|
38
|
+
/**
|
|
39
|
+
* The glob pattern filter to apply to components before pushing.
|
|
40
|
+
* Matching components and all their dependencies (groups, tags, other components)
|
|
41
|
+
* will be collected and pushed together.
|
|
42
|
+
* @default `.*`
|
|
43
|
+
*/
|
|
44
|
+
filter?: string;
|
|
45
|
+
/**
|
|
46
|
+
* Indicates whether to save each component to a separate file.
|
|
47
|
+
* @default false
|
|
48
|
+
*/
|
|
49
|
+
separateFiles?: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* The source space id.
|
|
52
|
+
*/
|
|
53
|
+
from?: string;
|
|
54
|
+
/**
|
|
55
|
+
* Suffix to add to the component name.
|
|
56
|
+
*/
|
|
57
|
+
suffix?: string;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
interface MigrationsGenerateOptions extends CommandOptions {
|
|
61
|
+
suffix?: string;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
interface MigrationsRunOptions extends CommandOptions {
|
|
65
|
+
dryRun?: boolean;
|
|
66
|
+
filter?: string;
|
|
67
|
+
query?: string;
|
|
68
|
+
startsWith?: string;
|
|
69
|
+
publish?: 'all' | 'published' | 'published-with-changes';
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Interface representing the options for the `datasources pull` command.
|
|
74
|
+
*/
|
|
75
|
+
interface PullDatasourcesOptions extends CommandOptions {
|
|
76
|
+
/**
|
|
77
|
+
* The filename to save the file as.
|
|
78
|
+
* Defaults to `DEFAULT_DATASOURCES_FILENAME`. The file will be saved as `<filename>.<space>.json`.
|
|
79
|
+
* @default DEFAULT_DATASOURCES_FILENAME
|
|
80
|
+
*/
|
|
81
|
+
filename?: string;
|
|
82
|
+
/**
|
|
83
|
+
* The suffix to add to the filename.
|
|
84
|
+
* Defaults to the space ID.
|
|
85
|
+
* @default space
|
|
86
|
+
*/
|
|
87
|
+
suffix?: string;
|
|
88
|
+
/**
|
|
89
|
+
* Indicates whether to save each datasource to a separate file.
|
|
90
|
+
* @default false
|
|
91
|
+
*/
|
|
92
|
+
separateFiles?: boolean;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
interface PushDatasourcesOptions extends CommandOptions {
|
|
96
|
+
/**
|
|
97
|
+
* The glob pattern filter to apply to datasources before pushing.
|
|
98
|
+
* @default `.*`
|
|
99
|
+
*/
|
|
100
|
+
filter?: string;
|
|
101
|
+
/**
|
|
102
|
+
* Indicates whether to save each component to a separate file.
|
|
103
|
+
* @default false
|
|
104
|
+
*/
|
|
105
|
+
separateFiles?: boolean;
|
|
106
|
+
/**
|
|
107
|
+
* The source space id.
|
|
108
|
+
*/
|
|
109
|
+
from?: string;
|
|
110
|
+
/**
|
|
111
|
+
* Suffix to add to the component name.
|
|
112
|
+
*/
|
|
113
|
+
suffix?: string;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
interface GenerateTypesOptions {
|
|
117
|
+
separateFiles?: boolean;
|
|
118
|
+
strict?: boolean;
|
|
119
|
+
typePrefix?: string;
|
|
120
|
+
typeSuffix?: string;
|
|
121
|
+
filename?: string;
|
|
122
|
+
path?: string;
|
|
123
|
+
suffix?: string;
|
|
124
|
+
customFieldsParser?: string;
|
|
125
|
+
compilerOptions?: string;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Makes all properties in T optional recursively
|
|
130
|
+
*/
|
|
131
|
+
type DeepPartial<T> = T extends object ? {
|
|
132
|
+
[P in keyof T]?: DeepPartial<T[P]>;
|
|
133
|
+
} : T;
|
|
134
|
+
|
|
135
|
+
type PlainObject = Record<string, any>;
|
|
136
|
+
interface ApiConfig {
|
|
137
|
+
maxRetries: number;
|
|
138
|
+
maxConcurrency: number;
|
|
139
|
+
}
|
|
140
|
+
interface LogConsoleConfig {
|
|
141
|
+
enabled: boolean;
|
|
142
|
+
level: string;
|
|
143
|
+
}
|
|
144
|
+
interface LogFileConfig {
|
|
145
|
+
enabled: boolean;
|
|
146
|
+
level: string;
|
|
147
|
+
maxFiles: number;
|
|
148
|
+
}
|
|
149
|
+
interface LogConfig {
|
|
150
|
+
console: LogConsoleConfig;
|
|
151
|
+
file: LogFileConfig;
|
|
152
|
+
}
|
|
153
|
+
interface ReportConfig {
|
|
154
|
+
enabled: boolean;
|
|
155
|
+
maxFiles: number;
|
|
156
|
+
}
|
|
157
|
+
interface UiConfig {
|
|
158
|
+
enabled: boolean;
|
|
159
|
+
}
|
|
160
|
+
interface GlobalConfig {
|
|
161
|
+
region?: RegionCode;
|
|
162
|
+
api: ApiConfig;
|
|
163
|
+
log: LogConfig;
|
|
164
|
+
report: ReportConfig;
|
|
165
|
+
ui: UiConfig;
|
|
166
|
+
verbose: boolean;
|
|
167
|
+
}
|
|
168
|
+
type StripCommandOption<T> = T extends CommandOptions ? Omit<T, keyof CommandOptions> : T;
|
|
169
|
+
type CommandConfig<T> = Partial<StripCommandOption<T>>;
|
|
170
|
+
interface ComponentsModuleConfig extends Record<string, unknown> {
|
|
171
|
+
space?: number;
|
|
172
|
+
path?: string;
|
|
173
|
+
pull?: CommandConfig<PullComponentsOptions>;
|
|
174
|
+
push?: CommandConfig<PushComponentsOptions>;
|
|
175
|
+
}
|
|
176
|
+
interface DatasourcesModuleConfig extends Record<string, unknown> {
|
|
177
|
+
space?: number;
|
|
178
|
+
path?: string;
|
|
179
|
+
pull?: CommandConfig<PullDatasourcesOptions>;
|
|
180
|
+
push?: CommandConfig<PushDatasourcesOptions>;
|
|
181
|
+
}
|
|
182
|
+
interface MigrationsModuleConfig extends Record<string, unknown> {
|
|
183
|
+
space?: number;
|
|
184
|
+
path?: string;
|
|
185
|
+
generate?: CommandConfig<MigrationsGenerateOptions>;
|
|
186
|
+
run?: CommandConfig<MigrationsRunOptions>;
|
|
187
|
+
}
|
|
188
|
+
interface TypesModuleConfig extends Record<string, unknown> {
|
|
189
|
+
space?: number;
|
|
190
|
+
path?: string;
|
|
191
|
+
generate?: CommandConfig<GenerateTypesOptions>;
|
|
192
|
+
}
|
|
193
|
+
type ModulesConfig = Record<string, PlainObject> & {
|
|
194
|
+
components?: ComponentsModuleConfig;
|
|
195
|
+
datasources?: DatasourcesModuleConfig;
|
|
196
|
+
migrations?: MigrationsModuleConfig;
|
|
197
|
+
types?: TypesModuleConfig;
|
|
198
|
+
};
|
|
199
|
+
interface StoryblokConfig extends DeepPartial<GlobalConfig> {
|
|
200
|
+
space?: number;
|
|
201
|
+
path?: string;
|
|
202
|
+
modules?: ModulesConfig;
|
|
203
|
+
}
|
|
204
|
+
declare function defineConfig<T extends StoryblokConfig>(config: T): T;
|
|
205
|
+
|
|
206
|
+
export { defineConfig };
|
|
207
|
+
export type { ComponentsModuleConfig, DatasourcesModuleConfig, MigrationsModuleConfig, ModulesConfig, StoryblokConfig, TypesModuleConfig };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../src/lib/config/types.ts"],"sourcesContent":["import type { RegionCode } from '../../constants';\nimport type { Command, Option } from 'commander';\nimport type { CommandOptions } from '../../types';\nimport type { PullComponentsOptions } from '../../commands/components/pull/constants';\nimport type { PushComponentsOptions } from '../../commands/components/push/constants';\nimport type { PullDatasourcesOptions } from '../../commands/datasources/pull/constants';\nimport type { PushDatasourcesOptions } from '../../commands/datasources/push/constants';\nimport type { MigrationsGenerateOptions } from '../../commands/migrations/generate/constants';\nimport type { MigrationsRunOptions } from '../../commands/migrations/run/constants';\nimport type { GenerateTypesOptions } from '../../commands/types/generate/constants';\nimport type { DeepPartial } from '../../utils/types';\n\nexport type PlainObject = Record<string, any>;\n\nexport interface ApiConfig {\n maxRetries: number;\n maxConcurrency: number;\n}\n\nexport interface LogConsoleConfig {\n enabled: boolean;\n level: string;\n}\n\nexport interface LogFileConfig {\n enabled: boolean;\n level: string;\n maxFiles: number;\n}\n\nexport interface LogConfig {\n console: LogConsoleConfig;\n file: LogFileConfig;\n}\n\nexport interface ReportConfig {\n enabled: boolean;\n maxFiles: number;\n}\n\nexport interface UiConfig {\n enabled: boolean;\n}\n\nexport interface GlobalConfig {\n region?: RegionCode;\n api: ApiConfig;\n log: LogConfig;\n report: ReportConfig;\n ui: UiConfig;\n verbose: boolean;\n}\n\nexport interface ResolvedCliConfig extends GlobalConfig {\n [key: string]: any;\n}\n\ntype StripCommandOption<T> = T extends CommandOptions ? Omit<T, keyof CommandOptions> : T;\ntype CommandConfig<T> = Partial<StripCommandOption<T>>;\n\nexport interface ComponentsModuleConfig extends Record<string, unknown> {\n space?: number;\n path?: string;\n pull?: CommandConfig<PullComponentsOptions>;\n push?: CommandConfig<PushComponentsOptions>;\n}\n\nexport interface DatasourcesModuleConfig extends Record<string, unknown> {\n space?: number;\n path?: string;\n pull?: CommandConfig<PullDatasourcesOptions>;\n push?: CommandConfig<PushDatasourcesOptions>;\n}\n\nexport interface MigrationsModuleConfig extends Record<string, unknown> {\n space?: number;\n path?: string;\n generate?: CommandConfig<MigrationsGenerateOptions>;\n run?: CommandConfig<MigrationsRunOptions>;\n}\n\nexport interface TypesModuleConfig extends Record<string, unknown> {\n space?: number;\n path?: string;\n generate?: CommandConfig<GenerateTypesOptions>;\n}\n\nexport type ModulesConfig = Record<string, PlainObject> & {\n components?: ComponentsModuleConfig;\n datasources?: DatasourcesModuleConfig;\n migrations?: MigrationsModuleConfig;\n types?: TypesModuleConfig;\n};\n\nexport interface StoryblokConfig extends DeepPartial<GlobalConfig> {\n space?: number;\n path?: string;\n modules?: ModulesConfig;\n}\n\nexport function defineConfig<T extends StoryblokConfig>(config: T): T {\n return config;\n}\n\nexport type OptionParser<T> = (value: string, previous?: T) => T;\n\nexport interface GlobalOptionDefinition<T = unknown> {\n flags: string;\n description: string;\n defaultValue?: T;\n parser?: OptionParser<T>;\n}\n\nexport interface ConfigLocation {\n cwd: string;\n configFile: string;\n}\n\nexport type CommanderOption = Option;\nexport type CommanderCommand = Command;\n"],"names":[],"mappings":"AAoGO,SAAS,aAAwC,MAAc,EAAA;AACpE,EAAO,OAAA,MAAA;AACT;;;;"}
|