json-crud-ui-components 1.4.3 → 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/bin/cli.js +1 -1
- package/bin/v5/commands/addListeners/steps/checks.js +25 -0
- package/bin/{v3/commands/addListeners/template/v2/start.js → v5/commands/addListeners/template/v2/hookAllListeners.js} +1 -1
- package/bin/{v3 → v5}/commands/addListeners.js +12 -0
- package/bin/v5/commands/htmlIdClick/steps/checks.js +25 -0
- package/bin/v5/commands/htmlIdClick/steps/resolveFolderName.js +14 -0
- package/bin/{v3 → v5}/commands/htmlIdClick.js +13 -1
- package/bin/v5/commands/init/steps/checks.js +23 -0
- package/bin/v5/commands/init/template/v4/index.html +48 -0
- package/bin/v5/commands/init/template/v4/tailwindcss-3.4.17.css +83 -0
- package/bin/{v3 → v5}/commands/init.js +4 -2
- package/bin/v5/commands/initHtml/steps/announce.js +3 -0
- package/bin/v5/commands/initHtml/steps/checks.js +23 -0
- package/bin/v5/commands/initHtml/steps/createProject.js +7 -0
- package/bin/v5/commands/initHtml/steps/locateDestination.js +5 -0
- package/bin/v5/commands/initHtml/steps/locateSource.js +32 -0
- package/bin/{v3/commands/htmlIdClick → v5/commands/initHtml}/steps/resolveFolderName.js +1 -1
- package/bin/{v3/commands/init/template/v1/Index → v5/commands/initHtml/template/v3}/FormLoad/DomContentLoaded/buildHeader.js +6 -16
- package/bin/{v3/commands/init/template/v1/Index → v5/commands/initHtml/template/v3}/FormLoad/DomContentLoaded/runAfterDomLoad.js +1 -1
- package/bin/v5/commands/initHtml/template/v3/headers.json +45 -0
- package/bin/v5/commands/initHtml/template/v4/index.html +48 -0
- package/bin/v5/commands/initHtml/template/v4/tailwindcss-3.4.17.css +83 -0
- package/bin/v5/commands/initHtml.js +25 -0
- package/bin/v5/commands/initJs/steps/announce.js +3 -0
- package/bin/v5/commands/initJs/steps/checks.js +23 -0
- package/bin/v5/commands/initJs/steps/createProject.js +7 -0
- package/bin/v5/commands/initJs/steps/locateDestination.js +5 -0
- package/bin/v5/commands/initJs/steps/locateSource.js +32 -0
- package/bin/v5/commands/initJs/steps/resolveFolderName.js +17 -0
- package/bin/{v3/commands/init/template/v2 → v5/commands/initJs/template/v3}/FormLoad/DomContentLoaded/buildHeader.js +6 -16
- package/bin/{v3/commands/init/template/v2 → v5/commands/initJs/template/v3}/FormLoad/DomContentLoaded/runAfterDomLoad.js +1 -1
- package/bin/v5/commands/initJs/template/v3/headers.json +45 -0
- package/bin/v5/commands/initJs.js +25 -0
- package/bin/v5/core/getAllVersions.js +12 -0
- package/bin/v5/core/showUsage.js +41 -0
- package/bin/{v3 → v5}/start.js +2 -0
- package/package.json +1 -1
- package/bin/v3/core/showUsage.js +0 -39
- /package/bin/{v3 → v5}/commands/addListeners/steps/announce.js +0 -0
- /package/bin/{v3 → v5}/commands/addListeners/steps/createProject.js +0 -0
- /package/bin/{v3 → v5}/commands/addListeners/steps/locateDestination.js +0 -0
- /package/bin/{v3 → v5}/commands/addListeners/steps/locateSource.js +0 -0
- /package/bin/{v3 → v5}/commands/addListeners/steps/resolveFolderName.js +0 -0
- /package/bin/{v3 → v5}/commands/buildHeader/steps/announce.js +0 -0
- /package/bin/{v3 → v5}/commands/buildHeader/steps/createProject.js +0 -0
- /package/bin/{v3 → v5}/commands/buildHeader/steps/locateDestination.js +0 -0
- /package/bin/{v3 → v5}/commands/buildHeader/steps/locateSource.js +0 -0
- /package/bin/{v3 → v5}/commands/buildHeader/steps/resolveFolderName.js +0 -0
- /package/bin/{v3 → v5}/commands/buildHeader/template/v1/buildHeader.js +0 -0
- /package/bin/{v3 → v5}/commands/buildHeader.js +0 -0
- /package/bin/{v3 → v5}/commands/htmlIdClick/steps/announce.js +0 -0
- /package/bin/{v3 → v5}/commands/htmlIdClick/steps/createProject.js +0 -0
- /package/bin/{v3 → v5}/commands/htmlIdClick/steps/locateDestination.js +0 -0
- /package/bin/{v3 → v5}/commands/htmlIdClick/steps/locateSource.js +0 -0
- /package/bin/{v3 → v5}/commands/htmlIdClick/template/v1/clickFunc.js +0 -0
- /package/bin/{v3 → v5}/commands/htmlIdClick/template/v1/start.js +0 -0
- /package/bin/{v3 → v5}/commands/init/steps/announce.js +0 -0
- /package/bin/{v3 → v5}/commands/init/steps/createProject.js +0 -0
- /package/bin/{v3 → v5}/commands/init/steps/locateDestination.js +0 -0
- /package/bin/{v3 → v5}/commands/init/steps/locateSource.js +0 -0
- /package/bin/{v3 → v5}/commands/init/steps/resolveFolderName.js +0 -0
- /package/bin/{v3 → v5}/commands/init/template/v3/FormLoad/DomContentLoaded/buildHeader.js +0 -0
- /package/bin/{v3/commands/init/template/v1/Index → v5/commands/init/template/v3}/FormLoad/DomContentLoaded/buildMenuItem.js +0 -0
- /package/bin/{v3 → v5}/commands/init/template/v3/FormLoad/DomContentLoaded/runAfterDomLoad.js +0 -0
- /package/bin/{v3/commands/init/template/v1/Index → v5/commands/init/template/v3}/FormLoad/DomContentLoaded/start.js +0 -0
- /package/bin/{v3/commands/init/template/v1/Index → v5/commands/init/template/v3}/FormLoad/start.js +0 -0
- /package/bin/{v3 → v5}/commands/init/template/v3/headers.json +0 -0
- /package/bin/{v3/commands/init/template/v1/Index → v5/commands/init/template/v3}/start.js +0 -0
- /package/bin/{v3/commands/init/template/v2 → v5/commands/initHtml/template/v3}/FormLoad/DomContentLoaded/buildMenuItem.js +0 -0
- /package/bin/{v3/commands/init/template/v2 → v5/commands/initHtml/template/v3}/FormLoad/DomContentLoaded/start.js +0 -0
- /package/bin/{v3/commands/init/template/v2 → v5/commands/initHtml/template/v3}/FormLoad/start.js +0 -0
- /package/bin/{v3/commands/init/template/v2 → v5/commands/initHtml/template/v3}/start.js +0 -0
- /package/bin/{v3/commands/init → v5/commands/initJs}/template/v3/FormLoad/DomContentLoaded/buildMenuItem.js +0 -0
- /package/bin/{v3/commands/init → v5/commands/initJs}/template/v3/FormLoad/DomContentLoaded/start.js +0 -0
- /package/bin/{v3/commands/init → v5/commands/initJs}/template/v3/FormLoad/start.js +0 -0
- /package/bin/{v3/commands/init → v5/commands/initJs}/template/v3/start.js +0 -0
- /package/bin/{v3 → v5}/core/parseInput.js +0 -0
- /package/bin/{v3 → v5}/core/resolveCommand.js +0 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { locateSource } from "./initHtml/steps/locateSource.js";
|
|
2
|
+
import { locateDestination } from "./initHtml/steps/locateDestination.js";
|
|
3
|
+
|
|
4
|
+
import { createProject } from "./initHtml/steps/createProject.js";
|
|
5
|
+
import { announce } from "./initHtml/steps/announce.js";
|
|
6
|
+
|
|
7
|
+
import resolveFolderName from "./initHtml/steps/resolveFolderName.js";
|
|
8
|
+
import checks from "./initHtml/steps/checks.js";
|
|
9
|
+
|
|
10
|
+
export default ({ folderName = "", toPath = process.cwd(), inAnnounce = true }) => {
|
|
11
|
+
const fromChecks = checks({ toPath, inAnnounce });
|
|
12
|
+
|
|
13
|
+
if (fromChecks) return false;
|
|
14
|
+
|
|
15
|
+
const resolvedFolderName = resolveFolderName({
|
|
16
|
+
name: folderName
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
const source = locateSource();
|
|
20
|
+
const destination = locateDestination({ inResolvedFolderName: resolvedFolderName });
|
|
21
|
+
|
|
22
|
+
createProject({ source, destination });
|
|
23
|
+
|
|
24
|
+
if (inAnnounce) announce({ inResolvedFolderName: resolvedFolderName });
|
|
25
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import path from "path";
|
|
2
|
+
import fs from "fs";
|
|
3
|
+
|
|
4
|
+
const validate = ({ toPath }) => {
|
|
5
|
+
const htmlPath = path.join(toPath, "index.html");
|
|
6
|
+
const indexPath = path.join(toPath, "index");
|
|
7
|
+
|
|
8
|
+
if (!fs.existsSync(htmlPath)) {
|
|
9
|
+
console.log("index.html not found");
|
|
10
|
+
|
|
11
|
+
return true;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
if (fs.existsSync(indexPath)) {
|
|
15
|
+
console.log("index folder found");
|
|
16
|
+
|
|
17
|
+
return true;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
return false;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export default validate;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
|
|
3
|
+
import path from "path";
|
|
4
|
+
import { fileURLToPath } from "url";
|
|
5
|
+
|
|
6
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
7
|
+
const __dirname = path.dirname(__filename);
|
|
8
|
+
|
|
9
|
+
const templatePath = path.join(
|
|
10
|
+
__dirname,
|
|
11
|
+
"..",
|
|
12
|
+
"template"
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
const versions = fs
|
|
16
|
+
.readdirSync(templatePath)
|
|
17
|
+
.filter(item => item.startsWith("v"));
|
|
18
|
+
|
|
19
|
+
const highestVersion =
|
|
20
|
+
versions.sort().at(-1);
|
|
21
|
+
|
|
22
|
+
const sourceVersion =
|
|
23
|
+
highestVersion;
|
|
24
|
+
|
|
25
|
+
export const locateSource = () => {
|
|
26
|
+
return path.join(
|
|
27
|
+
__dirname,
|
|
28
|
+
"..",
|
|
29
|
+
"template",
|
|
30
|
+
sourceVersion
|
|
31
|
+
);
|
|
32
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
|
|
3
|
+
export default function resolveFolderName({ name, inType = "basic" }) {
|
|
4
|
+
const defaultFolerName = "Index";
|
|
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
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { initHeader } from "../../../../../../header/v6/initHeader.js";
|
|
2
2
|
|
|
3
|
-
const buildHeader = () => {
|
|
4
|
-
const
|
|
3
|
+
const buildHeader = async () => {
|
|
4
|
+
const headerConfig1 = {
|
|
5
5
|
items: [
|
|
6
6
|
{
|
|
7
7
|
text: "ShowAll",
|
|
@@ -48,21 +48,11 @@ const buildHeader = () => {
|
|
|
48
48
|
]
|
|
49
49
|
};
|
|
50
50
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
const callKSHeader = async (config) => {
|
|
56
|
-
if (window.KSHeader?.initHeader) {
|
|
57
|
-
console.log("table loaded from window.KSTable");
|
|
51
|
+
const fromFetch = await fetch("./Index/headers.json");
|
|
52
|
+
const headerConfig = await fromFetch.json();
|
|
58
53
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
// const { initTableOnly } = await import("../../../../../../../../KSTableAi/V28/entry.js"); // local
|
|
62
|
-
const { initTableOnly } = await import("https://keshavsoft.github.io/KsJsTableAi/Public/kstable.js"); // local
|
|
63
|
-
|
|
64
|
-
return initTableOnly(config);
|
|
65
|
-
};
|
|
54
|
+
await initHeader(headerConfig);
|
|
55
|
+
// callKSHeader(headerConfig).then();
|
|
66
56
|
};
|
|
67
57
|
|
|
68
58
|
export { buildHeader };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"items": [
|
|
3
|
+
{
|
|
4
|
+
"text": "ShowAll",
|
|
5
|
+
"id": "ShowAllHtmlId",
|
|
6
|
+
"icon": [
|
|
7
|
+
"M4 6h16",
|
|
8
|
+
"M4 10h16",
|
|
9
|
+
"M4 14h10",
|
|
10
|
+
"M6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z"
|
|
11
|
+
]
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"text": "Search",
|
|
15
|
+
"id": "SearchHtmlId",
|
|
16
|
+
"icon": [
|
|
17
|
+
"M3 7l9 4 9-4",
|
|
18
|
+
"M3 7l9-4 9 4",
|
|
19
|
+
"M3 7v10l9 4 9-4V7",
|
|
20
|
+
"M12 11v10"
|
|
21
|
+
]
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"text": "Transactions",
|
|
25
|
+
"id": "1",
|
|
26
|
+
"icon": [
|
|
27
|
+
"M6 2h9l5 5v15a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2z",
|
|
28
|
+
"M14 2v6h6",
|
|
29
|
+
"M8 12h8",
|
|
30
|
+
"M8 16h8"
|
|
31
|
+
],
|
|
32
|
+
"href": "../../Transactions/V7/Create/index.html"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"text": "FromTally",
|
|
36
|
+
"id": "ImportHtmlId",
|
|
37
|
+
"icon": [
|
|
38
|
+
"M4 6h16",
|
|
39
|
+
"M4 10h16",
|
|
40
|
+
"M4 14h10",
|
|
41
|
+
"M6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z"
|
|
42
|
+
]
|
|
43
|
+
}
|
|
44
|
+
]
|
|
45
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { locateSource } from "./initJs/steps/locateSource.js";
|
|
2
|
+
import { locateDestination } from "./initJs/steps/locateDestination.js";
|
|
3
|
+
|
|
4
|
+
import { createProject } from "./initJs/steps/createProject.js";
|
|
5
|
+
import { announce } from "./initJs/steps/announce.js";
|
|
6
|
+
|
|
7
|
+
import resolveFolderName from "./initJs/steps/resolveFolderName.js";
|
|
8
|
+
import checks from "./initJs/steps/checks.js";
|
|
9
|
+
|
|
10
|
+
export default ({ folderName = "", toPath = process.cwd(), inAnnounce = true }) => {
|
|
11
|
+
const fromChecks = checks({ toPath, inAnnounce });
|
|
12
|
+
|
|
13
|
+
if (fromChecks) return false;
|
|
14
|
+
|
|
15
|
+
const resolvedFolderName = resolveFolderName({
|
|
16
|
+
name: folderName
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
const source = locateSource();
|
|
20
|
+
const destination = locateDestination({ inResolvedFolderName: resolvedFolderName });
|
|
21
|
+
|
|
22
|
+
createProject({ source, destination });
|
|
23
|
+
|
|
24
|
+
if (inAnnounce) announce({ inResolvedFolderName: resolvedFolderName });
|
|
25
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
|
|
3
|
+
const files = fs.readdirSync(new URL("../commands/", import.meta.url));
|
|
4
|
+
|
|
5
|
+
const entries = await Promise.all(
|
|
6
|
+
files.filter(f => f.endsWith(".js"))
|
|
7
|
+
.map(async f => [f.replace(".js", ""), (await import(`../commands/${f}`)).default])
|
|
8
|
+
);
|
|
9
|
+
|
|
10
|
+
const map = Object.fromEntries(entries);
|
|
11
|
+
|
|
12
|
+
export default map;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import allVersions from "./getAllVersions.js";
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
KSchema CLI – Dynamic Usage Renderer
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export default function showUsage(version) {
|
|
8
|
+
const g = "\x1b[32m";
|
|
9
|
+
const y = "\x1b[33m";
|
|
10
|
+
const c = "\x1b[36m";
|
|
11
|
+
const gray = "\x1b[90m";
|
|
12
|
+
const r = "\x1b[0m";
|
|
13
|
+
|
|
14
|
+
const commandLines = Object.entries(allVersions)
|
|
15
|
+
.map(([name]) =>
|
|
16
|
+
` ${g}${name.padEnd(20)}${r}`
|
|
17
|
+
)
|
|
18
|
+
.join("\n");
|
|
19
|
+
|
|
20
|
+
const exampleLines = Object.entries(allVersions)
|
|
21
|
+
.map(([name]) =>
|
|
22
|
+
` ${gray}npx @keshavsoft/express-todo ${name}${r}`
|
|
23
|
+
)
|
|
24
|
+
.join("\n");
|
|
25
|
+
|
|
26
|
+
console.log(`
|
|
27
|
+
${c}🚀 express-todo v${version}${r}
|
|
28
|
+
|
|
29
|
+
${y}Usage:${r}
|
|
30
|
+
${g}npx @keshavsoft/express-todo${r} <command> [options]
|
|
31
|
+
|
|
32
|
+
${y}Commands:${r}
|
|
33
|
+
${commandLines}
|
|
34
|
+
|
|
35
|
+
${y}Examples:${r}
|
|
36
|
+
${exampleLines}
|
|
37
|
+
|
|
38
|
+
${y}Tip:${r}
|
|
39
|
+
${gray}npm i -g @keshavsoft/express-todo${r}
|
|
40
|
+
`);
|
|
41
|
+
}
|
package/bin/{v3 → v5}/start.js
RENAMED
|
@@ -10,6 +10,8 @@ const version = pkg.version;
|
|
|
10
10
|
const run = async () => {
|
|
11
11
|
const input = parseInput();
|
|
12
12
|
|
|
13
|
+
if (!input.cmd) return showUsage(version);
|
|
14
|
+
|
|
13
15
|
if (input.action === "--help" || input.action === "-h" || input.action === "help") return showUsage(version);
|
|
14
16
|
|
|
15
17
|
const command = resolveCommand(input.cmd);
|
package/package.json
CHANGED
package/bin/v3/core/showUsage.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
KSchema CLI – Entry Flow
|
|
3
|
-
|
|
4
|
-
1. Read user input from terminal (parseInput)
|
|
5
|
-
2. If no command → show usage (first-time user safety)
|
|
6
|
-
3. If help flags → show usage (quick guidance)
|
|
7
|
-
4. Resolve command dynamically (no hardcoding logic)
|
|
8
|
-
5. If command not found → inform + guide back to usage
|
|
9
|
-
6. Execute command with parsed input
|
|
10
|
-
|
|
11
|
-
Goal:
|
|
12
|
-
- Zero confusion for user
|
|
13
|
-
- Single source of truth (showUsage)
|
|
14
|
-
- Easy to extend (just add commands, no core changes)
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
export default function showUsage(version) {
|
|
18
|
-
const g = "\x1b[32m";
|
|
19
|
-
const y = "\x1b[33m";
|
|
20
|
-
const c = "\x1b[36m";
|
|
21
|
-
const gray = "\x1b[90m";
|
|
22
|
-
const r = "\x1b[0m";
|
|
23
|
-
|
|
24
|
-
console.log(`
|
|
25
|
-
${c}🚀 json-crud-ui v${version}${r}
|
|
26
|
-
|
|
27
|
-
${y}Usage:${r}
|
|
28
|
-
${g}npx @keshavsoft/kschema-api-gen${r} <command> [options]
|
|
29
|
-
|
|
30
|
-
${y}Commands:${r}
|
|
31
|
-
${g}endPointsJs${r} Checks for end-points.js file in that location
|
|
32
|
-
|
|
33
|
-
${y}Examples:${r}
|
|
34
|
-
${gray}npx @keshavsoft/kschema-api-gen endPointsJs ShowAll${r}
|
|
35
|
-
|
|
36
|
-
${y}Tip:${r}
|
|
37
|
-
${gray}npm i -g @keshavsoft/kschema-api-gen${r}
|
|
38
|
-
`);
|
|
39
|
-
}
|
|
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
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/bin/{v3 → v5}/commands/init/template/v3/FormLoad/DomContentLoaded/runAfterDomLoad.js
RENAMED
|
File without changes
|
|
File without changes
|
/package/bin/{v3/commands/init/template/v1/Index → v5/commands/init/template/v3}/FormLoad/start.js
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/bin/{v3/commands/init/template/v2 → v5/commands/initHtml/template/v3}/FormLoad/start.js
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/bin/{v3/commands/init → v5/commands/initJs}/template/v3/FormLoad/DomContentLoaded/start.js
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|