Skip to content

Commit

Permalink
Merge pull request #48 from kickstartDS/next
Browse files Browse the repository at this point in the history
Major release
  • Loading branch information
julrich authored Apr 12, 2024
2 parents 7849d4d + 76f60d6 commit cfe6fd7
Show file tree
Hide file tree
Showing 26 changed files with 5,092 additions and 2,367 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: 2.1

defaults: &defaults
docker:
- image: cimg/node:18.1.0
- image: cimg/node:18.16.1
working_directory: /mnt/ramdisk
resource_class: medium+

Expand Down
27 changes: 19 additions & 8 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ console.log(
chalkTemplate`{#ecff00.bold ${figlet.textSync('kickstartDS', {
font: 'Standard',
horizontalLayout: 'default',
verticalLayout: 'default'
verticalLayout: 'default',
})}}\n{rgb(44,124,143).bold ${figlet.textSync('.CLI.', {
font: 'Slant Relief',
horizontalLayout: 'default',
verticalLayout: 'default'
verticalLayout: 'default',
})}}\n\nVersion: {bold ${
packageJson.version
}}\n{green For more information visit: }\n{blue https://www.kickstartds.com/docs/intro/cli/}\n\nStarting...`
Expand All @@ -44,16 +44,27 @@ program

// TODO completions are not working, yet
program.command('tokens', 'initialize, build and convert your design tokens', {
executableFile: `${cliRoot}/dist/src/commands/tokens.js`
});
program.command('schema', 'generate types or dereference component JSON Schema', {
executableFile: `${cliRoot}/dist/src/commands/schema.js`
executableFile: `${cliRoot}/dist/src/commands/tokens.js`,
});
program.command(
'schema',
'generate / layer types or dereference component JSON Schema',
{
executableFile: `${cliRoot}/dist/src/commands/schema.js`,
}
);
program.command(
'cms',
'convert component JSON Schema to headless CMS configuration',
{
executableFile: `${cliRoot}/dist/src/commands/cms.js`,
}
);
program.command('completion', 'kickstartDS CLI shell autocompletion', {
executableFile: `${cliRoot}/dist/src/commands/completion.js`
executableFile: `${cliRoot}/dist/src/commands/completion.js`,
});
program.command('example', 'example commands as orientation', {
executableFile: `${cliRoot}/dist/src/commands/example.js`
executableFile: `${cliRoot}/dist/src/commands/example.js`,
});

// TODO currently not working?!
Expand Down
34 changes: 23 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@
"husky-pre-commit": "lint-staged",
"husky-install": "husky install",
"lint": "run-p eslint",
"patch-package": "patch-package",
"prepare": "run-p husky-install patch-package git-config copy-env-file",
"prepare": "run-p husky-install git-config copy-env-file",
"staged": "git diff --name-only --cached | grep 'kickstartds' | cut -d / -f 3 | awk '!seen[$0]++'",
"start": "tsc && node dist/index.js"
},
Expand All @@ -54,8 +53,6 @@
"@babel/preset-react": "^7.17.12",
"@influxdata/influxdb-client": "^1.25.0",
"@influxdata/influxdb-client-apis": "^1.25.0",
"@kickstartds/style-dictionary": "^2.0.0",
"@kickstartds/jsonschema-utils": "2.2.0-canary.37.454.0",
"ajv": "^8.11.0",
"byline": "^5.0.0",
"chalk": "^5.0.1",
Expand All @@ -66,22 +63,20 @@
"dockerode": "^3.3.1",
"dotenv": "^16.0.1",
"fast-glob": "^3.2.12",
"fs-extra": "^10.1.0",
"figlet": "^1.5.2",
"figma-api": "^1.10.1",
"fs-extra": "^10.1.0",
"inquirer": "^8.2.4",
"json-pointer": "^0.6.2",
"json-schema": "^0.4.0",
"json-schema-merge-allof": "^0.8.1",
"json-schema-ref-parser": "^9.0.9",
"json-schema-to-typescript": "^11.0.2",
"json-schema-traverse": "^1.0.0",
"json-schema-typed": "^8.0.1",
"npm-run-all": "^4.1.5",
"nunjucks": "^3.2.3",
"object-traversal": "^1.0.1",
"omelette": "^0.4.17",
"patch-package": "^6.4.7",
"postinstall-postinstall": "^2.1.0",
"pretty-ms": "^7.0.1",
"progress": "^2.0.3",
"rxjs": "^7.5.5",
Expand All @@ -90,7 +85,7 @@
"strip-ansi": "^7.0.1",
"style-dictionary": "^3.7.0",
"ts-deepmerge": "^2.0.1",
"typescript": "^4.8.0-dev.20220512",
"typescript": "^5.0.4",
"uppercamelcase": "^3.0.0",
"uuid": "^8.3.2",
"winston": "^3.7.2",
Expand All @@ -104,12 +99,21 @@
"@auto-it/released": "^10.36.5",
"@commitlint/cli": "^16.2.3",
"@commitlint/config-conventional": "^16.2.1",
"@kickstartds/eslint-config": "^1.0.2",
"@kickstartds/eslint-config": "^1.2.0",
"@kickstartds/style-dictionary": "^4.0.2",
"@kickstartds/jsonschema-utils": "^3.0.11",
"@kickstartds/jsonschema2staticcms": "^2.9.15",
"@kickstartds/jsonschema2stackbit": "^1.3.14",
"@kickstartds/jsonschema2storyblok": "^1.5.20",
"@kickstartds/jsonschema2types": "^1.1.37",
"@kickstartds/jsonschema2uniform": "^1.4.2",
"@stackbit/types": "^0.10.14",
"@types/byline": "^4.2.33",
"@types/dockerode": "^3.3.9",
"@types/figlet": "^1.5.4",
"@types/fs-extra": "^9.0.13",
"@types/inquirer": "^8.2.1",
"@types/js-yaml": "^4.0.9",
"@types/json-pointer": "^1.0.31",
"@types/json-schema-merge-allof": "^0.6.1",
"@types/nunjucks": "^3.2.1",
Expand All @@ -125,9 +129,17 @@
"eslint-import-resolver-typescript": "^2.7.1",
"eslint-plugin-import": "^2.26.0",
"husky": "^7.0.4",
"js-yaml": "^4.1.0",
"prettier": "^2.6.2"
},
"peerDependencies": {
"@kickstartds/core": "^2.0.0"
"@kickstartds/core": "^4.0.2",
"@kickstartds/style-dictionary": "^4.0.2",
"@kickstartds/jsonschema-utils": "^3.0.11",
"@kickstartds/jsonschema2staticcms": "^2.9.15",
"@kickstartds/jsonschema2stackbit": "^1.3.14",
"@kickstartds/jsonschema2storyblok": "^1.5.20",
"@kickstartds/jsonschema2types": "^1.1.37",
"@kickstartds/jsonschema2uniform": "^1.4.2"
}
}
12 changes: 0 additions & 12 deletions patches/@influxdata+influxdb-client+1.25.0.patch

