Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,12 @@
"@commitlint/config-conventional": "^16.2.1",
"@kickstartds/eslint-config": "^1.2.0",
"@kickstartds/style-dictionary": "^4.0.2",
"@kickstartds/jsonschema-utils": "^3.6.1",
"@kickstartds/jsonschema2staticcms": "^2.9.35",
"@kickstartds/jsonschema2stackbit": "^1.7.4",
"@kickstartds/jsonschema2storyblok": "^1.6.5",
"@kickstartds/jsonschema2types": "^1.2.3",
"@kickstartds/jsonschema2uniform": "^1.4.22",
"@kickstartds/jsonschema-utils": "^3.8.1",
"@kickstartds/jsonschema2staticcms": "^2.9.39",
"@kickstartds/jsonschema2stackbit": "^1.7.8",
"@kickstartds/jsonschema2storyblok": "^1.6.9",
"@kickstartds/jsonschema2types": "^1.2.7",
"@kickstartds/jsonschema2uniform": "^1.4.26",
"@stackbit/types": "^0.10.14",
"@types/byline": "^4.2.33",
"@types/dockerode": "^3.3.9",
Expand Down Expand Up @@ -135,11 +135,11 @@
"peerDependencies": {
"@kickstartds/core": "^4.0.2",
"@kickstartds/style-dictionary": "^4.0.2",
"@kickstartds/jsonschema-utils": "^3.6.1",
"@kickstartds/jsonschema2staticcms": "^2.9.35",
"@kickstartds/jsonschema2stackbit": "^1.7.4",
"@kickstartds/jsonschema2storyblok": "^1.6.5",
"@kickstartds/jsonschema2types": "^1.2.3",
"@kickstartds/jsonschema2uniform": "^1.4.22"
"@kickstartds/jsonschema-utils": "^3.8.1",
"@kickstartds/jsonschema2staticcms": "^2.9.39",
"@kickstartds/jsonschema2stackbit": "^1.7.8",
"@kickstartds/jsonschema2storyblok": "^1.6.9",
"@kickstartds/jsonschema2types": "^1.2.7",
"@kickstartds/jsonschema2uniform": "^1.4.26"
}
}
15 changes: 8 additions & 7 deletions src/commands/cms/stackbit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ const stackbit = new Command('stackbit')
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'
'--schema-paths <paths...>',
chalkTemplate`paths to your JSON Schema component definitions, default {bold ./src/components}`,
['src/components']
)
.option(
'--cms-path <path>',
chalkTemplate`relative path from project root to your cms specific components directory, default {bold ./src/components}`
'--layer-order <order...>',
chalkTemplate`order of layers in processing, default {bold ['cms', 'schema']}`,
['cms', 'schema']
)
.option(
'--configuration-path <path>',
Expand Down Expand Up @@ -67,8 +68,8 @@ const stackbit = new Command('stackbit')
.action((options) =>
import('./../../tasks/cms/stackbit-task.js').then((runTask) => {
runTask.default(
options.componentsPath,
options.cmsPath,
options.schemaPaths,
options.layerOrder,
options.configurationPath,
options.updateConfig,
options.templates,
Expand Down
15 changes: 8 additions & 7 deletions src/commands/cms/staticcms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ const staticcms = new Command('staticcms')
chalkTemplate`Generates {bold Static CMS} 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'
'--schema-paths <paths...>',
chalkTemplate`paths to your JSON Schema component definitions, default {bold ./src/components}`,
['src/components']
)
.option(
'--cms-path <path>',
chalkTemplate`relative path from project root to your cms specific components directory, default {bold ./src/components}`
'--layer-order <order...>',
chalkTemplate`order of layers in processing, default {bold ['cms', 'schema']}`,
['cms', 'schema']
)
.option(
'--configuration-path <path>',
Expand Down Expand Up @@ -69,8 +70,8 @@ const staticcms = new Command('staticcms')
.option('--debug', 'show debugging output', false)
.action((options) => {
runTask(
options.componentsPath,
options.cmsPath,
options.schemaPaths,
options.layerOrder,
options.configurationPath,
options.updateConfig,
options.templates,
Expand Down
15 changes: 8 additions & 7 deletions src/commands/cms/storyblok.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ const storyblok = new Command('storyblok')
chalkTemplate`Generates {bold Storyblok} 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'
'--schema-paths <paths...>',
chalkTemplate`paths to your JSON Schema component definitions, default {bold ./src/components}`,
['src/components']
)
.option(
'--cms-path <path>',
chalkTemplate`relative path from project root to your cms specific components directory, default {bold ./src/components}`
'--layer-order <order...>',
chalkTemplate`order of layers in processing, default {bold ['cms', 'schema']}`,
['cms', 'schema']
)
.option(
'--configuration-path <path>',
Expand Down Expand Up @@ -66,8 +67,8 @@ const storyblok = new Command('storyblok')
.option('--debug', 'show debugging output', false)
.action((options) => {
runTask(
options.componentsPath,
options.cmsPath,
options.schemaPaths,
options.layerOrder,
options.configurationPath,
options.updateConfig,
options.templates,
Expand Down
15 changes: 8 additions & 7 deletions src/commands/cms/uniform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ const uniform = new Command('uniform')
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'
'--schema-paths <paths...>',
chalkTemplate`paths to your JSON Schema component definitions, default {bold ./src/components}`,
['src/components']
)
.option(
'--cms-path <path>',
chalkTemplate`relative path from project root to your cms specific components directory, default {bold ./src/components}`
'--layer-order <order...>',
chalkTemplate`order of layers in processing, default {bold ['cms', 'schema']}`,
['cms', 'schema']
)
.option(
'--configuration-path <path>',
Expand Down Expand Up @@ -44,8 +45,8 @@ const uniform = new Command('uniform')
.option('--debug', 'show debugging output', false)
.action((options) => {
runTask(
options.componentsPath,
options.cmsPath,
options.schemaPaths,
options.layerOrder,
options.configurationPath,
options.templates,
options.globals,
Expand Down
15 changes: 8 additions & 7 deletions src/commands/schema/defaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ const defaults = new Command('defaults')
chalkTemplate`Creates default objects for {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'
'--schema-paths <paths...>',
chalkTemplate`paths to your JSON Schema component definitions, default {bold ./src/components}`,
['src/components']
)
.option(
'--cms-path <path>',
chalkTemplate`relative path from project root to your cms specific components directory, default {bold ./src/components}`
'--layer-order <order...>',
chalkTemplate`order of layers in processing, default {bold ['cms', 'schema']}`,
['cms', 'schema']
)
.option(
'--no-default-page-schema',
Expand All @@ -38,8 +39,8 @@ const defaults = new Command('defaults')
.option('--debug', 'show debugging output', false)
.action((options) => {
runTask(
options.componentsPath,
options.cmsPath,
options.schemaPaths,
options.layerOrder,
options.defaultPageSchema,
options.layerKickstartdsComponents,
options.rcOnly,
Expand Down
15 changes: 8 additions & 7 deletions src/commands/schema/dereference.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ const dereference = new Command('dereference')
chalkTemplate`Dereferences {bold JSON Schema} component definitions, (mainly) inlining all $ref references in the process`
)
.option(
'--components-path <path>',
chalkTemplate`relative path from project root to your components directory, default {bold ./src/components}`,
'src/components'
'--schema-paths <paths...>',
chalkTemplate`paths to your JSON Schema component definitions, default {bold ./src/components}`,
['src/components']
)
.option(
'--cms-path <path>',
chalkTemplate`relative path from project root to your cms specific components directory, default {bold ./src/components}`
'--layer-order <order...>',
chalkTemplate`order of layers in processing, default {bold ['cms', 'schema']}`,
['cms', 'schema']
)
.option(
'--no-default-page-schema',
Expand All @@ -38,8 +39,8 @@ const dereference = new Command('dereference')
.option('--debug', 'show debugging output', false)
.action((options) => {
runTask(
options.componentsPath,
options.cmsPath,
options.schemaPaths,
options.layerOrder,
options.defaultPageSchema,
options.layerKickstartdsComponents,
options.rcOnly,
Expand Down
15 changes: 8 additions & 7 deletions src/commands/schema/layer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ const types = new Command('layer')
chalkTemplate`Layers kickstartDS {bold TypeScript} type definitions using 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'
'--schema-paths <paths...>',
chalkTemplate`paths to your JSON Schema component definitions, default {bold ./src/components}`,
['src/components']
)
.option(
'--cms-path <path>',
chalkTemplate`relative path from project root to your cms specific components directory, default {bold ./src/components}`
'--layer-order <order...>',
chalkTemplate`order of layers in processing, default {bold ['cms', 'schema']}`,
['cms', 'schema']
)
.option(
'--types-path <path>',
Expand Down Expand Up @@ -48,8 +49,8 @@ const types = new Command('layer')
.option('--debug', 'show debugging output', false)
.action((options) => {
runTask(
options.componentsPath,
options.cmsPath,
options.schemaPaths,
options.layerOrder,
options.typesPath,
options.mergeSchemas,
options.defaultPageSchema,
Expand Down
13 changes: 10 additions & 3 deletions src/commands/schema/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,14 @@ const types = new Command('types')
'src/components'
)
.option(
'--cms-path <path>',
chalkTemplate`relative path from project root to your cms specific components directory, default {bold ./src/components}`
'--schema-paths <paths...>',
chalkTemplate`paths to your JSON Schema component definitions, default {bold ./src/components}`,
['src/components']
)
.option(
'--layer-order <order...>',
chalkTemplate`order of layers in processing, default {bold ['cms', 'schema']}`,
['cms', 'schema']
)
.option(
'--merge-schemas',
Expand Down Expand Up @@ -49,7 +55,8 @@ const types = new Command('types')
.action((options) => {
runTask(
options.componentsPath,
options.cmsPath,
options.schemaPaths,
options.layerOrder,
options.mergeSchemas,
options.defaultPageSchema,
options.layerKickstartdsComponents,
Expand Down
17 changes: 10 additions & 7 deletions src/tasks/cms/stackbit-task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ const {
} = taskUtilSchema;

const run = async (
componentsPath: string = 'src/components',
cmsPath: string,
schemaPaths: string[] = ['src/components'],
layerOrder: string[] = ['cms', 'schema'],
configurationPath: string = 'src/cms',
updateConfig: boolean = true,
templates: string[] = ['page', 'blog-post'],
Expand Down Expand Up @@ -75,16 +75,19 @@ const run = async (
const stackbit = async (logger: winston.Logger): Promise<boolean> => {
logger.info(chalkTemplate`running the {bold stackbit} subtask`);

const customSchemaGlob = `${callingPath}/${componentsPath}/**/*.(schema|definitions|interface).json`;
const globs = [customSchemaGlob];
if (cmsPath) {
globs.push(`${callingPath}/${cmsPath}/**/*.schema.json`);
const globs = [];
for (const schemaPath of schemaPaths) {
globs.push(
`${callingPath}/${schemaPath}/**/*.(schema|definitions|interface).json`
);
}

const elements = await schemaToStackbit(
globs,
templates,
globals,
components
components,
[...layerOrder, 'kickstartds']
);

shell.mkdir('-p', `${shell.pwd()}/${configurationPath}/`);
Expand Down
17 changes: 10 additions & 7 deletions src/tasks/cms/staticcms-task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ const {
} = taskUtilSchema;

const run = async (
componentsPath: string = 'src/components',
cmsPath: string,
schemaPaths: string[] = ['src/components'],
layerOrder: string[] = ['cms', 'schema'],
configurationPath: string = 'src/cms',
updateConfig: boolean = true,
templates: string[] = ['page', 'blog-post'],
Expand Down Expand Up @@ -73,16 +73,19 @@ const run = async (
const staticcms = async (logger: winston.Logger): Promise<boolean> => {
logger.info(chalkTemplate`running the {bold staticcms} subtask`);

const customSchemaGlob = `${callingPath}/${componentsPath}/**/*.(schema|definitions|interface).json`;
const globs = [customSchemaGlob];
if (cmsPath) {
globs.push(`${callingPath}/${cmsPath}/**/*.schema.json`);
const globs = [];
for (const schemaPath of schemaPaths) {
globs.push(
`${callingPath}/${schemaPath}/**/*.(schema|definitions|interface).json`
);
}

const elements = await schemaToStaticcms(
globs,
templates,
globals,
components
components,
[...layerOrder, 'kickstartds']
);

shell.mkdir('-p', `${shell.pwd()}/${configurationPath}/`);
Expand Down
17 changes: 10 additions & 7 deletions src/tasks/cms/storyblok-task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ const {
} = taskUtilSchema;

const run = async (
componentsPath: string = 'src/components',
cmsPath: string,
schemaPaths: string[] = ['src/components'],
layerOrder: string[] = ['cms', 'schema'],
configurationPath: string = 'src/cms',
updateConfig: boolean = true,
templates: string[] = ['page', 'blog-post', 'blog-overview', 'settings'],
Expand Down Expand Up @@ -72,16 +72,19 @@ const run = async (
const storyblok = async (logger: winston.Logger): Promise<boolean> => {
logger.info(chalkTemplate`running the {bold storyblok} subtask`);

const customSchemaGlob = `${callingPath}/${componentsPath}/**/*.(schema|definitions|interface).json`;
const globs = [customSchemaGlob];
if (cmsPath) {
globs.push(`${callingPath}/${cmsPath}/**/*.schema.json`);
const globs = [];
for (const schemaPath of schemaPaths) {
globs.push(
`${callingPath}/${schemaPath}/**/*.(schema|definitions|interface).json`
);
}

const elements = await schemaToStoryblok(
globs,
templates,
globals,
components
components,
[...layerOrder, 'kickstartds']
);

shell.mkdir('-p', `${shell.pwd()}/${configurationPath}/`);
Expand Down
Loading