@keshavsoft/kschema-cli 1.13.3 → 1.13.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/bin/v13/commands/accounts/steps/announce.js +3 -0
- package/bin/v13/commands/accounts/steps/createProject.js +7 -0
- package/bin/v13/commands/accounts/steps/locateDestination.js +5 -0
- package/bin/v13/commands/accounts/steps/locateSource.js +16 -0
- package/bin/v13/commands/accounts/template/v6/.env +9 -0
- package/bin/v13/commands/accounts/template/v6/.env.local +7 -0
- package/bin/v13/commands/accounts/template/v6/.vscode/launch.json +12 -0
- package/bin/v13/commands/accounts/template/v6/Config/Schemas/BillsTable.json +165 -0
- package/bin/v13/commands/accounts/template/v6/Config/Schemas/ItemsTable.json +200 -0
- package/bin/v13/commands/accounts/template/v6/Config/Schemas/LedgerNames.json +60 -0
- package/bin/v13/commands/accounts/template/v6/Config/Schemas/StockItems.json +50 -0
- package/bin/v13/commands/accounts/template/v6/Config/api.json +8 -0
- package/bin/v13/commands/accounts/template/v6/Config/schema.json +8 -0
- package/bin/v13/commands/accounts/template/v6/Config/ui.json +8 -0
- package/bin/v13/commands/accounts/template/v6/Public/index.html +129 -0
- package/bin/v13/commands/accounts/template/v6/app.js +19 -0
- package/bin/v13/commands/accounts/template/v6/config.json +4 -0
- package/bin/v13/commands/accounts/template/v6/configLoader.js +6 -0
- package/bin/v13/commands/accounts/template/v6/package-lock.json +834 -0
- package/bin/v13/commands/accounts/template/v6/package.json +21 -0
- package/bin/v13/commands/accounts/template/v6/port.js +6 -0
- package/bin/v13/commands/accounts/template/v6/routes.js +5 -0
- package/bin/v13/commands/accounts/template/v6/server.js +13 -0
- package/bin/v13/commands/accounts/template/v7/.env +9 -0
- package/bin/v13/commands/accounts/template/v7/.env.local +7 -0
- package/bin/v13/commands/accounts/template/v7/.vscode/launch.json +12 -0
- package/bin/v13/commands/accounts/template/v7/Config/Schemas/journals.json +60 -0
- package/bin/v13/commands/accounts/template/v7/Config/api.json +8 -0
- package/bin/v13/commands/accounts/template/v7/Config/schema.json +8 -0
- package/bin/v13/commands/accounts/template/v7/Config/ui.json +8 -0
- package/bin/v13/commands/accounts/template/v7/Public/index.html +129 -0
- package/bin/v13/commands/accounts/template/v7/app.js +19 -0
- package/bin/v13/commands/accounts/template/v7/config.json +4 -0
- package/bin/v13/commands/accounts/template/v7/configLoader.js +6 -0
- package/bin/v13/commands/accounts/template/v7/package-lock.json +834 -0
- package/bin/v13/commands/accounts/template/v7/package.json +21 -0
- package/bin/v13/commands/accounts/template/v7/port.js +6 -0
- package/bin/v13/commands/accounts/template/v7/routes.js +5 -0
- package/bin/v13/commands/accounts/template/v7/server.js +13 -0
- package/bin/v13/commands/accounts.js +19 -0
- package/bin/v13/commands/express/template/v6/package.json +1 -1
- package/bin/v13/core/resolveCommand.js +3 -1
- package/bin/v13/core/showUsage.js +2 -0
- package/index.js +2 -1
- package/package.json +1 -1
- package/bin/v13/core/showUsageV1.js +0 -42
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "KeshavSoft",
|
|
3
|
+
"version": "1.17.12",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "app.js",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
|
9
|
+
"start": "node --env-file=.env app.js"
|
|
10
|
+
},
|
|
11
|
+
"author": "",
|
|
12
|
+
"license": "ISC",
|
|
13
|
+
"dependencies": {
|
|
14
|
+
"@keshavsoft/kschema": "^1.17.12",
|
|
15
|
+
"body-parser": "^2.2.0",
|
|
16
|
+
"express": "^5.1.0"
|
|
17
|
+
},
|
|
18
|
+
"devDependencies": {
|
|
19
|
+
"@keshavsoft/kschema-api-gen": "^1.6.4"
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -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 "./accounts/steps/locateSource.js";
|
|
2
|
+
import { locateDestination } from "./accounts/steps/locateDestination.js";
|
|
3
|
+
import { createProject } from "./accounts/steps/createProject.js";
|
|
4
|
+
import { announce } from "./accounts/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
|
+
};
|
|
@@ -3,6 +3,7 @@ import test from "../commands/test.js";
|
|
|
3
3
|
import generateSamples from "../commands/generateSamples.js";
|
|
4
4
|
import express from "../commands/express.js";
|
|
5
5
|
import tally from "../commands/tally.js";
|
|
6
|
+
import accounts from "../commands/accounts.js";
|
|
6
7
|
|
|
7
8
|
// resolveCommand.js
|
|
8
9
|
const map = {
|
|
@@ -10,7 +11,8 @@ const map = {
|
|
|
10
11
|
test,
|
|
11
12
|
"generate-samples": generateSamples,
|
|
12
13
|
express,
|
|
13
|
-
tally
|
|
14
|
+
tally,
|
|
15
|
+
accounts
|
|
14
16
|
};
|
|
15
17
|
|
|
16
18
|
export default function resolveCommand(cmd) {
|
|
@@ -32,10 +32,12 @@ ${y}Commands:${r}
|
|
|
32
32
|
${g}express${r} Initialize a new express project
|
|
33
33
|
${g}tally${r} Initialize a new tally project
|
|
34
34
|
${g}generate-samples${r} Generate sample schema files
|
|
35
|
+
${g}accounts${r} Initialize a new express project for simple accounting
|
|
35
36
|
|
|
36
37
|
${y}Examples:${r}
|
|
37
38
|
${gray}npx @keshavsoft/kschema-cli init${r}
|
|
38
39
|
${gray}npx @keshavsoft/kschema-cli test users${r}
|
|
40
|
+
${gray}npx @keshavsoft/kschema-cli accounts${r}
|
|
39
41
|
|
|
40
42
|
${y}Tip:${r}
|
|
41
43
|
${gray}npm i -g @keshavsoft/kschema-cli${r}
|
package/index.js
CHANGED
|
@@ -7,4 +7,5 @@ const load = async (cmd) => {
|
|
|
7
7
|
|
|
8
8
|
export const express = async (...a) => (await load("express"))(...a);
|
|
9
9
|
export const init = async (...a) => (await load("init"))(...a);
|
|
10
|
-
export const tally = async (...a) => (await load("tally"))(...a);
|
|
10
|
+
export const tally = async (...a) => (await load("tally"))(...a);
|
|
11
|
+
export const accounts = async (...a) => (await load("accounts"))(...a);
|
package/package.json
CHANGED
|
@@ -1,42 +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}🚀 KSchema CLI v${version}${r}
|
|
26
|
-
|
|
27
|
-
${y}Usage:${r}
|
|
28
|
-
${g}npx @keshavsoft/kschema-cli${r} <command> [options]
|
|
29
|
-
|
|
30
|
-
${y}Commands:${r}
|
|
31
|
-
${g}init${r} Initialize a new schema setup
|
|
32
|
-
${g}test${r} Run schema validations/tests
|
|
33
|
-
${g}generate-samples${r} Generate sample schema files
|
|
34
|
-
|
|
35
|
-
${y}Examples:${r}
|
|
36
|
-
${gray}npx @keshavsoft/kschema-cli init${r}
|
|
37
|
-
${gray}npx @keshavsoft/kschema-cli test users${r}
|
|
38
|
-
|
|
39
|
-
${y}Tip:${r}
|
|
40
|
-
${gray}npm i -g @keshavsoft/kschema-cli${r}
|
|
41
|
-
`);
|
|
42
|
-
}
|