@keshavsoft/kschema-cli 1.1.1 → 1.3.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/CHANGELOG.md +16 -30
- package/README.md +21 -78
- package/bin/cli.js +11 -10
- package/bin/v2/commands/init.js +20 -0
- package/bin/v2/commands/template/.vscode/launch.json +12 -0
- package/bin/v2/commands/template/Config/Schemas/LedgerNames.json +50 -0
- package/bin/v2/commands/template/Data/BillsTable.json +165 -0
- package/bin/v2/commands/template/Data/ItemsTable.json +200 -0
- package/bin/v2/commands/template/Data/LedgerNames.json +6 -0
- package/bin/v2/commands/template/Data/StockItems.json +45 -0
- package/bin/v2/commands/template/app.js +4 -0
- package/bin/v2/commands/template/package-lock.json +21 -0
- package/bin/v2/commands/template/package.json +13 -0
- package/bin/v2/commands/template/read.js +8 -0
- package/bin/v2/commands/template/write.js +8 -0
- package/bin/v2/commands/test.js +36 -0
- package/bin/v2/start.js +23 -0
- package/bin/v3/commands/init.js +30 -0
- package/bin/v3/commands/template/basic/.vscode/launch.json +12 -0
- package/bin/v3/commands/template/basic/Config/Schemas/BillsTable.json +165 -0
- package/bin/v3/commands/template/basic/Config/Schemas/ItemsTable.json +200 -0
- package/bin/v3/commands/template/basic/Config/Schemas/LedgerNames.json +50 -0
- package/bin/v3/commands/template/basic/Config/Schemas/StockItems.json +45 -0
- package/bin/v3/commands/template/basic/Config/api.json +8 -0
- package/bin/v3/commands/template/basic/Config/schema.json +8 -0
- package/bin/v3/commands/template/basic/Config/ui.json +8 -0
- package/bin/v3/commands/template/basic/Data/BillsTable.json +165 -0
- package/bin/v3/commands/template/basic/Data/ItemsTable.json +200 -0
- package/bin/v3/commands/template/basic/Data/LedgerNames.json +6 -0
- package/bin/v3/commands/template/basic/Data/StockItems.json +45 -0
- package/bin/v3/commands/template/basic/app.js +4 -0
- package/bin/v3/commands/template/basic/config.json +4 -0
- package/bin/v3/commands/template/basic/package-lock.json +21 -0
- package/bin/v3/commands/template/basic/package.json +13 -0
- package/bin/v3/commands/template/basic/read.js +8 -0
- package/bin/v3/commands/template/basic/write.js +8 -0
- package/bin/v3/commands/template/express/.env +8 -0
- package/bin/v3/commands/template/express/.env.local +7 -0
- package/bin/v3/commands/template/express/.vscode/launch.json +12 -0
- package/bin/v3/commands/template/express/Config/Schemas/BillsTable.json +166 -0
- package/bin/v3/commands/template/express/Config/Schemas/ItemsTable.json +206 -0
- package/bin/v3/commands/template/express/Config/Schemas/LedgerNames.json +50 -0
- package/bin/v3/commands/template/express/Config/Schemas/StockItems.json +45 -0
- package/bin/v3/commands/template/express/Config/api.json +8 -0
- package/bin/v3/commands/template/express/Config/schema.json +8 -0
- package/bin/v3/commands/template/express/Config/ui.json +8 -0
- package/bin/v3/commands/template/express/ForFrontEnd/NonSecured/Builder/build.js +6 -0
- package/bin/v3/commands/template/express/ForFrontEnd/NonSecured/Builder/config.js +12 -0
- package/bin/v3/commands/template/express/ForFrontEnd/NonSecured/Builder/main.js +29 -0
- package/bin/v3/commands/template/express/ForFrontEnd/NonSecured/Builder/publish.js +22 -0
- package/bin/v3/commands/template/express/ForFrontEnd/NonSecured/Builder/repo.js +20 -0
- package/bin/v3/commands/template/express/ForFrontEnd/NonSecured/Builder/schema.js +16 -0
- package/bin/v3/commands/template/express/ForFrontEnd/NonSecured/Builder/utils.js +26 -0
- package/bin/v3/commands/template/express/ForFrontEnd/NonSecured/Builder/version.js +25 -0
- package/bin/v3/commands/template/express/ForFrontEnd/NonSecured/buildAndCopy.js +166 -0
- package/bin/v3/commands/template/express/ForFrontEnd/NonSecured/latestVersion.js +38 -0
- package/bin/v3/commands/template/express/ForFrontEnd/Secured/buildProtected.js +108 -0
- package/bin/v3/commands/template/express/ForFrontEnd/Secured/latestVersion.js +38 -0
- package/bin/v3/commands/template/express/app.js +33 -0
- package/bin/v3/commands/template/express/config.json +4 -0
- package/bin/v3/commands/template/express/package.json +18 -0
- package/bin/v3/commands/test.js +36 -0
- package/bin/v3/start.js +27 -0
- package/package.json +2 -1
- package/src/template/v1/Config/Schemas/BillsTable.json +165 -0
- package/src/template/v1/Config/Schemas/ItemsTable.json +200 -0
- package/src/template/v1/Config/Schemas/StockItems.json +45 -0
- package/src/template/v1/Config/api.json +8 -0
- package/src/template/v1/Config/schema.json +8 -0
- package/src/template/v1/Config/ui.json +8 -0
- package/src/template/v1/config.json +4 -0
- package/template/v1/Config/Schemas/BillsTable.json +165 -0
- package/template/v1/Config/Schemas/ItemsTable.json +200 -0
- package/template/v1/Config/Schemas/LedgerNames.json +45 -0
- package/template/v1/Config/Schemas/StockItems.json +45 -0
- package/template/v1/Config/api.json +8 -0
- package/template/v1/Config/schema.json +8 -0
- package/template/v1/Config/ui.json +8 -0
- package/template/v1/config.json +4 -0
- package/template/v2/Config/Schemas/BillsTable.json +165 -0
- package/template/v2/Config/Schemas/ItemsTable.json +200 -0
- package/template/v2/Config/Schemas/LedgerNames.json +50 -0
- package/template/v2/Config/Schemas/StockItems.json +45 -0
- package/template/v2/Config/api.json +8 -0
- package/template/v2/Config/schema.json +8 -0
- package/template/v2/Config/ui.json +8 -0
- package/template/v2/Data/BillsTable.json +1 -0
- package/template/v2/Data/ItemsTable.json +1 -0
- package/template/v2/Data/LedgerNames.json +6 -0
- package/template/v2/Data/StockItems.json +1 -0
- package/template/v2/config.json +4 -0
- package/template/v2/delete.js +8 -0
- package/template/v2/package.json +15 -0
- package/template/v2/read.js +8 -0
- package/template/v2/write.js +8 -0
- package/index.js +0 -1
- package/src/core/configStore.js +0 -10
- package/src/utils/pathBuilder.js +0 -3
- package/src/v1/data/deleteData.js +0 -16
- package/src/v1/data/getData.js +0 -13
- package/src/v1/data/index.js +0 -4
- package/src/v1/data/insertData.js +0 -16
- package/src/v1/data/updateData.js +0 -20
- package/src/v1/index.js +0 -3
- package/src/v2/config/getSchema.js +0 -12
- package/src/v2/data/deleteData.js +0 -16
- package/src/v2/data/getData.js +0 -13
- package/src/v2/data/index.js +0 -4
- package/src/v2/data/insertData copy.js +0 -46
- package/src/v2/data/insertData.js +0 -52
- package/src/v2/data/updateData.js +0 -20
- package/src/v2/index.js +0 -3
- package/src/v3/config/getSchema.js +0 -12
- package/src/v3/data/deleteData.js +0 -16
- package/src/v3/data/getData.js +0 -13
- package/src/v3/data/index.js +0 -4
- package/src/v3/data/insertData.js +0 -27
- package/src/v3/data/updateData.js +0 -20
- package/src/v3/helpers/fileHelper.js +0 -11
- package/src/v3/helpers/pkHelper.js +0 -18
- package/src/v3/helpers/validateHelper.js +0 -20
- package/src/v3/index.js +0 -3
- package/src/v4/config/getSchema.js +0 -12
- package/src/v4/data/deleteData.js +0 -16
- package/src/v4/data/getData.js +0 -13
- package/src/v4/data/index.js +0 -4
- package/src/v4/data/insertData.js +0 -47
- package/src/v4/data/updateData.js +0 -20
- package/src/v4/helpers/fileHelper.js +0 -11
- package/src/v4/helpers/pkHelper.js +0 -18
- package/src/v4/helpers/recordHelper.js +0 -9
- package/src/v4/helpers/validateHelper.js +0 -15
- package/src/v4/index.js +0 -3
- package/src/v5/config/getSchema.js +0 -12
- package/src/v5/data/deleteData.js +0 -16
- package/src/v5/data/getData.js +0 -13
- package/src/v5/data/index.js +0 -8
- package/src/v5/data/insertData.js +0 -56
- package/src/v5/data/insertDataStrict.js +0 -63
- package/src/v5/data/updateData.js +0 -20
- package/src/v5/helpers/fileHelper.js +0 -11
- package/src/v5/helpers/pkHelper.js +0 -18
- package/src/v5/helpers/recordHelper.js +0 -9
- package/src/v5/helpers/validateHelper.js +0 -15
- package/src/v5/index.js +0 -3
- package/src/v6/config/getSchema.js +0 -12
- package/src/v6/data/deleteData.js +0 -16
- package/src/v6/data/getData.js +0 -13
- package/src/v6/data/index.js +0 -8
- package/src/v6/data/insertData.js +0 -56
- package/src/v6/data/insertDataStrict.js +0 -76
- package/src/v6/data/updateData.js +0 -20
- package/src/v6/helpers/fileHelper.js +0 -11
- package/src/v6/helpers/pkHelper.js +0 -18
- package/src/v6/helpers/recordHelper.js +0 -9
- package/src/v6/helpers/validateHelper.js +0 -15
- package/src/v6/index.js +0 -21
- package/src/v7/config/getSchema.js +0 -12
- package/src/v7/data/deleteData.js +0 -16
- package/src/v7/data/filterByColumns.js +0 -19
- package/src/v7/data/filterByPk.js +0 -16
- package/src/v7/data/findByColumns.js +0 -21
- package/src/v7/data/findByPk.js +0 -16
- package/src/v7/data/getData.js +0 -13
- package/src/v7/data/index.js +0 -11
- package/src/v7/data/insertData.js +0 -55
- package/src/v7/data/insertDataStrict.js +0 -73
- package/src/v7/data/updateData.js +0 -20
- package/src/v7/helpers/fileHelper.js +0 -16
- package/src/v7/helpers/pkHelper.js +0 -21
- package/src/v7/helpers/recordHelper.js +0 -15
- package/src/v7/helpers/validateHelper.js +0 -27
- package/src/v7/index.js +0 -27
- package/src/v8/config/getSchema.js +0 -12
- package/src/v8/data/deleteByColumnsData.js +0 -20
- package/src/v8/data/deleteData.js +0 -22
- package/src/v8/data/filterByColumns.js +0 -19
- package/src/v8/data/filterByPk.js +0 -16
- package/src/v8/data/findByColumns.js +0 -21
- package/src/v8/data/findByPk.js +0 -16
- package/src/v8/data/getData.js +0 -13
- package/src/v8/data/index.js +0 -12
- package/src/v8/data/insertData.js +0 -55
- package/src/v8/data/insertDataStrict.js +0 -73
- package/src/v8/data/updateData.js +0 -20
- package/src/v8/helpers/fileHelper.js +0 -16
- package/src/v8/helpers/pkHelper.js +0 -21
- package/src/v8/helpers/recordHelper.js +0 -15
- package/src/v8/helpers/validateHelper.js +0 -27
- package/src/v8/index.js +0 -43
- /package/{template → bin/v2/commands/template}/Config/Schemas/BillsTable.json +0 -0
- /package/{template → bin/v2/commands/template}/Config/Schemas/ItemsTable.json +0 -0
- /package/{template → bin/v2/commands/template}/Config/Schemas/StockItems.json +0 -0
- /package/{template → bin/v2/commands/template}/Config/api.json +0 -0
- /package/{template → bin/v2/commands/template}/Config/schema.json +0 -0
- /package/{template → bin/v2/commands/template}/Config/ui.json +0 -0
- /package/{template → bin/v2/commands/template}/config.json +0 -0
- /package/{template → src/template/v1}/Config/Schemas/LedgerNames.json +0 -0
|
@@ -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,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,36 @@
|
|
|
1
|
+
// commands/test.js
|
|
2
|
+
|
|
3
|
+
import fs from "fs";
|
|
4
|
+
import path from "path";
|
|
5
|
+
|
|
6
|
+
export default (arg) => {
|
|
7
|
+
const projectPath = arg
|
|
8
|
+
? path.resolve(process.cwd(), arg)
|
|
9
|
+
: process.cwd();
|
|
10
|
+
|
|
11
|
+
// 1. Check folder exists
|
|
12
|
+
if (!fs.existsSync(projectPath)) {
|
|
13
|
+
console.log("Invalid path");
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// 2. Check required structure
|
|
18
|
+
const hasConfigJson = fs.existsSync(
|
|
19
|
+
path.join(projectPath, "config.json")
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
const hasConfigFolder = fs.existsSync(
|
|
23
|
+
path.join(projectPath, "Config")
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
const hasSchemasFolder = fs.existsSync(
|
|
27
|
+
path.join(projectPath, "Config", "Schemas")
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
// 3. Final decision
|
|
31
|
+
if (hasConfigJson && hasConfigFolder && hasSchemasFolder) {
|
|
32
|
+
console.log("Already initialized");
|
|
33
|
+
} else {
|
|
34
|
+
console.log("Not initialized");
|
|
35
|
+
}
|
|
36
|
+
};
|
package/bin/v3/start.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import init from "./commands/init.js";
|
|
2
|
+
import test from "./commands/test.js";
|
|
3
|
+
|
|
4
|
+
const v3Func = () => {
|
|
5
|
+
const cmd = process.argv[2];
|
|
6
|
+
const template = process.argv[3];
|
|
7
|
+
const folderName = process.argv[4];
|
|
8
|
+
|
|
9
|
+
switch (cmd) {
|
|
10
|
+
case "init":
|
|
11
|
+
init({
|
|
12
|
+
inTemplate: template,
|
|
13
|
+
inFolderName: folderName
|
|
14
|
+
});
|
|
15
|
+
break;
|
|
16
|
+
|
|
17
|
+
case "test":
|
|
18
|
+
test(arg);
|
|
19
|
+
break;
|
|
20
|
+
|
|
21
|
+
default:
|
|
22
|
+
console.log("Usage: kschema <init|test> [name]");
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export { v3Func };
|
package/package.json
CHANGED
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
{
|
|
2
|
+
"tableName": "BillsTable",
|
|
3
|
+
"columns": [
|
|
4
|
+
{
|
|
5
|
+
"field": "LedgerName",
|
|
6
|
+
"title": "LedgerName",
|
|
7
|
+
"type": "text",
|
|
8
|
+
"isInput": false,
|
|
9
|
+
"isAutoFocus": true,
|
|
10
|
+
"WidthOptions": {
|
|
11
|
+
"inPx": 200
|
|
12
|
+
},
|
|
13
|
+
"defaultvalue": "Keshav",
|
|
14
|
+
"isDataList": true,
|
|
15
|
+
"dataListId": "LedgerNames",
|
|
16
|
+
"isConsider": true
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"field": "LedgerParentName",
|
|
20
|
+
"title": "LedgerParentName",
|
|
21
|
+
"type": "text",
|
|
22
|
+
"isInput": true,
|
|
23
|
+
"WidthOptions": {
|
|
24
|
+
"inPx": 200
|
|
25
|
+
},
|
|
26
|
+
"isConsider": true,
|
|
27
|
+
"showInUi": false
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"field": "LedgerGST",
|
|
31
|
+
"title": "LedgerGST",
|
|
32
|
+
"type": "text",
|
|
33
|
+
"isInput": true,
|
|
34
|
+
"isAutoFocus": true,
|
|
35
|
+
"WidthOptions": {
|
|
36
|
+
"inPx": 200
|
|
37
|
+
},
|
|
38
|
+
"isConsider": true,
|
|
39
|
+
"showInUi": false
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"field": "InvoiceNo",
|
|
43
|
+
"title": "InvoiceNo",
|
|
44
|
+
"type": "number",
|
|
45
|
+
"isInput": true,
|
|
46
|
+
"WidthOptions": {
|
|
47
|
+
"inPx": 200
|
|
48
|
+
},
|
|
49
|
+
"isConsider": true
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"field": "InvoiceDate",
|
|
53
|
+
"title": "InvoiceDate",
|
|
54
|
+
"isDate": true,
|
|
55
|
+
"type": "date",
|
|
56
|
+
"WidthOptions": {
|
|
57
|
+
"inPx": 200
|
|
58
|
+
},
|
|
59
|
+
"defaultvalue": "today",
|
|
60
|
+
"isConsider": true
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"field": "InvoiceStateCode",
|
|
64
|
+
"title": "InvoiceStateCode",
|
|
65
|
+
"defaultvalue": "37",
|
|
66
|
+
"isInput": true,
|
|
67
|
+
"WidthOptions": {
|
|
68
|
+
"inPx": 200
|
|
69
|
+
},
|
|
70
|
+
"isConsider": true,
|
|
71
|
+
"showInUi": false
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"field": "pk",
|
|
75
|
+
"title": "pk",
|
|
76
|
+
"primary": true
|
|
77
|
+
}
|
|
78
|
+
],
|
|
79
|
+
"data": [],
|
|
80
|
+
"Vertical": [
|
|
81
|
+
{
|
|
82
|
+
"field": "LedgerName",
|
|
83
|
+
"title": "LedgerName",
|
|
84
|
+
"type": "text",
|
|
85
|
+
"isInput": false,
|
|
86
|
+
"isAutoFocus": true,
|
|
87
|
+
"WidthOptions": {
|
|
88
|
+
"inPx": 200
|
|
89
|
+
},
|
|
90
|
+
"defaultvalue": "Keshav",
|
|
91
|
+
"isDataList": true,
|
|
92
|
+
"dataListId": "LedgerNames"
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"field": "LedgerParentName",
|
|
96
|
+
"title": "LedgerParentName",
|
|
97
|
+
"type": "text",
|
|
98
|
+
"isInput": true,
|
|
99
|
+
"WidthOptions": {
|
|
100
|
+
"inPx": 200
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
"field": "LedgerGST",
|
|
105
|
+
"title": "LedgerGST",
|
|
106
|
+
"type": "text",
|
|
107
|
+
"isInput": true,
|
|
108
|
+
"isAutoFocus": true,
|
|
109
|
+
"WidthOptions": {
|
|
110
|
+
"inPx": 200
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
"field": "InvoiceNo",
|
|
115
|
+
"title": "InvoiceNo",
|
|
116
|
+
"type": "number",
|
|
117
|
+
"isInput": true,
|
|
118
|
+
"WidthOptions": {
|
|
119
|
+
"inPx": 200
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
"field": "InvoiceDate",
|
|
124
|
+
"title": "InvoiceDate",
|
|
125
|
+
"isDate": true,
|
|
126
|
+
"type": "date",
|
|
127
|
+
"WidthOptions": {
|
|
128
|
+
"inPx": 200
|
|
129
|
+
},
|
|
130
|
+
"defaultvalue": "today"
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
"field": "InvoiceStateCode",
|
|
134
|
+
"title": "InvoiceStateCode",
|
|
135
|
+
"defaultvalue": "37",
|
|
136
|
+
"isInput": true,
|
|
137
|
+
"WidthOptions": {
|
|
138
|
+
"inPx": 200
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
],
|
|
142
|
+
"DataTableOptions": {
|
|
143
|
+
"Header": {
|
|
144
|
+
"autoFocus": "LedgerName"
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
"ForeignkeyTables": [
|
|
148
|
+
"ItemsTable"
|
|
149
|
+
],
|
|
150
|
+
"DependantTables": [
|
|
151
|
+
"LedgerNames"
|
|
152
|
+
],
|
|
153
|
+
"NonSecured": {
|
|
154
|
+
"SubRoutes": [
|
|
155
|
+
"ShowAll",
|
|
156
|
+
"Insert",
|
|
157
|
+
"Find",
|
|
158
|
+
"InsertAndReturnPk",
|
|
159
|
+
"FindWithForeignData",
|
|
160
|
+
"InsertToTally"
|
|
161
|
+
]
|
|
162
|
+
},
|
|
163
|
+
"PrimarykeyTableNames": [],
|
|
164
|
+
"PrimarykeyTables": []
|
|
165
|
+
}
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
{
|
|
2
|
+
"tableName": "ItemsTable",
|
|
3
|
+
"columns": [
|
|
4
|
+
{
|
|
5
|
+
"field": "StockItemName",
|
|
6
|
+
"title": "StockItemName",
|
|
7
|
+
"unique": false,
|
|
8
|
+
"type": "text",
|
|
9
|
+
"isInput": false,
|
|
10
|
+
"isAutoFocus": true,
|
|
11
|
+
"WidthOptions": {
|
|
12
|
+
"inPx": 300
|
|
13
|
+
},
|
|
14
|
+
"isDataList": true,
|
|
15
|
+
"dataListId": "StockItems",
|
|
16
|
+
"isConsider": true,
|
|
17
|
+
"showInUi": true
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"field": "Rate",
|
|
21
|
+
"title": "Rate",
|
|
22
|
+
"unique": false,
|
|
23
|
+
"type": "number",
|
|
24
|
+
"isNumber": true,
|
|
25
|
+
"ShowTotal": false,
|
|
26
|
+
"footerFormatter": "",
|
|
27
|
+
"showRupee": true,
|
|
28
|
+
"align": "right",
|
|
29
|
+
"WidthOptions": {
|
|
30
|
+
"inPx": 250
|
|
31
|
+
},
|
|
32
|
+
"isConsider": true,
|
|
33
|
+
"showInUi": true
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"field": "Qty",
|
|
37
|
+
"title": "Qty",
|
|
38
|
+
"unique": false,
|
|
39
|
+
"type": "number",
|
|
40
|
+
"isNumber": true,
|
|
41
|
+
"ShowTotal": true,
|
|
42
|
+
"footerFormatter": "TotalFormatter",
|
|
43
|
+
"showRupee": false,
|
|
44
|
+
"WidthOptions": {
|
|
45
|
+
"inPx": 200
|
|
46
|
+
},
|
|
47
|
+
"isConsider": true,
|
|
48
|
+
"showInUi": true
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"field": "Amount",
|
|
52
|
+
"title": "Amount",
|
|
53
|
+
"unique": false,
|
|
54
|
+
"type": "number",
|
|
55
|
+
"isNumber": true,
|
|
56
|
+
"ShowTotal": true,
|
|
57
|
+
"footerFormatter": "TotalFormatter",
|
|
58
|
+
"enterCal": "Rate*Qty",
|
|
59
|
+
"showRupee": true,
|
|
60
|
+
"align": "right",
|
|
61
|
+
"WidthOptions": {
|
|
62
|
+
"inPx": 250
|
|
63
|
+
},
|
|
64
|
+
"isConsider": true,
|
|
65
|
+
"showInUi": false
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"field": "TaxPer",
|
|
69
|
+
"title": "TaxPer",
|
|
70
|
+
"unique": false,
|
|
71
|
+
"type": "number",
|
|
72
|
+
"isNumber": true,
|
|
73
|
+
"defaultvalue": 18,
|
|
74
|
+
"isConsider": true,
|
|
75
|
+
"showInUi": true
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"field": "Uom",
|
|
79
|
+
"title": "Uom",
|
|
80
|
+
"unique": false,
|
|
81
|
+
"type": "number",
|
|
82
|
+
"isNumber": true,
|
|
83
|
+
"defaultvalue": 18,
|
|
84
|
+
"isConsider": true,
|
|
85
|
+
"showInUi": true
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
"field": "ParentPk",
|
|
89
|
+
"title": "ParentPk",
|
|
90
|
+
"unique": false,
|
|
91
|
+
"isConsider": true,
|
|
92
|
+
"showInUi": true
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"field": "pk",
|
|
96
|
+
"title": "pk",
|
|
97
|
+
"primary": true
|
|
98
|
+
}
|
|
99
|
+
],
|
|
100
|
+
"data": [],
|
|
101
|
+
"Vertical": [
|
|
102
|
+
{
|
|
103
|
+
"field": "StockItemName",
|
|
104
|
+
"title": "StockItemName",
|
|
105
|
+
"unique": false,
|
|
106
|
+
"type": "text",
|
|
107
|
+
"isInput": false,
|
|
108
|
+
"isAutoFocus": true,
|
|
109
|
+
"WidthOptions": {
|
|
110
|
+
"inPx": 300
|
|
111
|
+
},
|
|
112
|
+
"isDataList": true,
|
|
113
|
+
"dataListId": "StockItems"
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
"field": "Rate",
|
|
117
|
+
"title": "Rate",
|
|
118
|
+
"unique": false,
|
|
119
|
+
"type": "number",
|
|
120
|
+
"isNumber": true,
|
|
121
|
+
"ShowTotal": false,
|
|
122
|
+
"footerFormatter": "",
|
|
123
|
+
"showRupee": true,
|
|
124
|
+
"align": "right",
|
|
125
|
+
"WidthOptions": {
|
|
126
|
+
"inPx": 250
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
"field": "Qty",
|
|
131
|
+
"title": "Qty",
|
|
132
|
+
"unique": false,
|
|
133
|
+
"type": "number",
|
|
134
|
+
"isNumber": true,
|
|
135
|
+
"ShowTotal": true,
|
|
136
|
+
"footerFormatter": "TotalFormatter",
|
|
137
|
+
"showRupee": false,
|
|
138
|
+
"WidthOptions": {
|
|
139
|
+
"inPx": 200
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
"field": "Amount",
|
|
144
|
+
"title": "Amount",
|
|
145
|
+
"unique": false,
|
|
146
|
+
"type": "number",
|
|
147
|
+
"isNumber": true,
|
|
148
|
+
"ShowTotal": true,
|
|
149
|
+
"footerFormatter": "TotalFormatter",
|
|
150
|
+
"showRupee": true,
|
|
151
|
+
"align": "right",
|
|
152
|
+
"WidthOptions": {
|
|
153
|
+
"inPx": 250
|
|
154
|
+
}
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
"field": "TaxPer",
|
|
158
|
+
"title": "TaxPer",
|
|
159
|
+
"unique": false,
|
|
160
|
+
"type": "number",
|
|
161
|
+
"isNumber": true,
|
|
162
|
+
"defaultvalue": 18,
|
|
163
|
+
"isConsider": true,
|
|
164
|
+
"showInUi": true
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
"field": "Uom",
|
|
168
|
+
"title": "Uom",
|
|
169
|
+
"unique": false,
|
|
170
|
+
"type": "number",
|
|
171
|
+
"isNumber": true,
|
|
172
|
+
"defaultvalue": 18,
|
|
173
|
+
"isConsider": true,
|
|
174
|
+
"showInUi": true
|
|
175
|
+
}
|
|
176
|
+
],
|
|
177
|
+
"DataTableOptions": {
|
|
178
|
+
"Header": {
|
|
179
|
+
"autoFocus": "StockItemName"
|
|
180
|
+
}
|
|
181
|
+
},
|
|
182
|
+
"NonSecured": {
|
|
183
|
+
"SubRoutes": [
|
|
184
|
+
"ShowAll",
|
|
185
|
+
"Insert",
|
|
186
|
+
"InsertAndReturnPk",
|
|
187
|
+
"InsertWithDefaults"
|
|
188
|
+
]
|
|
189
|
+
},
|
|
190
|
+
"DependantTables": [
|
|
191
|
+
"StockItems"
|
|
192
|
+
],
|
|
193
|
+
"ForeignkeyTables": [
|
|
194
|
+
"BillsTable"
|
|
195
|
+
],
|
|
196
|
+
"PrimarykeyTableNames": [
|
|
197
|
+
"BillsTable"
|
|
198
|
+
],
|
|
199
|
+
"PrimarykeyTables": []
|
|
200
|
+
}
|