@keshavsoft/kschema-cli 1.10.4 → 1.12.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.
Files changed (215) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/bin/v11/commands/express/steps/announce.js +3 -0
  3. package/bin/v11/commands/express/steps/createProject.js +6 -0
  4. package/bin/v11/commands/express/steps/decideTemplate.js +3 -0
  5. package/bin/v11/commands/express/steps/locateDestination.js +5 -0
  6. package/bin/v11/commands/express/steps/locateSource.js +13 -0
  7. package/bin/v11/commands/express/template/.env +8 -0
  8. package/bin/v11/commands/express/template/.env.local +7 -0
  9. package/bin/v11/commands/express/template/.vscode/launch.json +12 -0
  10. package/bin/v11/commands/express/template/Config/Schemas/BillsTable.json +166 -0
  11. package/bin/v11/commands/express/template/Config/Schemas/ItemsTable.json +206 -0
  12. package/bin/v11/commands/express/template/Config/Schemas/LedgerNames.json +50 -0
  13. package/bin/v11/commands/express/template/Config/Schemas/StockItems.json +45 -0
  14. package/bin/v11/commands/express/template/Config/api.json +8 -0
  15. package/bin/v11/commands/express/template/Config/schema.json +8 -0
  16. package/bin/v11/commands/express/template/Config/ui.json +8 -0
  17. package/bin/v11/commands/express/template/ForFrontEnd/NonSecured/Builder/build.js +6 -0
  18. package/bin/v11/commands/express/template/ForFrontEnd/NonSecured/Builder/config.js +12 -0
  19. package/bin/v11/commands/express/template/ForFrontEnd/NonSecured/Builder/main.js +29 -0
  20. package/bin/v11/commands/express/template/ForFrontEnd/NonSecured/Builder/publish.js +22 -0
  21. package/bin/v11/commands/express/template/ForFrontEnd/NonSecured/Builder/repo.js +20 -0
  22. package/bin/v11/commands/express/template/ForFrontEnd/NonSecured/Builder/schema.js +16 -0
  23. package/bin/v11/commands/express/template/ForFrontEnd/NonSecured/Builder/utils.js +26 -0
  24. package/bin/v11/commands/express/template/ForFrontEnd/NonSecured/Builder/version.js +25 -0
  25. package/bin/v11/commands/express/template/ForFrontEnd/NonSecured/buildAndCopy.js +166 -0
  26. package/bin/v11/commands/express/template/ForFrontEnd/NonSecured/latestVersion.js +38 -0
  27. package/bin/v11/commands/express/template/ForFrontEnd/Secured/buildProtected.js +108 -0
  28. package/bin/v11/commands/express/template/ForFrontEnd/Secured/latestVersion.js +38 -0
  29. package/bin/v11/commands/express/template/app.js +33 -0
  30. package/bin/v11/commands/express/template/config.json +4 -0
  31. package/bin/v11/commands/express/template/package.json +18 -0
  32. package/bin/v11/commands/express.js +23 -0
  33. package/bin/v11/commands/generateSamples.js +26 -0
  34. package/bin/v11/commands/init/steps/announce.js +3 -0
  35. package/bin/v11/commands/init/steps/createProject.js +6 -0
  36. package/bin/v11/commands/init/steps/decideTemplate.js +3 -0
  37. package/bin/v11/commands/init/steps/locateDestination.js +5 -0
  38. package/bin/v11/commands/init/steps/locateSource.js +13 -0
  39. package/bin/v11/commands/init/template/.vscode/launch.json +12 -0
  40. package/bin/v11/commands/init/template/Config/Schemas/BillsTable.json +165 -0
  41. package/bin/v11/commands/init/template/Config/Schemas/ItemsTable.json +200 -0
  42. package/bin/v11/commands/init/template/Config/Schemas/LedgerNames.json +50 -0
  43. package/bin/v11/commands/init/template/Config/Schemas/StockItems.json +45 -0
  44. package/bin/v11/commands/init/template/Config/api.json +8 -0
  45. package/bin/v11/commands/init/template/Config/schema.json +8 -0
  46. package/bin/v11/commands/init/template/Config/ui.json +8 -0
  47. package/bin/v11/commands/init/template/Data/BillsTable.json +165 -0
  48. package/bin/v11/commands/init/template/Data/ItemsTable.json +200 -0
  49. package/bin/v11/commands/init/template/Data/LedgerNames.json +6 -0
  50. package/bin/v11/commands/init/template/Data/StockItems.json +45 -0
  51. package/bin/v11/commands/init/template/app.js +4 -0
  52. package/bin/v11/commands/init/template/config.json +4 -0
  53. package/bin/v11/commands/init/template/package-lock.json +21 -0
  54. package/bin/v11/commands/init/template/package.json +14 -0
  55. package/bin/v11/commands/init/template/read.js +8 -0
  56. package/bin/v11/commands/init/template/write.js +8 -0
  57. package/bin/v11/commands/init.js +23 -0
  58. package/bin/v11/commands/template/baseTemplate.js +11 -0
  59. package/bin/v11/commands/template/basic/.vscode/launch.json +12 -0
  60. package/bin/v11/commands/template/basic/Config/Schemas/BillsTable.json +165 -0
  61. package/bin/v11/commands/template/basic/Config/Schemas/ItemsTable.json +200 -0
  62. package/bin/v11/commands/template/basic/Config/Schemas/LedgerNames.json +50 -0
  63. package/bin/v11/commands/template/basic/Config/Schemas/StockItems.json +45 -0
  64. package/bin/v11/commands/template/basic/Config/api.json +8 -0
  65. package/bin/v11/commands/template/basic/Config/schema.json +8 -0
  66. package/bin/v11/commands/template/basic/Config/ui.json +8 -0
  67. package/bin/v11/commands/template/basic/Data/BillsTable.json +165 -0
  68. package/bin/v11/commands/template/basic/Data/ItemsTable.json +200 -0
  69. package/bin/v11/commands/template/basic/Data/LedgerNames.json +6 -0
  70. package/bin/v11/commands/template/basic/Data/StockItems.json +45 -0
  71. package/bin/v11/commands/template/basic/app.js +4 -0
  72. package/bin/v11/commands/template/basic/config.json +4 -0
  73. package/bin/v11/commands/template/basic/package-lock.json +21 -0
  74. package/bin/v11/commands/template/basic/package.json +14 -0
  75. package/bin/v11/commands/template/basic/read.js +8 -0
  76. package/bin/v11/commands/template/basic/write.js +8 -0
  77. package/bin/v11/commands/template/express/.env +8 -0
  78. package/bin/v11/commands/template/express/.env.local +7 -0
  79. package/bin/v11/commands/template/express/.vscode/launch.json +12 -0
  80. package/bin/v11/commands/template/express/Config/Schemas/BillsTable.json +166 -0
  81. package/bin/v11/commands/template/express/Config/Schemas/ItemsTable.json +206 -0
  82. package/bin/v11/commands/template/express/Config/Schemas/LedgerNames.json +50 -0
  83. package/bin/v11/commands/template/express/Config/Schemas/StockItems.json +45 -0
  84. package/bin/v11/commands/template/express/Config/api.json +8 -0
  85. package/bin/v11/commands/template/express/Config/schema.json +8 -0
  86. package/bin/v11/commands/template/express/Config/ui.json +8 -0
  87. package/bin/v11/commands/template/express/ForFrontEnd/NonSecured/Builder/build.js +6 -0
  88. package/bin/v11/commands/template/express/ForFrontEnd/NonSecured/Builder/config.js +12 -0
  89. package/bin/v11/commands/template/express/ForFrontEnd/NonSecured/Builder/main.js +29 -0
  90. package/bin/v11/commands/template/express/ForFrontEnd/NonSecured/Builder/publish.js +22 -0
  91. package/bin/v11/commands/template/express/ForFrontEnd/NonSecured/Builder/repo.js +20 -0
  92. package/bin/v11/commands/template/express/ForFrontEnd/NonSecured/Builder/schema.js +16 -0
  93. package/bin/v11/commands/template/express/ForFrontEnd/NonSecured/Builder/utils.js +26 -0
  94. package/bin/v11/commands/template/express/ForFrontEnd/NonSecured/Builder/version.js +25 -0
  95. package/bin/v11/commands/template/express/ForFrontEnd/NonSecured/buildAndCopy.js +166 -0
  96. package/bin/v11/commands/template/express/ForFrontEnd/NonSecured/latestVersion.js +38 -0
  97. package/bin/v11/commands/template/express/ForFrontEnd/Secured/buildProtected.js +108 -0
  98. package/bin/v11/commands/template/express/ForFrontEnd/Secured/latestVersion.js +38 -0
  99. package/bin/v11/commands/template/express/app.js +33 -0
  100. package/bin/v11/commands/template/express/config.json +4 -0
  101. package/bin/v11/commands/template/express/package.json +18 -0
  102. package/bin/v11/commands/test.js +36 -0
  103. package/bin/v11/core/parseInput.js +10 -0
  104. package/bin/v11/core/resolveCommand.js +16 -0
  105. package/bin/v11/core/resolveFolderName.js +17 -0
  106. package/bin/v11/core/showUsage.js +42 -0
  107. package/bin/v11/start.js +22 -0
  108. package/bin/v12/commands/express/steps/announce.js +3 -0
  109. package/bin/v12/commands/express/steps/createProject.js +6 -0
  110. package/bin/v12/commands/express/steps/decideTemplate.js +3 -0
  111. package/bin/v12/commands/express/steps/locateDestination.js +5 -0
  112. package/bin/v12/commands/express/steps/locateSource.js +13 -0
  113. package/bin/v12/commands/express/template/.env +8 -0
  114. package/bin/v12/commands/express/template/.env.local +7 -0
  115. package/bin/v12/commands/express/template/.vscode/launch.json +12 -0
  116. package/bin/v12/commands/express/template/Config/Schemas/BillsTable.json +166 -0
  117. package/bin/v12/commands/express/template/Config/Schemas/ItemsTable.json +206 -0
  118. package/bin/v12/commands/express/template/Config/Schemas/LedgerNames.json +50 -0
  119. package/bin/v12/commands/express/template/Config/Schemas/StockItems.json +45 -0
  120. package/bin/v12/commands/express/template/Config/api.json +8 -0
  121. package/bin/v12/commands/express/template/Config/schema.json +8 -0
  122. package/bin/v12/commands/express/template/Config/ui.json +8 -0
  123. package/bin/v12/commands/express/template/ForFrontEnd/NonSecured/Builder/build.js +6 -0
  124. package/bin/v12/commands/express/template/ForFrontEnd/NonSecured/Builder/config.js +12 -0
  125. package/bin/v12/commands/express/template/ForFrontEnd/NonSecured/Builder/main.js +29 -0
  126. package/bin/v12/commands/express/template/ForFrontEnd/NonSecured/Builder/publish.js +22 -0
  127. package/bin/v12/commands/express/template/ForFrontEnd/NonSecured/Builder/repo.js +20 -0
  128. package/bin/v12/commands/express/template/ForFrontEnd/NonSecured/Builder/schema.js +16 -0
  129. package/bin/v12/commands/express/template/ForFrontEnd/NonSecured/Builder/utils.js +26 -0
  130. package/bin/v12/commands/express/template/ForFrontEnd/NonSecured/Builder/version.js +25 -0
  131. package/bin/v12/commands/express/template/ForFrontEnd/NonSecured/buildAndCopy.js +166 -0
  132. package/bin/v12/commands/express/template/ForFrontEnd/NonSecured/latestVersion.js +38 -0
  133. package/bin/v12/commands/express/template/ForFrontEnd/Secured/buildProtected.js +108 -0
  134. package/bin/v12/commands/express/template/ForFrontEnd/Secured/latestVersion.js +38 -0
  135. package/bin/v12/commands/express/template/app.js +33 -0
  136. package/bin/v12/commands/express/template/config.json +4 -0
  137. package/bin/v12/commands/express/template/package.json +18 -0
  138. package/bin/v12/commands/express.js +23 -0
  139. package/bin/v12/commands/generateSamples.js +26 -0
  140. package/bin/v12/commands/init/steps/announce.js +3 -0
  141. package/bin/v12/commands/init/steps/createProject.js +7 -0
  142. package/bin/v12/commands/init/steps/decideTemplate.js +3 -0
  143. package/bin/v12/commands/init/steps/locateDestination.js +5 -0
  144. package/bin/v12/commands/init/steps/locateSource.js +13 -0
  145. package/bin/v12/commands/init/template/.vscode/launch.json +12 -0
  146. package/bin/v12/commands/init/template/Config/Schemas/BillsTable.json +165 -0
  147. package/bin/v12/commands/init/template/Config/Schemas/ItemsTable.json +200 -0
  148. package/bin/v12/commands/init/template/Config/Schemas/LedgerNames.json +50 -0
  149. package/bin/v12/commands/init/template/Config/Schemas/StockItems.json +45 -0
  150. package/bin/v12/commands/init/template/Config/api.json +8 -0
  151. package/bin/v12/commands/init/template/Config/schema.json +8 -0
  152. package/bin/v12/commands/init/template/Config/ui.json +8 -0
  153. package/bin/v12/commands/init/template/Data/BillsTable.json +165 -0
  154. package/bin/v12/commands/init/template/Data/ItemsTable.json +200 -0
  155. package/bin/v12/commands/init/template/Data/LedgerNames.json +6 -0
  156. package/bin/v12/commands/init/template/Data/StockItems.json +45 -0
  157. package/bin/v12/commands/init/template/app.js +4 -0
  158. package/bin/v12/commands/init/template/config.json +4 -0
  159. package/bin/v12/commands/init/template/package-lock.json +21 -0
  160. package/bin/v12/commands/init/template/package.json +14 -0
  161. package/bin/v12/commands/init/template/read.js +8 -0
  162. package/bin/v12/commands/init/template/write.js +8 -0
  163. package/bin/v12/commands/init.js +19 -0
  164. package/bin/v12/commands/template/baseTemplate.js +11 -0
  165. package/bin/v12/commands/template/basic/.vscode/launch.json +12 -0
  166. package/bin/v12/commands/template/basic/Config/Schemas/BillsTable.json +165 -0
  167. package/bin/v12/commands/template/basic/Config/Schemas/ItemsTable.json +200 -0
  168. package/bin/v12/commands/template/basic/Config/Schemas/LedgerNames.json +50 -0
  169. package/bin/v12/commands/template/basic/Config/Schemas/StockItems.json +45 -0
  170. package/bin/v12/commands/template/basic/Config/api.json +8 -0
  171. package/bin/v12/commands/template/basic/Config/schema.json +8 -0
  172. package/bin/v12/commands/template/basic/Config/ui.json +8 -0
  173. package/bin/v12/commands/template/basic/Data/BillsTable.json +165 -0
  174. package/bin/v12/commands/template/basic/Data/ItemsTable.json +200 -0
  175. package/bin/v12/commands/template/basic/Data/LedgerNames.json +6 -0
  176. package/bin/v12/commands/template/basic/Data/StockItems.json +45 -0
  177. package/bin/v12/commands/template/basic/app.js +4 -0
  178. package/bin/v12/commands/template/basic/config.json +4 -0
  179. package/bin/v12/commands/template/basic/package-lock.json +21 -0
  180. package/bin/v12/commands/template/basic/package.json +14 -0
  181. package/bin/v12/commands/template/basic/read.js +8 -0
  182. package/bin/v12/commands/template/basic/write.js +8 -0
  183. package/bin/v12/commands/template/express/.env +8 -0
  184. package/bin/v12/commands/template/express/.env.local +7 -0
  185. package/bin/v12/commands/template/express/.vscode/launch.json +12 -0
  186. package/bin/v12/commands/template/express/Config/Schemas/BillsTable.json +166 -0
  187. package/bin/v12/commands/template/express/Config/Schemas/ItemsTable.json +206 -0
  188. package/bin/v12/commands/template/express/Config/Schemas/LedgerNames.json +50 -0
  189. package/bin/v12/commands/template/express/Config/Schemas/StockItems.json +45 -0
  190. package/bin/v12/commands/template/express/Config/api.json +8 -0
  191. package/bin/v12/commands/template/express/Config/schema.json +8 -0
  192. package/bin/v12/commands/template/express/Config/ui.json +8 -0
  193. package/bin/v12/commands/template/express/ForFrontEnd/NonSecured/Builder/build.js +6 -0
  194. package/bin/v12/commands/template/express/ForFrontEnd/NonSecured/Builder/config.js +12 -0
  195. package/bin/v12/commands/template/express/ForFrontEnd/NonSecured/Builder/main.js +29 -0
  196. package/bin/v12/commands/template/express/ForFrontEnd/NonSecured/Builder/publish.js +22 -0
  197. package/bin/v12/commands/template/express/ForFrontEnd/NonSecured/Builder/repo.js +20 -0
  198. package/bin/v12/commands/template/express/ForFrontEnd/NonSecured/Builder/schema.js +16 -0
  199. package/bin/v12/commands/template/express/ForFrontEnd/NonSecured/Builder/utils.js +26 -0
  200. package/bin/v12/commands/template/express/ForFrontEnd/NonSecured/Builder/version.js +25 -0
  201. package/bin/v12/commands/template/express/ForFrontEnd/NonSecured/buildAndCopy.js +166 -0
  202. package/bin/v12/commands/template/express/ForFrontEnd/NonSecured/latestVersion.js +38 -0
  203. package/bin/v12/commands/template/express/ForFrontEnd/Secured/buildProtected.js +108 -0
  204. package/bin/v12/commands/template/express/ForFrontEnd/Secured/latestVersion.js +38 -0
  205. package/bin/v12/commands/template/express/app.js +33 -0
  206. package/bin/v12/commands/template/express/config.json +4 -0
  207. package/bin/v12/commands/template/express/package.json +18 -0
  208. package/bin/v12/commands/test.js +36 -0
  209. package/bin/v12/core/parseInput.js +10 -0
  210. package/bin/v12/core/resolveCommand.js +16 -0
  211. package/bin/v12/core/resolveFolderName.js +17 -0
  212. package/bin/v12/core/showUsage.js +42 -0
  213. package/bin/v12/start.js +22 -0
  214. package/index.js +1 -0
  215. package/package.json +6 -3
@@ -0,0 +1,16 @@
1
+ import fs from "fs";
2
+ import path from "path";
3
+ import { CONFIG } from "./config.js";
4
+
5
+ export function readSchemas() {
6
+ const uiJson = fs.readFileSync(CONFIG.SCHEMA_FILE);
7
+ const parsed = JSON.parse(uiJson);
8
+ return parsed.Tables || [];
9
+ }
10
+
11
+ export function injectSchema(schemaFile) {
12
+ fs.copyFileSync(
13
+ path.join(CONFIG.SCHEMA_FOLDER, `${schemaFile}.json`),
14
+ path.join(CONFIG.COMMON_REPO_PATH, "schema.json")
15
+ );
16
+ }
@@ -0,0 +1,26 @@
1
+ import fs from "fs";
2
+ import path from "path";
3
+ import { execSync } from "child_process";
4
+
5
+ export function run(cmd, cwd = process.cwd()) {
6
+ console.log(`> ${cmd}`);
7
+ execSync(cmd, { stdio: "inherit", cwd });
8
+ }
9
+
10
+ export function ensureDir(dir) {
11
+ fs.mkdirSync(dir, { recursive: true });
12
+ }
13
+
14
+ export function copyRecursive(src, dest) {
15
+ fs.readdirSync(src, { withFileTypes: true }).forEach(entry => {
16
+ const srcPath = path.join(src, entry.name);
17
+ const destPath = path.join(dest, entry.name);
18
+
19
+ if (entry.isDirectory()) {
20
+ ensureDir(destPath);
21
+ copyRecursive(srcPath, destPath);
22
+ } else {
23
+ fs.copyFileSync(srcPath, destPath);
24
+ }
25
+ });
26
+ }
@@ -0,0 +1,25 @@
1
+ import fs from "fs";
2
+ import path from "path";
3
+ import { CONFIG } from "./config.js";
4
+ import { ensureDir } from "./utils.js";
5
+
6
+ export function getNextVersion() {
7
+ let max = 0;
8
+
9
+ if (fs.existsSync(CONFIG.PUBLIC_DIR)) {
10
+ fs.readdirSync(CONFIG.PUBLIC_DIR, { withFileTypes: true })
11
+ .filter(d => d.isDirectory() && d.name.startsWith(CONFIG.VERSION_PREFIX))
12
+ .forEach(d => {
13
+ const n = parseInt(d.name.replace(CONFIG.VERSION_PREFIX, ""), 10);
14
+ if (!isNaN(n) && n > max) max = n;
15
+ });
16
+ }
17
+
18
+ return `${CONFIG.VERSION_PREFIX}${max + 1}`;
19
+ };
20
+
21
+ export function createVersionFolder(version) {
22
+ const versionPath = path.join(CONFIG.PUBLIC_DIR, version);
23
+ ensureDir(versionPath);
24
+ return versionPath;
25
+ }
@@ -0,0 +1,166 @@
1
+ import fs from "fs";
2
+ import path from "path";
3
+ import { execSync } from "child_process";
4
+
5
+ /* ================= CONFIG ================= */
6
+ const CONFIG = {
7
+ PUBLIC_DIR: "Public",
8
+ VERSION_PREFIX: "V",
9
+ SCHEMA_FILE: "ui.json",
10
+ SCHEMA_FOLDER: "Schemas",
11
+ COMMON_REPO: "VoltUiGulpV1",
12
+ COMMON_REPO_GIT: "https://github.com/keshavsoft/VoltUiGulpV1"
13
+ };
14
+
15
+ CONFIG.COMMON_REPO_PATH = path.join("..", CONFIG.COMMON_REPO);
16
+ /* ========================================== */
17
+
18
+ /* ---------- GENERIC ---------- */
19
+ const Utils = {
20
+ run(cmd, cwd = process.cwd()) {
21
+ console.log(`> ${cmd}`);
22
+ execSync(cmd, { stdio: "inherit", cwd });
23
+ },
24
+
25
+ ensureDir(dir) {
26
+ fs.mkdirSync(dir, { recursive: true });
27
+ },
28
+
29
+ copyRecursive(src, dest) {
30
+ fs.readdirSync(src, { withFileTypes: true }).forEach(entry => {
31
+ const srcPath = path.join(src, entry.name);
32
+ const destPath = path.join(dest, entry.name);
33
+
34
+ if (entry.isDirectory()) {
35
+ this.ensureDir(destPath);
36
+ this.copyRecursive(srcPath, destPath);
37
+ } else {
38
+ fs.copyFileSync(srcPath, destPath);
39
+ }
40
+ });
41
+ }
42
+ };
43
+
44
+ /* ---------- VERSION (Release Manager) ---------- */
45
+ const Version = {
46
+ getNext() {
47
+ let max = 0;
48
+
49
+ if (fs.existsSync(CONFIG.PUBLIC_DIR)) {
50
+ fs.readdirSync(CONFIG.PUBLIC_DIR, { withFileTypes: true })
51
+ .filter(d => d.isDirectory() && d.name.startsWith(CONFIG.VERSION_PREFIX))
52
+ .forEach(d => {
53
+ const n = parseInt(d.name.replace(CONFIG.VERSION_PREFIX, ""), 10);
54
+ if (!isNaN(n) && n > max) max = n;
55
+ });
56
+ }
57
+
58
+ return `${CONFIG.VERSION_PREFIX}${max + 1}`;
59
+ },
60
+
61
+ createFolder(version) {
62
+ const versionPath = path.join(CONFIG.PUBLIC_DIR, version);
63
+ Utils.ensureDir(versionPath);
64
+ return versionPath;
65
+ }
66
+ };
67
+
68
+ /* ---------- REPO (Installer) ---------- */
69
+ const Repo = {
70
+ ensureCloned() {
71
+ if (!fs.existsSync(CONFIG.COMMON_REPO_PATH)) {
72
+ console.log(`${CONFIG.COMMON_REPO} not found. Cloning...`);
73
+ Utils.run(`git clone ${CONFIG.COMMON_REPO_GIT} ${CONFIG.COMMON_REPO_PATH}`);
74
+ }
75
+ },
76
+
77
+ ensureDependencies() {
78
+ if (!fs.existsSync(path.join(CONFIG.COMMON_REPO_PATH, "node_modules"))) {
79
+ console.log("Installing dependencies...");
80
+ Utils.run("npm install", CONFIG.COMMON_REPO_PATH);
81
+ }
82
+ },
83
+
84
+ copyEnv() {
85
+ if (fs.existsSync(".env")) {
86
+ fs.copyFileSync(".env", path.join(CONFIG.COMMON_REPO_PATH, ".env"));
87
+ }
88
+ },
89
+
90
+ prepare() {
91
+ this.ensureCloned();
92
+ this.ensureDependencies();
93
+ this.copyEnv();
94
+ }
95
+ };
96
+
97
+ /* ---------- SCHEMA (Data Supplier) ---------- */
98
+ const Schema = {
99
+ readAll() {
100
+ const uiJson = fs.readFileSync(CONFIG.SCHEMA_FILE);
101
+ const parsed = JSON.parse(uiJson);
102
+ return parsed.Tables || [];
103
+ },
104
+
105
+ inject(schemaFile) {
106
+ fs.copyFileSync(
107
+ path.join(CONFIG.SCHEMA_FOLDER, `${schemaFile}.json`),
108
+ path.join(CONFIG.COMMON_REPO_PATH, "schema.json")
109
+ );
110
+ }
111
+ };
112
+
113
+ /* ---------- BUILD (Compiler) ---------- */
114
+ const Build = {
115
+ run() {
116
+ Utils.run("npm run NonSec", CONFIG.COMMON_REPO_PATH);
117
+ }
118
+ };
119
+
120
+ /* ---------- PUBLISH (Deployer) ---------- */
121
+ const Publish = {
122
+ schema(versionPath, schemaFile) {
123
+ const schemaName = path.parse(schemaFile).name;
124
+ const targetDir = path.join(versionPath, schemaName);
125
+ const unProtectedDir = path.join(targetDir, "UnProtected");
126
+
127
+ Utils.ensureDir(unProtectedDir);
128
+
129
+ Utils.copyRecursive(
130
+ path.join(CONFIG.COMMON_REPO_PATH, "dist"),
131
+ unProtectedDir
132
+ );
133
+
134
+ fs.copyFileSync(
135
+ path.join(CONFIG.COMMON_REPO_PATH, "Menu", "index.html"),
136
+ path.join(targetDir, "index.html")
137
+ );
138
+ }
139
+ };
140
+
141
+ /* ---------- ORCHESTRATOR (Boss) ---------- */
142
+ const App = {
143
+ processSchema(versionPath, schemaFile) {
144
+ console.log(`\nProcessing ${schemaFile}`);
145
+ Schema.inject(schemaFile);
146
+ Build.run();
147
+ Publish.schema(versionPath, schemaFile);
148
+ console.log(`Done with ${schemaFile}`);
149
+ },
150
+
151
+ run() {
152
+ const version = Version.getNext();
153
+ console.log("Next Version:", version);
154
+
155
+ const versionPath = Version.createFolder(version);
156
+
157
+ Repo.prepare();
158
+
159
+ const schemas = Schema.readAll();
160
+ schemas.forEach(schema => this.processSchema(versionPath, schema));
161
+
162
+ console.log("\n✔ All schemas processed successfully");
163
+ }
164
+ };
165
+
166
+ App.run();
@@ -0,0 +1,38 @@
1
+ import fs from "fs";
2
+
3
+ const PREFIX = "V";
4
+ const ENV_FILE = ".env";
5
+
6
+ /* -------- STEP 1: GET NEXT VERSION -------- */
7
+ const dirs = fs.readdirSync("./", { withFileTypes: true })
8
+ .filter(d => d.isDirectory() && d.name.startsWith(PREFIX));
9
+
10
+ let max = 0;
11
+
12
+ dirs.forEach(d => {
13
+ const num = parseInt(d.name.replace(PREFIX, ""), 10);
14
+ if (!isNaN(num) && num > max) max = num;
15
+ });
16
+
17
+ const latestVersion = `${PREFIX}${max}`;
18
+ console.log("Next Version:", latestVersion);
19
+
20
+ /* -------- STEP 2: UPDATE .env -------- */
21
+ let envContent = "";
22
+
23
+ if (fs.existsSync(ENV_FILE)) {
24
+ envContent = fs.readFileSync(ENV_FILE, "utf8")
25
+ .split("\n")
26
+ .map(line =>
27
+ line.startsWith("VERSION=")
28
+ ? `VERSION=${latestVersion}`
29
+ : line
30
+ )
31
+ .join("\n");
32
+ } else {
33
+ envContent = `VERSION=${latestVersion}\n`;
34
+ };
35
+
36
+ fs.writeFileSync(ENV_FILE, envContent);
37
+
38
+ console.log(".env updated successfully ✔");
@@ -0,0 +1,108 @@
1
+ import fs from "fs";
2
+ import path from "path";
3
+
4
+ import { execSync } from "child_process";
5
+
6
+ /* ================= CONFIG ================= */
7
+ const PUBLIC_DIR = "Public";
8
+ const VERSION_PREFIX = "V";
9
+ const SCHEMA_DIR = "ui.json";
10
+ const COMMON_REPO = "VoltUiGulpV1";
11
+ const COMMON_REPO_GIT = `https://github.com/keshavsoft/${COMMON_REPO}`;
12
+ const COMMON_REPO_PATH = path.join("..", COMMON_REPO);
13
+ /* ========================================== */
14
+
15
+ function run(cmd, cwd = process.cwd()) {
16
+ console.log(`> ${cmd}`);
17
+ execSync(cmd, { stdio: "inherit", cwd });
18
+ }
19
+
20
+ /* ---------- STEP 1: GET NEXT VERSION ---------- */
21
+ let max = 0;
22
+
23
+ if (fs.existsSync(PUBLIC_DIR)) {
24
+ fs.readdirSync(PUBLIC_DIR, { withFileTypes: true })
25
+ .filter(d => d.isDirectory() && d.name.startsWith(VERSION_PREFIX))
26
+ .forEach(d => {
27
+ const n = parseInt(d.name.replace(VERSION_PREFIX, ""), 10);
28
+ if (!isNaN(n) && n > max) max = n;
29
+ });
30
+ };
31
+
32
+ const nextVersion = `${VERSION_PREFIX}${max + 1}`;
33
+ console.log("Next Version:", nextVersion);
34
+
35
+ const versionPath = path.join(PUBLIC_DIR, nextVersion);
36
+ fs.mkdirSync(versionPath, { recursive: true });
37
+
38
+ /* ---------- STEP 2: CLONE COMMON REPO ---------- */
39
+ if (!fs.existsSync(COMMON_REPO_PATH)) {
40
+ console.log(`${COMMON_REPO} not found. Cloning...`);
41
+ run(`git clone ${COMMON_REPO_GIT} ${COMMON_REPO_PATH}`);
42
+ }
43
+
44
+ /* ---------- STEP 3: INSTALL DEPENDENCIES ---------- */
45
+ if (!fs.existsSync(path.join(COMMON_REPO_PATH, "node_modules"))) {
46
+ console.log("node_modules not found. Running npm install...");
47
+ run("npm install", COMMON_REPO_PATH);
48
+ }
49
+
50
+ /* ---------- STEP 4: COPY .env ---------- */
51
+ if (fs.existsSync(".env")) {
52
+ fs.copyFileSync(".env", path.join(COMMON_REPO_PATH, ".env"));
53
+ }
54
+
55
+ /* ---------- STEP 5: PROCESS SCHEMAS ---------- */
56
+ const uiJson = fs.readFileSync(SCHEMA_DIR);
57
+ const uiJsonParsed = JSON.parse(uiJson);
58
+
59
+ uiJsonParsed.Tables.forEach(schemaFile => {
60
+ const schemaName = path.parse(schemaFile).name;
61
+ console.log(`\nProcessing ${schemaFile}`);
62
+
63
+ /* Copy schema */
64
+ fs.copyFileSync(
65
+ path.join("Schemas", `${schemaFile}.json`),
66
+ path.join(COMMON_REPO_PATH, "schema.json")
67
+ );
68
+
69
+ /* Build */
70
+ run("npm run NonSec", COMMON_REPO_PATH);
71
+
72
+ /* Target dirs */
73
+ const targetDir = path.join(versionPath, schemaName);
74
+ const protectedDir = path.join(targetDir, "UnProtected");
75
+
76
+ fs.mkdirSync(protectedDir, { recursive: true });
77
+
78
+ /* Copy dist */
79
+ copyRecursive(
80
+ path.join(COMMON_REPO_PATH, "dist"),
81
+ protectedDir
82
+ );
83
+
84
+ /* Copy menu */
85
+ fs.copyFileSync(
86
+ path.join(COMMON_REPO_PATH, "Menu", "index.html"),
87
+ path.join(targetDir, "index.html")
88
+ );
89
+
90
+ console.log(`Done with ${schemaFile}`);
91
+ });
92
+
93
+ console.log("\n✔ All schemas processed successfully");
94
+
95
+ /* ---------- UTIL ---------- */
96
+ function copyRecursive(src, dest) {
97
+ fs.readdirSync(src, { withFileTypes: true }).forEach(entry => {
98
+ const srcPath = path.join(src, entry.name);
99
+ const destPath = path.join(dest, entry.name);
100
+
101
+ if (entry.isDirectory()) {
102
+ fs.mkdirSync(destPath, { recursive: true });
103
+ copyRecursive(srcPath, destPath);
104
+ } else {
105
+ fs.copyFileSync(srcPath, destPath);
106
+ }
107
+ });
108
+ };
@@ -0,0 +1,38 @@
1
+ import fs from "fs";
2
+
3
+ const PREFIX = "V";
4
+ const ENV_FILE = ".env";
5
+
6
+ /* -------- STEP 1: GET NEXT VERSION -------- */
7
+ const dirs = fs.readdirSync("./", { withFileTypes: true })
8
+ .filter(d => d.isDirectory() && d.name.startsWith(PREFIX));
9
+
10
+ let max = 0;
11
+
12
+ dirs.forEach(d => {
13
+ const num = parseInt(d.name.replace(PREFIX, ""), 10);
14
+ if (!isNaN(num) && num > max) max = num;
15
+ });
16
+
17
+ const latestVersion = `${PREFIX}${max}`;
18
+ console.log("Next Version:", latestVersion);
19
+
20
+ /* -------- STEP 2: UPDATE .env -------- */
21
+ let envContent = "";
22
+
23
+ if (fs.existsSync(ENV_FILE)) {
24
+ envContent = fs.readFileSync(ENV_FILE, "utf8")
25
+ .split("\n")
26
+ .map(line =>
27
+ line.startsWith("VERSION=")
28
+ ? `VERSION=${latestVersion}`
29
+ : line
30
+ )
31
+ .join("\n");
32
+ } else {
33
+ envContent = `VERSION=${latestVersion}\n`;
34
+ };
35
+
36
+ fs.writeFileSync(ENV_FILE, envContent);
37
+
38
+ console.log(".env updated successfully ✔");
@@ -0,0 +1,33 @@
1
+ import { kschema } from "@keshavsoft/kschema";
2
+ import consfigJson from './config.json' with { type: 'json' };
3
+
4
+ kschema.loadConfig(consfigJson);
5
+
6
+ import express from 'express';
7
+ import http from 'http';
8
+
9
+ const app = express();
10
+ const server = http.createServer(app);
11
+
12
+ var port = normalizePort(process.env.PORT || 3000);
13
+
14
+ app.use(express.static('Public'));
15
+
16
+ function normalizePort(val) {
17
+ var port = parseInt(val, 10);
18
+
19
+ if (isNaN(port)) {
20
+ return val;
21
+ }
22
+
23
+ if (port >= 0) {
24
+ return port;
25
+ }
26
+
27
+ return false;
28
+ };
29
+
30
+ server.listen(port, () => {
31
+ console.log(`Example app listening on port ${port}`);
32
+ console.log(`Open here http://localhost:${port}`);
33
+ });
@@ -0,0 +1,4 @@
1
+ {
2
+ "DataPath": "Data",
3
+ "SchemaPath": "Config/Schemas"
4
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "name": "KeshavSoft",
3
+ "version": "1.7.1",
4
+ "description": "",
5
+ "main": "app.js",
6
+ "type": "module",
7
+ "scripts": {
8
+ "test": "echo \"Error: no test specified\" && exit 1",
9
+ "start": "node --env-file=.env app.js"
10
+ },
11
+ "author": "",
12
+ "license": "ISC",
13
+ "dependencies": {
14
+ "@keshavsoft/kschema": "^1.6.1",
15
+ "body-parser": "^2.2.0",
16
+ "express": "^5.1.0"
17
+ }
18
+ }
@@ -0,0 +1,23 @@
1
+ import { decideTemplate } from "./express/steps/decideTemplate.js";
2
+
3
+ import { locateSource } from "./express/steps/locateSource.js";
4
+ import { locateDestination } from "./express/steps/locateDestination.js";
5
+ import { createProject } from "./express/steps/createProject.js";
6
+ import { announce } from "./express/steps/announce.js";
7
+
8
+ import resolveFolderName from "../core/resolveFolderName.js";
9
+
10
+ export default ({ template, folderName }) => {
11
+ const finalTemplate = decideTemplate({ inTemplate: template });
12
+
13
+ const resolvedFolderName = resolveFolderName({
14
+ name: folderName
15
+ });
16
+
17
+ const source = locateSource({ template: finalTemplate });
18
+ const destination = locateDestination({ inResolvedFolderName: resolvedFolderName });
19
+
20
+ createProject({ source, destination });
21
+
22
+ announce({ inResolvedFolderName: resolvedFolderName });
23
+ };
@@ -0,0 +1,26 @@
1
+ import fs from "fs";
2
+ import path from "path";
3
+
4
+ import { exampleSchema } from "@keshavsoft/kschema";
5
+ import { baseTemplate } from "./template/baseTemplate.js";
6
+
7
+ export default ({ args }) => {
8
+ const OUTPUT_DIR = path.resolve(process.cwd(), "samples");
9
+
10
+ if (!fs.existsSync(OUTPUT_DIR)) {
11
+ fs.mkdirSync(OUTPUT_DIR, { recursive: true });
12
+ };
13
+
14
+ Object.entries(exampleSchema).forEach(([intent, methods]) => {
15
+ Object.entries(methods).forEach(([key, meta]) => {
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
+ };
24
+ });
25
+ });
26
+ };
@@ -0,0 +1,3 @@
1
+ export const announce = ({ inResolvedFolderName }) => {
2
+ console.log(`[keshavsoft] Project created: ${inResolvedFolderName}`);
3
+ };
@@ -0,0 +1,7 @@
1
+ import fs from "fs";
2
+
3
+ export const createProject = ({ source, destination }) => {
4
+ fs.mkdirSync(destination, { recursive: true });
5
+
6
+ fs.cpSync(source, destination, { recursive: true });
7
+ };
@@ -0,0 +1,3 @@
1
+ export const decideTemplate = ({ inTemplate }) => {
2
+ return inTemplate || "basic";
3
+ };
@@ -0,0 +1,5 @@
1
+ import path from "path";
2
+
3
+ export const locateDestination = ({ inResolvedFolderName }) => {
4
+ return path.join(process.cwd(), inResolvedFolderName);
5
+ };
@@ -0,0 +1,13 @@
1
+ import path from "path";
2
+ import { fileURLToPath } from "url";
3
+
4
+ const __filename = fileURLToPath(import.meta.url);
5
+ const __dirname = path.dirname(__filename);
6
+
7
+ export const locateSource = () => {
8
+ return path.join(
9
+ __dirname,
10
+ "..",
11
+ "template"
12
+ );
13
+ };
@@ -0,0 +1,12 @@
1
+ {
2
+ "version": "0.2.0",
3
+ "configurations": [
4
+ {
5
+ "type": "node",
6
+ "request": "launch",
7
+ "name": "Debug App",
8
+ "program": "${workspaceFolder}/app.js",
9
+ "envFile": "${workspaceFolder}/.env"
10
+ }
11
+ ]
12
+ }