@contentstorage/core 0.6.0 → 0.6.1
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/scripts/generate-types.js +17 -10
- package/package.json +1 -1
|
@@ -12,25 +12,32 @@ export async function generateTypes() {
|
|
|
12
12
|
console.log(chalk.blue('Starting type generation...'));
|
|
13
13
|
const args = process.argv.slice(2);
|
|
14
14
|
const cliConfig = {};
|
|
15
|
-
|
|
16
|
-
if (
|
|
17
|
-
const key =
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
args.forEach((arg) => {
|
|
16
|
+
if (arg.startsWith('--')) {
|
|
17
|
+
const [key, value] = arg.substring(2).split('=');
|
|
18
|
+
if (key && value) {
|
|
19
|
+
const sanitizedValue = value
|
|
20
|
+
.replace(/^"(.*)"$/, '$1')
|
|
21
|
+
.replace(/^'(.*)'$/, '$1');
|
|
20
22
|
if (key === 'lang') {
|
|
21
|
-
cliConfig.languageCodes = [
|
|
23
|
+
cliConfig.languageCodes = [sanitizedValue];
|
|
22
24
|
}
|
|
23
25
|
else if (key === 'content-key') {
|
|
24
|
-
cliConfig.contentKey =
|
|
26
|
+
cliConfig.contentKey = sanitizedValue;
|
|
25
27
|
}
|
|
26
28
|
else if (key === 'output') {
|
|
27
|
-
cliConfig.typesOutputFile =
|
|
29
|
+
cliConfig.typesOutputFile = sanitizedValue;
|
|
28
30
|
}
|
|
29
|
-
i++; // Move to the next argument
|
|
30
31
|
}
|
|
31
32
|
}
|
|
33
|
+
});
|
|
34
|
+
let fileConfig = {};
|
|
35
|
+
try {
|
|
36
|
+
fileConfig = await loadConfig();
|
|
37
|
+
}
|
|
38
|
+
catch {
|
|
39
|
+
console.log(chalk.yellow('Could not load a configuration file. Proceeding with CLI arguments.'));
|
|
32
40
|
}
|
|
33
|
-
const fileConfig = await loadConfig();
|
|
34
41
|
const config = { ...fileConfig, ...cliConfig };
|
|
35
42
|
if (!config.typesOutputFile) {
|
|
36
43
|
console.error(chalk.red.bold("Configuration error: 'typesOutputFile' is missing."));
|
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.6.
|
|
5
|
+
"version": "0.6.1",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"description": "Fetch content from contentstorage and generate TypeScript types",
|
|
8
8
|
"module": "dist/index.js",
|