@contentstorage/core 0.5.0 → 0.6.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.
@@ -10,7 +10,28 @@ import { CONTENTSTORAGE_CONFIG } from '../contentstorage-config.js';
10
10
  import { jsonToTS } from '../type-generation/index.js';
11
11
  export async function generateTypes() {
12
12
  console.log(chalk.blue('Starting type generation...'));
13
- const config = await loadConfig();
13
+ const args = process.argv.slice(2);
14
+ const cliConfig = {};
15
+ for (let i = 0; i < args.length; i++) {
16
+ if (args[i].startsWith('--')) {
17
+ const key = args[i].substring(2);
18
+ const value = args[i + 1];
19
+ if (value && !value.startsWith('--')) {
20
+ if (key === 'lang') {
21
+ cliConfig.languageCodes = [value];
22
+ }
23
+ else if (key === 'content-key') {
24
+ cliConfig.contentKey = value;
25
+ }
26
+ else if (key === 'output') {
27
+ cliConfig.typesOutputFile = value;
28
+ }
29
+ i++; // Move to the next argument
30
+ }
31
+ }
32
+ }
33
+ const fileConfig = await loadConfig();
34
+ const config = { ...fileConfig, ...cliConfig };
14
35
  if (!config.typesOutputFile) {
15
36
  console.error(chalk.red.bold("Configuration error: 'typesOutputFile' is missing."));
16
37
  process.exit(1);
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@contentstorage/core",
3
3
  "author": "Kaido Hussar <kaidohus@gmail.com>",
4
4
  "homepage": "https://contentstorage.app",
5
- "version": "0.5.0",
5
+ "version": "0.6.0",
6
6
  "type": "module",
7
7
  "description": "Fetch content from contentstorage and generate TypeScript types",
8
8
  "module": "dist/index.js",