express-todo 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 (80) hide show
  1. package/bin/{v2 → v3}/commands/simple/steps/locateSource.js +1 -1
  2. package/bin/v3/commands/simple/template/v1/package.json +22 -0
  3. package/bin/v4/commands/exportCommands/express.js +9 -0
  4. package/bin/v4/commands/simple/steps/announce.js +3 -0
  5. package/bin/v4/commands/simple/steps/createProject.js +7 -0
  6. package/bin/v4/commands/simple/steps/locateDestination.js +5 -0
  7. package/bin/v4/commands/simple/steps/locateSource.js +32 -0
  8. package/bin/v4/commands/simple/template/v1/.env +9 -0
  9. package/bin/v4/commands/simple/template/v1/.env.local +7 -0
  10. package/bin/v4/commands/simple/template/v1/.vscode/launch.json +12 -0
  11. package/bin/v4/commands/simple/template/v1/Config/Schemas/BillsTable.json +165 -0
  12. package/bin/v4/commands/simple/template/v1/Config/Schemas/ItemsTable.json +200 -0
  13. package/bin/v4/commands/simple/template/v1/Config/Schemas/LedgerNames.json +60 -0
  14. package/bin/v4/commands/simple/template/v1/Config/Schemas/StockItems.json +50 -0
  15. package/bin/v4/commands/simple/template/v1/Config/api.json +8 -0
  16. package/bin/v4/commands/simple/template/v1/Config/schema.json +8 -0
  17. package/bin/v4/commands/simple/template/v1/Config/ui.json +8 -0
  18. package/bin/v4/commands/simple/template/v1/Public/index.html +129 -0
  19. package/bin/v4/commands/simple/template/v1/app.js +19 -0
  20. package/bin/v4/commands/simple/template/v1/config.json +4 -0
  21. package/bin/v4/commands/simple/template/v1/configLoader.js +6 -0
  22. package/bin/v4/commands/simple/template/v1/package-lock.json +834 -0
  23. package/bin/v4/commands/simple/template/v1/package.json +22 -0
  24. package/bin/v4/commands/simple/template/v1/port.js +6 -0
  25. package/bin/v4/commands/simple/template/v1/routes.js +5 -0
  26. package/bin/v4/commands/simple/template/v1/server.js +13 -0
  27. package/bin/v4/commands/simple/template/v2/.env +9 -0
  28. package/bin/v4/commands/simple/template/v2/.env.local +7 -0
  29. package/bin/v4/commands/simple/template/v2/.vscode/launch.json +12 -0
  30. package/bin/v4/commands/simple/template/v2/Config/Schemas/BillsTable.json +165 -0
  31. package/bin/v4/commands/simple/template/v2/Config/Schemas/ItemsTable.json +200 -0
  32. package/bin/v4/commands/simple/template/v2/Config/Schemas/LedgerNames.json +60 -0
  33. package/bin/v4/commands/simple/template/v2/Config/Schemas/StockItems.json +50 -0
  34. package/bin/v4/commands/simple/template/v2/Config/api.json +8 -0
  35. package/bin/v4/commands/simple/template/v2/Config/schema.json +8 -0
  36. package/bin/v4/commands/simple/template/v2/Config/ui.json +8 -0
  37. package/bin/v4/commands/simple/template/v2/Public/index.html +129 -0
  38. package/bin/v4/commands/simple/template/v2/app.js +19 -0
  39. package/bin/v4/commands/simple/template/v2/config.json +4 -0
  40. package/bin/v4/commands/simple/template/v2/configLoader.js +6 -0
  41. package/bin/v4/commands/simple/template/v2/package-lock.json +834 -0
  42. package/bin/{v2/commands/simple/template/v7 → v4/commands/simple/template/v2}/package.json +3 -2
  43. package/bin/v4/commands/simple/template/v2/port.js +6 -0
  44. package/bin/v4/commands/simple/template/v2/routes.js +5 -0
  45. package/bin/v4/commands/simple/template/v2/server.js +13 -0
  46. package/bin/v4/commands/simple.js +19 -0
  47. package/bin/v4/core/parseInput.js +10 -0
  48. package/bin/v4/core/resolveCommand.js +10 -0
  49. package/bin/v4/core/resolveFolderName.js +17 -0
  50. package/bin/v4/core/showUsage.js +39 -0
  51. package/bin/v4/start.js +22 -0
  52. package/package.json +1 -1
  53. /package/bin/{v2 → v3}/commands/exportCommands/express.js +0 -0
  54. /package/bin/{v2 → v3}/commands/simple/steps/announce.js +0 -0
  55. /package/bin/{v2 → v3}/commands/simple/steps/createProject.js +0 -0
  56. /package/bin/{v2 → v3}/commands/simple/steps/locateDestination.js +0 -0
  57. /package/bin/{v2/commands/simple/template/v7 → v3/commands/simple/template/v1}/.env +0 -0
  58. /package/bin/{v2/commands/simple/template/v7 → v3/commands/simple/template/v1}/.env.local +0 -0
  59. /package/bin/{v2/commands/simple/template/v7 → v3/commands/simple/template/v1}/.vscode/launch.json +0 -0
  60. /package/bin/{v2/commands/simple/template/v7 → v3/commands/simple/template/v1}/Config/Schemas/BillsTable.json +0 -0
  61. /package/bin/{v2/commands/simple/template/v7 → v3/commands/simple/template/v1}/Config/Schemas/ItemsTable.json +0 -0
  62. /package/bin/{v2/commands/simple/template/v7 → v3/commands/simple/template/v1}/Config/Schemas/LedgerNames.json +0 -0
  63. /package/bin/{v2/commands/simple/template/v7 → v3/commands/simple/template/v1}/Config/Schemas/StockItems.json +0 -0
  64. /package/bin/{v2/commands/simple/template/v7 → v3/commands/simple/template/v1}/Config/api.json +0 -0
  65. /package/bin/{v2/commands/simple/template/v7 → v3/commands/simple/template/v1}/Config/schema.json +0 -0
  66. /package/bin/{v2/commands/simple/template/v7 → v3/commands/simple/template/v1}/Config/ui.json +0 -0
  67. /package/bin/{v2/commands/simple/template/v7 → v3/commands/simple/template/v1}/Public/index.html +0 -0
  68. /package/bin/{v2/commands/simple/template/v7 → v3/commands/simple/template/v1}/app.js +0 -0
  69. /package/bin/{v2/commands/simple/template/v7 → v3/commands/simple/template/v1}/config.json +0 -0
  70. /package/bin/{v2/commands/simple/template/v7 → v3/commands/simple/template/v1}/configLoader.js +0 -0
  71. /package/bin/{v2/commands/simple/template/v7 → v3/commands/simple/template/v1}/package-lock.json +0 -0
  72. /package/bin/{v2/commands/simple/template/v7 → v3/commands/simple/template/v1}/port.js +0 -0
  73. /package/bin/{v2/commands/simple/template/v7 → v3/commands/simple/template/v1}/routes.js +0 -0
  74. /package/bin/{v2/commands/simple/template/v7 → v3/commands/simple/template/v1}/server.js +0 -0
  75. /package/bin/{v2 → v3}/commands/simple.js +0 -0
  76. /package/bin/{v2 → v3}/core/parseInput.js +0 -0
  77. /package/bin/{v2 → v3}/core/resolveCommand.js +0 -0
  78. /package/bin/{v2 → v3}/core/resolveFolderName.js +0 -0
  79. /package/bin/{v2 → v3}/core/showUsage.js +0 -0
  80. /package/bin/{v2 → v3}/start.js +0 -0
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "KeshavSoft",
3
- "version": "1.1.1",
3
+ "version": "1.4.1",
4
4
  "description": "",
