@keshavsoft/kschema-cli 1.9.3 → 1.9.5
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/bin/cli.js
CHANGED
|
@@ -4,7 +4,7 @@ import path from "path";
|
|
|
4
4
|
import { exampleSchema } from "@keshavsoft/kschema";
|
|
5
5
|
import { baseTemplate } from "./template/baseTemplate.js";
|
|
6
6
|
|
|
7
|
-
export default () => {
|
|
7
|
+
export default ({ args }) => {
|
|
8
8
|
const OUTPUT_DIR = path.resolve(process.cwd(), "samples");
|
|
9
9
|
|
|
10
10
|
if (!fs.existsSync(OUTPUT_DIR)) {
|
|
@@ -13,13 +13,14 @@ export default () => {
|
|
|
13
13
|
|
|
14
14
|
Object.entries(exampleSchema).forEach(([intent, methods]) => {
|
|
15
15
|
Object.entries(methods).forEach(([key, meta]) => {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
16
|
+
if (Array.isArray(meta)) {
|
|
17
|
+
const finalCode = baseTemplate({
|
|
18
|
+
body: meta.join("\r\n"),
|
|
19
|
+
inTableName: args[0]
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
fs.writeFileSync(path.join(OUTPUT_DIR, `${intent}_${key}.js`), finalCode);
|
|
23
|
+
};
|
|
21
24
|
});
|
|
22
|
-
|
|
23
25
|
});
|
|
24
|
-
|
|
25
26
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export const baseTemplate = ({ body, inTableName = "SampleTable" }) => `
|
|
2
2
|
import { kschema } from "@keshavsoft/kschema";
|
|
3
3
|
|
|
4
|
-
import configJson from "
|
|
4
|
+
import configJson from "../config.json" with { type: "json" };
|
|
5
5
|
|
|
6
6
|
kschema.loadConfig(configJson);
|
|
7
7
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@keshavsoft/kschema-cli",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.5",
|
|
4
4
|
"description": "CLI to scaffold projects using templates",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cli",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"project-generator"
|
|
11
11
|
],
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@keshavsoft/kschema": "^1.17.
|
|
13
|
+
"@keshavsoft/kschema": "^1.17.5"
|
|
14
14
|
},
|
|
15
15
|
"type": "module",
|
|
16
16
|
"bin": {
|