json-crud-ui-components 1.2.2 → 1.4.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 (109) hide show
  1. package/bin/cli.js +1 -1
  2. package/bin/{v2 → v3}/commands/addListeners/steps/resolveFolderName.js +1 -1
  3. package/bin/{v2 → v3}/commands/init.js +1 -0
  4. package/bin/v3/core/resolveCommand.js +16 -0
  5. package/bin/{v2 → v3}/start.js +0 -1
  6. package/bin/v4/commands/addListeners/steps/announce.js +3 -0
  7. package/bin/v4/commands/addListeners/steps/checks.js +25 -0
  8. package/bin/v4/commands/addListeners/steps/createProject.js +7 -0
  9. package/bin/v4/commands/addListeners/steps/locateDestination.js +5 -0
  10. package/bin/v4/commands/addListeners/steps/locateSource.js +32 -0
  11. package/bin/v4/commands/addListeners/steps/resolveFolderName.js +17 -0
  12. package/bin/v4/commands/addListeners/template/v2/start.js +4 -0
  13. package/bin/v4/commands/addListeners.js +25 -0
  14. package/bin/v4/commands/buildHeader/steps/announce.js +3 -0
  15. package/bin/v4/commands/buildHeader/steps/createProject.js +7 -0
  16. package/bin/v4/commands/buildHeader/steps/locateDestination.js +5 -0
  17. package/bin/v4/commands/buildHeader/steps/locateSource.js +32 -0
  18. package/bin/v4/commands/buildHeader/steps/resolveFolderName.js +17 -0
  19. package/bin/v4/commands/buildHeader/template/v1/buildHeader.js +68 -0
  20. package/bin/v4/commands/buildHeader.js +20 -0
  21. package/bin/v4/commands/htmlIdClick/steps/announce.js +3 -0
  22. package/bin/v4/commands/htmlIdClick/steps/checks.js +25 -0
  23. package/bin/v4/commands/htmlIdClick/steps/createProject.js +7 -0
  24. package/bin/v4/commands/htmlIdClick/steps/locateDestination.js +5 -0
  25. package/bin/v4/commands/htmlIdClick/steps/locateSource.js +32 -0
  26. package/bin/v4/commands/htmlIdClick/steps/resolveFolderName.js +14 -0
  27. package/bin/v4/commands/htmlIdClick/template/v1/clickFunc.js +4 -0
  28. package/bin/v4/commands/htmlIdClick/template/v1/start.js +9 -0
  29. package/bin/v4/commands/htmlIdClick.js +32 -0
  30. package/bin/v4/commands/init/steps/announce.js +3 -0
  31. package/bin/v4/commands/init/steps/checks.js +23 -0
  32. package/bin/v4/commands/init/steps/createProject.js +7 -0
  33. package/bin/v4/commands/init/steps/locateDestination.js +5 -0
  34. package/bin/v4/commands/init/steps/locateSource.js +32 -0
  35. package/bin/v4/commands/init/steps/resolveFolderName.js +17 -0
  36. package/bin/v4/commands/init/template/v1/Index/FormLoad/DomContentLoaded/buildHeader.js +68 -0
  37. package/bin/v4/commands/init/template/v1/Index/FormLoad/DomContentLoaded/buildMenuItem.js +121 -0
  38. package/bin/v4/commands/init/template/v1/Index/FormLoad/DomContentLoaded/runAfterDomLoad.js +7 -0
  39. package/bin/v4/commands/init/template/v1/Index/FormLoad/DomContentLoaded/start.js +7 -0
  40. package/bin/v4/commands/init/template/v1/Index/FormLoad/start.js +5 -0
  41. package/bin/v4/commands/init/template/v1/Index/start.js +7 -0
  42. package/bin/v4/commands/init/template/v2/FormLoad/DomContentLoaded/buildHeader.js +68 -0
  43. package/bin/v4/commands/init/template/v2/FormLoad/DomContentLoaded/buildMenuItem.js +121 -0
  44. package/bin/v4/commands/init/template/v2/FormLoad/DomContentLoaded/runAfterDomLoad.js +7 -0
  45. package/bin/v4/commands/init/template/v2/FormLoad/DomContentLoaded/start.js +7 -0
  46. package/bin/v4/commands/init/template/v2/FormLoad/start.js +5 -0
  47. package/bin/v4/commands/init/template/v2/start.js +7 -0
  48. package/bin/v4/commands/init/template/v3/FormLoad/DomContentLoaded/buildHeader.js +58 -0
  49. package/bin/v4/commands/init/template/v3/FormLoad/DomContentLoaded/buildMenuItem.js +121 -0
  50. package/bin/v4/commands/init/template/v3/FormLoad/DomContentLoaded/runAfterDomLoad.js +7 -0
  51. package/bin/v4/commands/init/template/v3/FormLoad/DomContentLoaded/start.js +7 -0
  52. package/bin/v4/commands/init/template/v3/FormLoad/start.js +5 -0
  53. package/bin/v4/commands/init/template/v3/headers.json +45 -0
  54. package/bin/v4/commands/init/template/v3/start.js +7 -0
  55. package/bin/v4/commands/init.js +25 -0
  56. package/bin/v4/core/parseInput.js +9 -0
  57. package/bin/v4/core/resolveCommand.js +16 -0
  58. package/bin/v4/core/showUsage.js +49 -0
  59. package/bin/v4/start.js +24 -0
  60. package/package.json +1 -1
  61. package/bin/v2/commands/addListeners/template/v1/AddListeners/start.js +0 -14
  62. package/bin/v2/core/resolveCommand.js +0 -16
  63. /package/bin/{v2 → v3}/commands/addListeners/steps/announce.js +0 -0
  64. /package/bin/{v2 → v3}/commands/addListeners/steps/createProject.js +0 -0
  65. /package/bin/{v2 → v3}/commands/addListeners/steps/locateDestination.js +0 -0
  66. /package/bin/{v2 → v3}/commands/addListeners/steps/locateSource.js +0 -0
  67. /package/bin/{v2 → v3}/commands/addListeners/template/v2/start.js +0 -0
  68. /package/bin/{v2 → v3}/commands/addListeners.js +0 -0
  69. /package/bin/{v2 → v3}/commands/buildHeader/steps/announce.js +0 -0
  70. /package/bin/{v2 → v3}/commands/buildHeader/steps/createProject.js +0 -0
  71. /package/bin/{v2 → v3}/commands/buildHeader/steps/locateDestination.js +0 -0
  72. /package/bin/{v2 → v3}/commands/buildHeader/steps/locateSource.js +0 -0
  73. /package/bin/{v2 → v3}/commands/buildHeader/steps/resolveFolderName.js +0 -0
  74. /package/bin/{v2 → v3}/commands/buildHeader/template/v1/buildHeader.js +0 -0
  75. /package/bin/{v2 → v3}/commands/buildHeader.js +0 -0
  76. /package/bin/{v2 → v3}/commands/htmlIdClick/steps/announce.js +0 -0
  77. /package/bin/{v2 → v3}/commands/htmlIdClick/steps/createProject.js +0 -0
  78. /package/bin/{v2 → v3}/commands/htmlIdClick/steps/locateDestination.js +0 -0
  79. /package/bin/{v2 → v3}/commands/htmlIdClick/steps/locateSource.js +0 -0
  80. /package/bin/{v2 → v3}/commands/htmlIdClick/steps/resolveFolderName.js +0 -0
  81. /package/bin/{v2 → v3}/commands/htmlIdClick/template/v1/clickFunc.js +0 -0
  82. /package/bin/{v2 → v3}/commands/htmlIdClick/template/v1/start.js +0 -0
  83. /package/bin/{v2 → v3}/commands/htmlIdClick.js +0 -0
  84. /package/bin/{v2 → v3}/commands/init/steps/announce.js +0 -0
  85. /package/bin/{v2 → v3}/commands/init/steps/createProject.js +0 -0
  86. /package/bin/{v2 → v3}/commands/init/steps/locateDestination.js +0 -0
  87. /package/bin/{v2 → v3}/commands/init/steps/locateSource.js +0 -0
  88. /package/bin/{v2 → v3}/commands/init/steps/resolveFolderName.js +0 -0
  89. /package/bin/{v2 → v3}/commands/init/template/v1/Index/FormLoad/DomContentLoaded/buildHeader.js +0 -0
  90. /package/bin/{v2 → v3}/commands/init/template/v1/Index/FormLoad/DomContentLoaded/buildMenuItem.js +0 -0
  91. /package/bin/{v2 → v3}/commands/init/template/v1/Index/FormLoad/DomContentLoaded/runAfterDomLoad.js +0 -0
  92. /package/bin/{v2 → v3}/commands/init/template/v1/Index/FormLoad/DomContentLoaded/start.js +0 -0
  93. /package/bin/{v2 → v3}/commands/init/template/v1/Index/FormLoad/start.js +0 -0
  94. /package/bin/{v2 → v3}/commands/init/template/v1/Index/start.js +0 -0
  95. /package/bin/{v2 → v3}/commands/init/template/v2/FormLoad/DomContentLoaded/buildHeader.js +0 -0
  96. /package/bin/{v2 → v3}/commands/init/template/v2/FormLoad/DomContentLoaded/buildMenuItem.js +0 -0
  97. /package/bin/{v2 → v3}/commands/init/template/v2/FormLoad/DomContentLoaded/runAfterDomLoad.js +0 -0
  98. /package/bin/{v2 → v3}/commands/init/template/v2/FormLoad/DomContentLoaded/start.js +0 -0
  99. /package/bin/{v2 → v3}/commands/init/template/v2/FormLoad/start.js +0 -0
  100. /package/bin/{v2 → v3}/commands/init/template/v2/start.js +0 -0
  101. /package/bin/{v2 → v3}/commands/init/template/v3/FormLoad/DomContentLoaded/buildHeader.js +0 -0
  102. /package/bin/{v2 → v3}/commands/init/template/v3/FormLoad/DomContentLoaded/buildMenuItem.js +0 -0
  103. /package/bin/{v2 → v3}/commands/init/template/v3/FormLoad/DomContentLoaded/runAfterDomLoad.js +0 -0
  104. /package/bin/{v2 → v3}/commands/init/template/v3/FormLoad/DomContentLoaded/start.js +0 -0
  105. /package/bin/{v2 → v3}/commands/init/template/v3/FormLoad/start.js +0 -0
  106. /package/bin/{v2 → v3}/commands/init/template/v3/headers.json +0 -0
  107. /package/bin/{v2 → v3}/commands/init/template/v3/start.js +0 -0
  108. /package/bin/{v2 → v3}/core/parseInput.js +0 -0
  109. /package/bin/{v2 → v3}/core/showUsage.js +0 -0