5
5
  "main": "app.js",
6
6
  "type": "module",
@@ -16,6 +16,7 @@
16
16
  "express": "^5.1.0"
17
17
  },
18
18
  "devDependencies": {
19
- "@keshavsoft/kschema-api-gen": "^1.6.4"
19
+ "@keshavsoft/kschema-api-gen": "^1.6.4",
20
+ "tailwind-todo": "^1.3.1"
20
21
  }
21
22
  }
@@ -0,0 +1,6 @@
1
+ export default function normalizePort(val) {
2
+ const port = Number(val);
3
+ if (Number.isNaN(port)) return val;
4
+ if (port >= 0) return port;
5
+ return false;
6
+ };
@@ -0,0 +1,5 @@
1
+ import express from "express";
2
+
3
+ export default function setupRoutes(app) {
4
+ app.use(express.static('Public'));
5
+ };
@@ -0,0 +1,13 @@
1
+ import http from "http";
2
+ import normalizePort from "./port.js";
3
+
4
+ export default function startServer(app) {
5
+ const port = normalizePort(process.env.PORT || 3000);
6
+ const server = http.createServer(app);
7
+
8
+ server.listen(port, () => {
9
+ console.log(`http://localhost:${port}`);
10
+ });
11
+
12
+ return { port }; // 👈 add this
13
+ };
@@ -0,0 +1,19 @@
1
+ import { locateSource } from "./simple/steps/locateSource.js";
2
+ import { locateDestination } from "./simple/steps/locateDestination.js";
3
+ import { createProject } from "./simple/steps/createProject.js";
4
+ import { announce } from "./simple/steps/announce.js";
5
+
6
+ import resolveFolderName from "../core/resolveFolderName.js";
7
+
8
+ export default ({ folderName = "" }) => {
9
+ const resolvedFolderName = resolveFolderName({
10
+ name: folderName
11
+ });
12
+
13
+ const source = locateSource();
14
+ const destination = locateDestination({ inResolvedFolderName: resolvedFolderName });
15
+
16
+ createProject({ source, destination });
17
+
18
+ announce({ inResolvedFolderName: resolvedFolderName });
19
+ };
@@ -0,0 +1,10 @@
1
+ export default function parseInput() {
2
+ const [cmd, ...args] = process.argv.slice(2);
3
+
4
+ return {
5
+ cmd: cmd || null,
6
+ args,
7
+ template: cmd || null,
8
+ folderName: args[0] || null,
9
+ };
10
+ };
@@ -0,0 +1,10 @@
1
+ import simple from "../commands/simple.js";
2
+
3
+ // resolveCommand.js
4
+ const map = {
5
+ simple
6
+ };
7
+
8
+ export default function resolveCommand(cmd) {
9
+ return map[cmd] || null;
10
+ };
@@ -0,0 +1,17 @@
1
+ import fs from "fs";
2
+
3
+ export default function resolveFolderName({ name, inType = "basic" }) {
4
+ const defaultFolerName = `keshavsoft-${inType}-${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
+ };
@@ -0,0 +1,39 @@
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}🚀 express-todo v${version}${r}
26
+
27
+ ${y}Usage:${r}
28
+ ${g}npx @keshavsoft/express-todo${r} <command> [options]
29
+
30
+ ${y}Commands:${r}
31
+ ${g}simple${r} Initialize a new simple express app
32
+
33
+ ${y}Examples:${r}
34
+ ${gray}npx @keshavsoft/express-todo simple${r}
35
+
36
+ ${y}Tip:${r}
37
+ ${gray}npm i -g @keshavsoft/express-todo${r}
38
+ `);
39
+ }
@@ -0,0 +1,22 @@
1
+ import parseInput from "./core/parseInput.js";
2
+ import resolveCommand from "./core/resolveCommand.js";
3
+ import showUsage from './core/showUsage.js';
4
+ import pkg from '../../package.json' with { type: 'json' };
5
+
6
+ const version = pkg.version;
7
+
8
+ const run = async () => {
9
+ const input = parseInput();
10
+
11
+ if (!input.cmd) return showUsage(version);
12
+
13
+ if (input.cmd === "--help" || input.cmd === "-h" || input.cmd === "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(input);
20
+ };
21
+
22
+ export default run;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "express-todo",
3
- "version": "1.2.2",
3
+ "version": "1.4.1",
4
4
  "description": "CLI to scaffold projects using templates",
5
5
  "keywords": [
6
6
  "cli",
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes