@keshavsoft/kschema-cli 1.12.3 → 1.12.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/CHANGELOG.md +5 -1
- package/bin/v12/commands/express/steps/createProject.js +1 -0
- package/bin/v12/commands/express/steps/locateSource.js +2 -1
- package/bin/{v7/commands/template/basic → v12/commands/express/template/v1}/Config/Schemas/LedgerNames.json +10 -0
- package/bin/{v7/commands/template/basic/Data → v12/commands/express/template/v1/Config/Schemas}/StockItems.json +6 -1
- package/bin/v12/commands/express/template/{package.json → v1/package.json} +1 -1
- package/bin/v12/commands/express/template/v2/Config/Schemas/LedgerNames.json +60 -0
- package/bin/{v7/commands/template/basic → v12/commands/express/template/v2}/Config/Schemas/StockItems.json +6 -1
- package/bin/{v7/commands/template/express → v12/commands/express/template/v2}/app.js +4 -0
- package/bin/v12/commands/express/template/v2/package-lock.json +834 -0
- package/bin/{v7/commands/template/express → v12/commands/express/template/v2}/package.json +1 -1
- package/bin/v12/commands/express/template/v3/.env +8 -0
- package/bin/v12/commands/express/template/v3/.env.local +7 -0
- package/bin/v12/commands/express/template/v3/Api/routes.js +5 -0
- package/bin/v12/commands/express/template/v3/Config/Schemas/BillsTable.json +165 -0
- package/bin/v12/commands/express/template/v3/Config/Schemas/ItemsTable.json +200 -0
- package/bin/v12/commands/express/template/v3/Config/Schemas/LedgerNames.json +60 -0
- package/bin/v12/commands/express/template/v3/Config/Schemas/StockItems.json +50 -0
- package/bin/v12/commands/express/template/v3/app.js +12 -0
- package/bin/v12/commands/express/template/v3/configLoader.js +6 -0
- package/bin/v12/commands/express/template/v3/package-lock.json +834 -0
- package/bin/v12/commands/express/template/v3/package.json +18 -0
- package/bin/v12/commands/express/template/v3/port.js +6 -0
- package/bin/v12/commands/express/template/v3/routes.js +5 -0
- package/bin/v12/commands/express/template/v3/server.js +11 -0
- package/bin/v12/commands/express.js +2 -6
- package/package.json +1 -1
- package/bin/v12/commands/express/steps/decideTemplate.js +0 -3
- package/bin/v12/commands/express/template/Config/Schemas/BillsTable.json +0 -166
- package/bin/v12/commands/express/template/Config/Schemas/ItemsTable.json +0 -206
- package/bin/v12/commands/express/template/Config/Schemas/LedgerNames.json +0 -50
- package/bin/v12/commands/express/template/Config/Schemas/StockItems.json +0 -45
- package/bin/v7/commands/generateSamples.js +0 -21
- package/bin/v7/commands/init.js +0 -23
- package/bin/v7/commands/steps/announce.js +0 -3
- package/bin/v7/commands/steps/createProject.js +0 -6
- package/bin/v7/commands/steps/decideTemplate.js +0 -3
- package/bin/v7/commands/steps/locateDestination.js +0 -5
- package/bin/v7/commands/steps/locateSource.js +0 -14
- package/bin/v7/commands/template/baseTemplate.js +0 -11
- package/bin/v7/commands/template/basic/Data/LedgerNames.json +0 -6
- package/bin/v7/commands/template/basic/app.js +0 -4
- package/bin/v7/commands/template/basic/package-lock.json +0 -21
- package/bin/v7/commands/template/basic/package.json +0 -13
- package/bin/v7/commands/template/basic/read.js +0 -8
- package/bin/v7/commands/template/basic/write.js +0 -8
- package/bin/v7/commands/template/express/Config/Schemas/BillsTable.json +0 -166
- package/bin/v7/commands/template/express/Config/Schemas/ItemsTable.json +0 -206
- package/bin/v7/commands/template/express/Config/Schemas/LedgerNames.json +0 -50
- package/bin/v7/commands/template/express/Config/Schemas/StockItems.json +0 -45
- package/bin/v7/commands/template/express/ForFrontEnd/NonSecured/Builder/build.js +0 -6
- package/bin/v7/commands/template/express/ForFrontEnd/NonSecured/Builder/config.js +0 -12
- package/bin/v7/commands/template/express/ForFrontEnd/NonSecured/Builder/main.js +0 -29
- package/bin/v7/commands/template/express/ForFrontEnd/NonSecured/Builder/publish.js +0 -22
- package/bin/v7/commands/template/express/ForFrontEnd/NonSecured/Builder/repo.js +0 -20
- package/bin/v7/commands/template/express/ForFrontEnd/NonSecured/Builder/schema.js +0 -16
- package/bin/v7/commands/template/express/ForFrontEnd/NonSecured/Builder/utils.js +0 -26
- package/bin/v7/commands/template/express/ForFrontEnd/NonSecured/Builder/version.js +0 -25
- package/bin/v7/commands/template/express/ForFrontEnd/NonSecured/buildAndCopy.js +0 -166
- package/bin/v7/commands/template/express/ForFrontEnd/NonSecured/latestVersion.js +0 -38
- package/bin/v7/commands/template/express/ForFrontEnd/Secured/buildProtected.js +0 -108
- package/bin/v7/commands/template/express/ForFrontEnd/Secured/latestVersion.js +0 -38
- package/bin/v7/commands/test.js +0 -36
- package/bin/v7/core/parseInput.js +0 -10
- package/bin/v7/core/resolveCommand.js +0 -12
- package/bin/v7/core/resolveFolderName.js +0 -17
- package/bin/v7/start.js +0 -23
- /package/bin/v12/commands/express/template/{.env → v1/.env} +0 -0
- /package/bin/v12/commands/express/template/{.env.local → v1/.env.local} +0 -0
- /package/bin/v12/commands/express/template/{.vscode → v1/.vscode}/launch.json +0 -0
- /package/bin/{v7/commands/template/basic → v12/commands/express/template/v1}/Config/Schemas/BillsTable.json +0 -0
- /package/bin/{v7/commands/template/basic → v12/commands/express/template/v1}/Config/Schemas/ItemsTable.json +0 -0
- /package/bin/v12/commands/express/template/{Config → v1/Config}/api.json +0 -0
- /package/bin/v12/commands/express/template/{Config → v1/Config}/schema.json +0 -0
- /package/bin/v12/commands/express/template/{Config → v1/Config}/ui.json +0 -0
- /package/bin/v12/commands/express/template/{ForFrontEnd → v1/ForFrontEnd}/NonSecured/Builder/build.js +0 -0
- /package/bin/v12/commands/express/template/{ForFrontEnd → v1/ForFrontEnd}/NonSecured/Builder/config.js +0 -0
- /package/bin/v12/commands/express/template/{ForFrontEnd → v1/ForFrontEnd}/NonSecured/Builder/main.js +0 -0
- /package/bin/v12/commands/express/template/{ForFrontEnd → v1/ForFrontEnd}/NonSecured/Builder/publish.js +0 -0
- /package/bin/v12/commands/express/template/{ForFrontEnd → v1/ForFrontEnd}/NonSecured/Builder/repo.js +0 -0
- /package/bin/v12/commands/express/template/{ForFrontEnd → v1/ForFrontEnd}/NonSecured/Builder/schema.js +0 -0
- /package/bin/v12/commands/express/template/{ForFrontEnd → v1/ForFrontEnd}/NonSecured/Builder/utils.js +0 -0
- /package/bin/v12/commands/express/template/{ForFrontEnd → v1/ForFrontEnd}/NonSecured/Builder/version.js +0 -0
- /package/bin/v12/commands/express/template/{ForFrontEnd → v1/ForFrontEnd}/NonSecured/buildAndCopy.js +0 -0
- /package/bin/v12/commands/express/template/{ForFrontEnd → v1/ForFrontEnd}/NonSecured/latestVersion.js +0 -0
- /package/bin/v12/commands/express/template/{ForFrontEnd → v1/ForFrontEnd}/Secured/buildProtected.js +0 -0
- /package/bin/v12/commands/express/template/{ForFrontEnd → v1/ForFrontEnd}/Secured/latestVersion.js +0 -0
- /package/bin/v12/commands/express/template/{app.js → v1/app.js} +0 -0
- /package/bin/v12/commands/express/template/{config.json → v1/config.json} +0 -0
- /package/bin/{v7/commands/template/express → v12/commands/express/template/v2}/.env +0 -0
- /package/bin/{v7/commands/template/express → v12/commands/express/template/v2}/.env.local +0 -0
- /package/bin/{v7/commands/template/basic → v12/commands/express/template/v2}/.vscode/launch.json +0 -0
- /package/bin/{v7/commands/template/basic/Data → v12/commands/express/template/v2/Config/Schemas}/BillsTable.json +0 -0
- /package/bin/{v7/commands/template/basic/Data → v12/commands/express/template/v2/Config/Schemas}/ItemsTable.json +0 -0
- /package/bin/{v7/commands/template/basic → v12/commands/express/template/v2}/Config/api.json +0 -0
- /package/bin/{v7/commands/template/basic → v12/commands/express/template/v2}/Config/schema.json +0 -0
- /package/bin/{v7/commands/template/basic → v12/commands/express/template/v2}/Config/ui.json +0 -0
- /package/bin/{v7/commands/template/basic → v12/commands/express/template/v2}/config.json +0 -0
- /package/bin/{v7/commands/template/express → v12/commands/express/template/v3}/.vscode/launch.json +0 -0
- /package/bin/{v7/commands/template/express → v12/commands/express/template/v3}/Config/api.json +0 -0
- /package/bin/{v7/commands/template/express → v12/commands/express/template/v3}/Config/schema.json +0 -0
- /package/bin/{v7/commands/template/express → v12/commands/express/template/v3}/Config/ui.json +0 -0
- /package/bin/{v7/commands/template/express → v12/commands/express/template/v3}/config.json +0 -0
|
@@ -1,166 +0,0 @@
|
|
|
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();
|
|
@@ -1,38 +0,0 @@
|
|
|
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 ✔");
|
|
@@ -1,108 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,38 +0,0 @@
|
|
|
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 ✔");
|
package/bin/v7/commands/test.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import init from "../commands/init.js";
|
|
2
|
-
import test from "../commands/test.js";
|
|
3
|
-
// import generateSamples from "../commands/generateSamples.js";
|
|
4
|
-
|
|
5
|
-
const map = {
|
|
6
|
-
init,
|
|
7
|
-
test
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export default function resolveCommand(cmd) {
|
|
11
|
-
return map[cmd] || null;
|
|
12
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import fs from "fs";
|
|
2
|
-
|
|
3
|
-
export default function resolveFolderName({ name }) {
|
|
4
|
-
const defaultFolerName = `keshavsoft-basic-${Date.now()}`;
|
|
5
|
-
|
|
6
|
-
// case 1: force new → timestamp
|
|
7
|
-
if (name === null) {
|
|
8
|
-
name = defaultFolerName;
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
// case 2: user provided → strict
|
|
12
|
-
if (fs.existsSync(name)) {
|
|
13
|
-
throw new Error(`Folder already exists: ${name}`);
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
return name;
|
|
17
|
-
};
|
package/bin/v7/start.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import parseInput from "./core/parseInput.js";
|
|
2
|
-
import resolveCommand from "./core/resolveCommand.js";
|
|
3
|
-
|
|
4
|
-
const run = async () => {
|
|
5
|
-
const input = parseInput();
|
|
6
|
-
|
|
7
|
-
if (!input.cmd) {
|
|
8
|
-
console.log("Usage: kschema <init|test> [args]");
|
|
9
|
-
return;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
const command = resolveCommand(input.cmd);
|
|
13
|
-
|
|
14
|
-
if (!command) {
|
|
15
|
-
console.log(`Unknown command: ${input.cmd}`);
|
|
16
|
-
console.log("Usage: kschema <init|test> [args]");
|
|
17
|
-
return;
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
await command(input);
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
export default run;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/bin/v12/commands/express/template/{ForFrontEnd → v1/ForFrontEnd}/NonSecured/Builder/main.js
RENAMED
|
File without changes
|
|
File without changes
|
/package/bin/v12/commands/express/template/{ForFrontEnd → v1/ForFrontEnd}/NonSecured/Builder/repo.js
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/bin/v12/commands/express/template/{ForFrontEnd → v1/ForFrontEnd}/NonSecured/buildAndCopy.js
RENAMED
|
File without changes
|
|
File without changes
|
/package/bin/v12/commands/express/template/{ForFrontEnd → v1/ForFrontEnd}/Secured/buildProtected.js
RENAMED
|
File without changes
|
/package/bin/v12/commands/express/template/{ForFrontEnd → v1/ForFrontEnd}/Secured/latestVersion.js
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/bin/{v7/commands/template/basic → v12/commands/express/template/v2}/.vscode/launch.json
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/bin/{v7/commands/template/basic → v12/commands/express/template/v2}/Config/api.json
RENAMED
|
File without changes
|
/package/bin/{v7/commands/template/basic → v12/commands/express/template/v2}/Config/schema.json
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/bin/{v7/commands/template/express → v12/commands/express/template/v3}/.vscode/launch.json
RENAMED
|
File without changes
|
/package/bin/{v7/commands/template/express → v12/commands/express/template/v3}/Config/api.json
RENAMED
|
File without changes
|
/package/bin/{v7/commands/template/express → v12/commands/express/template/v3}/Config/schema.json
RENAMED
|
File without changes
|
/package/bin/{v7/commands/template/express → v12/commands/express/template/v3}/Config/ui.json
RENAMED
|
File without changes
|
|
File without changes
|