@@ -0,0 +1,16 @@
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
+ const resolveCommand = (cmd) => {
13
+ return map[cmd] || null;
14
+ };
15
+
16
+ export default resolveCommand;
@@ -0,0 +1,49 @@
1
+ /*
2
+ JSON CRUD UI CLI – Entry Flow
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)
17
+ */
18
+
19
+ export default function showUsage(version) {
20
+ const g = "\x1b[32m";
21
+ const y = "\x1b[33m";
22
+ const c = "\x1b[36m";
23
+ const gray = "\x1b[90m";
24
+ const r = "\x1b[0m";
25
+
26
+ console.log(`
27
+ ${c}🚀 json-crud-ui-components v${version}${r}
28
+
29
+ ${y}Usage:${r}
30
+ ${g}npx json-crud-ui-components${r} <command>
31
+
32
+ ${y}Commands:${r}
33
+ ${g}init${r} Creates initial boilerplate structure
34
+ ${g}addListeners${r} Adds listeners boilerplate
35
+ ${g}buildHeader${r} Builds header structure
36
+ ${g}htmlIdClick${r} Adds htmlIdClick handler
37
+
38
+ ${y}Examples:${r}
39
+ ${gray}npx json-crud-ui-components init${r}
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}
45
+
46
+ ${y}Tip:${r}
47
+ ${gray}Run init first before feature commands${r}
48
+ `);
49
+ }
@@ -0,0 +1,24 @@
1
+ import parseInput from "./core/parseInput.js";
2
+ import showUsage from './core/showUsage.js';
3
+
4
+ import resolveCommand from "./core/resolveCommand.js";
5
+
6
+ import pkg from '../../package.json' with { type: 'json' };
7
+
8
+ const version = pkg.version;
9
+
10
+ const run = async () => {
11
+ const input = parseInput();
12
+
13
+ if (input.action === "--help" || input.action === "-h" || input.action === "help") return showUsage(version);
14
+
15
+ const command = resolveCommand(input.cmd);
16
+
17
+ if (!command) return (console.log(`Unknown command: ${input.cmd}\n`), showUsage(version));
18
+
19
+ await command({
20
+ folderName: input.folderName
21
+ });
22
+ };
23
+
24
+ export default run;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "json-crud-ui-components",
3
- "version": "1.2.2",
3
+ "version": "1.4.1",
4
4
  "description": "working on ui for our json crud using modules",
5
5
  "keywords": [
6
6
  "cli",
@@ -1,14 +0,0 @@
1
- import { funcToRun as funcToRunForLedgersHtmlId } from "./LedgersHtmlId/start.js";
2
- import { funcToRun as funcToRunForStockItemsHtmlId } from "./StockItemsHtmlId/start.js";
3
-
4
- import { funcToRun as funcToRunForImportHtmlId } from "./ImportHtmlId/start.js";
5
-
6
- const hookAllListeners = () => {
7
- funcToRunForLedgersHtmlId();
8
- funcToRunForStockItemsHtmlId();
9
-
10
- funcToRunForImportHtmlId();
11
-
12
- };
13
-
14
- export { hookAllListeners };
@@ -1,16 +0,0 @@
1
- import init from "../commands/init.js";
2
- import addListeners from "../commands/addListeners.js";
3
- import htmlIdClick from "../commands/htmlIdClick.js";
4
- import buildHeader from "../commands/buildHeader.js";
5
-
6
- // resolveCommand.js
7
- const map = {
8
- init,
9
- addListeners,
10
- htmlIdClick,
11
- buildHeader
12
- };
13
-
14
- export default function resolveCommand(cmd) {
15
- return map[cmd] || null;
16
- };
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes