json-crud-ui-components 1.5.1 → 1.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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/v5/commands/initHtml/steps/resolveFolderName.js +17 -0
- package/bin/v5/commands/initHtml/template/v3/FormLoad/DomContentLoaded/buildHeader.js +58 -0
- package/bin/v5/commands/initHtml/template/v3/FormLoad/DomContentLoaded/buildMenuItem.js +121 -0
- package/bin/v5/commands/initHtml/template/v3/FormLoad/DomContentLoaded/runAfterDomLoad.js +7 -0
- package/bin/v5/commands/initHtml/template/v3/FormLoad/DomContentLoaded/start.js +7 -0
- package/bin/v5/commands/initHtml/template/v3/FormLoad/start.js +5 -0
- package/bin/v5/commands/initHtml/template/v3/headers.json +45 -0
- package/bin/v5/commands/initHtml/template/v3/start.js +7 -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/core/getAllVersions.js +12 -0
- package/bin/v5/core/showUsage.js +20 -28
- package/bin/v5/start.js +2 -0
- package/package.json +1 -1
|
@@ -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,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;
|
package/bin/v5/core/showUsage.js
CHANGED
|
@@ -1,19 +1,7 @@
|
|
|
1
|
+
import allVersions from "./getAllVersions.js";
|
|
2
|
+
|
|
1
3
|
/*
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
1. Read user input from terminal (parseInput)
|
|
5
|
-
2. If no command → show usage
|
|
6
|
-
3. If help flags → show usage
|
|
7
|
-
4. Resolve command dynamically
|
|
8
|
-
5. If command not found → show usage
|
|
9
|
-
6. Validate command requirements
|
|
10
|
-
7. Execute command
|
|
11
|
-
|
|
12
|
-
Goal:
|
|
13
|
-
- Zero confusion for user
|
|
14
|
-
- Single source of truth (showUsage)
|
|
15
|
-
- Self-validating commands
|
|
16
|
-
- Easy to extend (drop-in command architecture)
|
|
4
|
+
KSchema CLI – Dynamic Usage Renderer
|
|
17
5
|
*/
|
|
18
6
|
|
|
19
7
|
export default function showUsage(version) {
|
|
@@ -23,27 +11,31 @@ export default function showUsage(version) {
|
|
|
23
11
|
const gray = "\x1b[90m";
|
|
24
12
|
const r = "\x1b[0m";
|
|
25
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
26
|
console.log(`
|
|
27
|
-
${c}🚀
|
|
27
|
+
${c}🚀 express-todo v${version}${r}
|
|
28
28
|
|
|
29
29
|
${y}Usage:${r}
|
|
30
|
-
${g}npx
|
|
30
|
+
${g}npx @keshavsoft/express-todo${r} <command> [options]
|
|
31
31
|
|
|
32
32
|
${y}Commands:${r}
|
|
33
|
-
|
|
34
|
-
${g}addListeners${r} Adds listeners boilerplate
|
|
35
|
-
${g}buildHeader${r} Builds header structure
|
|
36
|
-
${g}htmlIdClick${r} Adds htmlIdClick handler
|
|
33
|
+
${commandLines}
|
|
37
34
|
|
|
38
35
|
${y}Examples:${r}
|
|
39
|
-
|
|
40
|
-
${gray}npx json-crud-ui-components addListeners${r}
|
|
41
|
-
|
|
42
|
-
${y}Architecture:${r}
|
|
43
|
-
${gray}commands are auto-loaded dynamically${r}
|
|
44
|
-
${gray}each command validates required files${r}
|
|
36
|
+
${exampleLines}
|
|
45
37
|
|
|
46
38
|
${y}Tip:${r}
|
|
47
|
-
${gray}
|
|
39
|
+
${gray}npm i -g @keshavsoft/express-todo${r}
|
|
48
40
|
`);
|
|
49
41
|
}
|
package/bin/v5/start.js
CHANGED
|
@@ -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);
|