This file was deleted.

17 changes: 17 additions & 0 deletions src/commands/cms.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { program } from 'commander';
import { getLogger } from '../logging.js';
import storyblok from './cms/storyblok.js';
import uniform from './cms/uniform.js';
import stackbit from './cms/stackbit.js';
import staticcms from './cms/staticcms.js';

const logger = getLogger('cms');

logger.debug('executing a command of cms');

program
.addCommand(storyblok)
.addCommand(uniform)
.addCommand(stackbit)
.addCommand(staticcms)
.parse(process.argv);
80 changes: 80 additions & 0 deletions src/commands/cms/stackbit.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
import { Command } from 'commander';
import chalkTemplate from 'chalk-template';
import runTask from '../../tasks/cms/stackbit-task.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
);
})
);

export default stackbit;
81 changes: 81 additions & 0 deletions src/commands/cms/staticcms.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
import { Command } from 'commander';
import chalkTemplate from 'chalk-template';
import runTask from '../../tasks/cms/staticcms-task.js';

const staticcms = new Command('staticcms')
.description(
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'
)
.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']
)
.option(
'--globals <globalNames...>',
chalkTemplate`components to classify as global components`,
['settings', 'blog-overview']
)
.option(
'--components <componentNames...>',
chalkTemplate`components to classify as bloks`,
[
'cta',
'faq',
'features',
'gallery',
'image-text',
'logos',
'stats',
'teaser-card',
'testimonials',
'text',
'header',
'footer',
'seo',
'blog-teaser',
]
)
.option(
'--rc-only',
chalkTemplate`only read configuration from {bold .schema-staticcmsrc.json}, skip prompts`,
true
)
.option(
'--revert',
chalkTemplate`revert command defined by {bold .schema-staticcmsrc.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.updateConfig,
options.templates,
options.globals,
options.components,
options.rcOnly,
options.revert,
options.cleanup,
options.debug
);
});

export default staticcms;
Loading

0 comments on commit cfe6fd7

Please sign in to comment.