@keshavsoft/kschema-cli 1.5.1 → 1.5.2
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/CHANGELOG.md +7 -1
- package/bin/v5/commands/generateSamples.js +5 -5
- package/generateSample.js +19 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -27,4 +27,10 @@ The format is based on Keep a Changelog.
|
|
|
27
27
|
## [1.4.1] - 2026-04-23
|
|
28
28
|
|
|
29
29
|
### Added
|
|
30
|
-
- made auto code, no cliversion in package, major change
|
|
30
|
+
- made auto code, no cliversion in package, major change
|
|
31
|
+
|
|
32
|
+
## [1.5.2] - 2026-04-23
|
|
33
|
+
|
|
34
|
+
### Added
|
|
35
|
+
- new cli added generateSamples dependant on kschema npm
|
|
36
|
+
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import fs from "fs";
|
|
2
2
|
import path from "path";
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { schemaMeta } from "@keshavsoft/kschema";
|
|
5
5
|
import { baseTemplate } from "./template/baseTemplate.js";
|
|
6
6
|
|
|
7
7
|
export default () => {
|
|
@@ -11,11 +11,11 @@ export default () => {
|
|
|
11
11
|
fs.mkdirSync(OUTPUT_DIR, { recursive: true });
|
|
12
12
|
};
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
Object.entries(schemaMeta.query).forEach(([key, meta]) => {
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
const finalCode = baseTemplate({ body: meta.body });
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
fs.writeFileSync(path.join(OUTPUT_DIR, `${key}.js`), finalCode);
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
});
|
|
21
21
|
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import { schemaMeta } from "@keshavsoft/kschema";
|
|
3
|
+
|
|
4
|
+
Object.entries(schemaMeta.query).forEach(([key, meta]) => {
|
|
5
|
+
const code = `
|
|
6
|
+
import { kschema } from "@keshavsoft/kschema";
|
|
7
|
+
import configJson from "./config.json" with { type: "json" };
|
|
8
|
+
|
|
9
|
+
kschema.loadConfig(configJson);
|
|
10
|
+
|
|
11
|
+
const table = kschema.table("SampleTable");
|
|
12
|
+
|
|
13
|
+
${meta.body}
|
|
14
|
+
`;
|
|
15
|
+
|
|
16
|
+
fs.writeFileSync(`sample_${key}.js`, code);
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
console.log("All samples created 🚀");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@keshavsoft/kschema-cli",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.2",
|
|
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.12.
|
|
13
|
+
"@keshavsoft/kschema": "^1.12.3"
|
|
14
14
|
},
|
|
15
15
|
"type": "module",
|
|
16
16
|
"bin": {
|