@kehto/cli 0.2.0 → 0.2.4
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/dist/index.d.ts +2 -1
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/package.json +14 -14
package/dist/index.d.ts
CHANGED
|
@@ -18,5 +18,6 @@ interface RunKehtoCliOptions {
|
|
|
18
18
|
* ```
|
|
19
19
|
*/
|
|
20
20
|
declare function runKehtoCli(args?: readonly string[], io?: CliIo, options?: RunKehtoCliOptions): Promise<number>;
|
|
21
|
+
declare function isDirectCli(entryPath?: string): boolean;
|
|
21
22
|
|
|
22
|
-
export { type RunKehtoCliOptions, runKehtoCli };
|
|
23
|
+
export { type RunKehtoCliOptions, isDirectCli, runKehtoCli };
|
package/dist/index.js
CHANGED
|
@@ -39,10 +39,12 @@ if (isDirectCli()) {
|
|
|
39
39
|
process.exitCode = code;
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
|
-
function isDirectCli() {
|
|
43
|
-
|
|
42
|
+
function isDirectCli(entryPath = process.argv[1]) {
|
|
43
|
+
if (!entryPath) return false;
|
|
44
|
+
return entryPath.endsWith("/index.js") || entryPath.endsWith("/kehto");
|
|
44
45
|
}
|
|
45
46
|
export {
|
|
47
|
+
isDirectCli,
|
|
46
48
|
runKehtoCli
|
|
47
49
|
};
|
|
48
50
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["#!/usr/bin/env node\nimport {\n runPajaCli,\n type CliIo,\n type RunPajaCliOptions,\n} from '@kehto/paja/cli';\n\nexport interface RunKehtoCliOptions {\n readonly paja?: RunPajaCliOptions;\n}\n\n/**\n * Run the top-level Kehto CLI command router.\n *\n * @param args - Argument vector without the node executable or script path.\n * @param io - Output streams used by the command.\n * @param options - Execution controls for embedded test runners.\n * @returns Process exit code.\n *\n * @example\n * ```ts\n * await runKehtoCli(['paja', '--target-url', 'http://127.0.0.1:5173']);\n * ```\n */\nexport async function runKehtoCli(\n args: readonly string[] = process.argv.slice(2),\n io: CliIo = defaultIo,\n options: RunKehtoCliOptions = {},\n): Promise<number> {\n const [command, ...rest] = args;\n\n if (!command || command === '--help' || command === '-h') {\n io.stdout.write(`${HELP_TEXT}\\n`);\n return 0;\n }\n\n if (command === 'paja') {\n return runPajaCli(rest, io, options.paja);\n }\n\n io.stderr.write(`kehto: unknown command \"${command}\". Run kehto --help for usage.\\n`);\n return 1;\n}\n\nconst HELP_TEXT = `Usage:\n kehto <command> [options]\n\nCommands:\n paja Run a napplet app inside the Paja local authoring workshop.\n\nExamples:\n kehto paja --target-url http://127.0.0.1:5173 -- pnpm vite --host 127.0.0.1\n kehto paja --config kehto.dev.json\n\nOptions:\n --help, -h Show this help.`;\n\nconst defaultIo: CliIo = {\n stdout: { write: (chunk) => process.stdout.write(chunk) },\n stderr: { write: (chunk) => process.stderr.write(chunk) },\n};\n\nif (isDirectCli()) {\n void runKehtoCli().then((code) => {\n process.exitCode = code;\n });\n}\n\
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["#!/usr/bin/env node\nimport {\n runPajaCli,\n type CliIo,\n type RunPajaCliOptions,\n} from '@kehto/paja/cli';\n\nexport interface RunKehtoCliOptions {\n readonly paja?: RunPajaCliOptions;\n}\n\n/**\n * Run the top-level Kehto CLI command router.\n *\n * @param args - Argument vector without the node executable or script path.\n * @param io - Output streams used by the command.\n * @param options - Execution controls for embedded test runners.\n * @returns Process exit code.\n *\n * @example\n * ```ts\n * await runKehtoCli(['paja', '--target-url', 'http://127.0.0.1:5173']);\n * ```\n */\nexport async function runKehtoCli(\n args: readonly string[] = process.argv.slice(2),\n io: CliIo = defaultIo,\n options: RunKehtoCliOptions = {},\n): Promise<number> {\n const [command, ...rest] = args;\n\n if (!command || command === '--help' || command === '-h') {\n io.stdout.write(`${HELP_TEXT}\\n`);\n return 0;\n }\n\n if (command === 'paja') {\n return runPajaCli(rest, io, options.paja);\n }\n\n io.stderr.write(`kehto: unknown command \"${command}\". Run kehto --help for usage.\\n`);\n return 1;\n}\n\nconst HELP_TEXT = `Usage:\n kehto <command> [options]\n\nCommands:\n paja Run a napplet app inside the Paja local authoring workshop.\n\nExamples:\n kehto paja --target-url http://127.0.0.1:5173 -- pnpm vite --host 127.0.0.1\n kehto paja --config kehto.dev.json\n\nOptions:\n --help, -h Show this help.`;\n\nconst defaultIo: CliIo = {\n stdout: { write: (chunk) => process.stdout.write(chunk) },\n stderr: { write: (chunk) => process.stderr.write(chunk) },\n};\n\nif (isDirectCli()) {\n void runKehtoCli().then((code) => {\n process.exitCode = code;\n });\n}\n\nexport function isDirectCli(entryPath = process.argv[1]): boolean {\n if (!entryPath) return false;\n return entryPath.endsWith('/index.js') || entryPath.endsWith('/kehto');\n}\n\ndeclare const process: {\n argv: string[];\n exitCode?: number;\n stdout: { write(chunk: string): void };\n stderr: { write(chunk: string): void };\n};\n"],"mappings":";;;AACA;AAAA,EACE;AAAA,OAGK;AAmBP,eAAsB,YACpB,OAA0B,QAAQ,KAAK,MAAM,CAAC,GAC9C,KAAY,WACZ,UAA8B,CAAC,GACd;AACjB,QAAM,CAAC,SAAS,GAAG,IAAI,IAAI;AAE3B,MAAI,CAAC,WAAW,YAAY,YAAY,YAAY,MAAM;AACxD,OAAG,OAAO,MAAM,GAAG,SAAS;AAAA,CAAI;AAChC,WAAO;AAAA,EACT;AAEA,MAAI,YAAY,QAAQ;AACtB,WAAO,WAAW,MAAM,IAAI,QAAQ,IAAI;AAAA,EAC1C;AAEA,KAAG,OAAO,MAAM,2BAA2B,OAAO;AAAA,CAAkC;AACpF,SAAO;AACT;AAEA,IAAM,YAAY;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAalB,IAAM,YAAmB;AAAA,EACvB,QAAQ,EAAE,OAAO,CAAC,UAAU,QAAQ,OAAO,MAAM,KAAK,EAAE;AAAA,EACxD,QAAQ,EAAE,OAAO,CAAC,UAAU,QAAQ,OAAO,MAAM,KAAK,EAAE;AAC1D;AAEA,IAAI,YAAY,GAAG;AACjB,OAAK,YAAY,EAAE,KAAK,CAAC,SAAS;AAChC,YAAQ,WAAW;AAAA,EACrB,CAAC;AACH;AAEO,SAAS,YAAY,YAAY,QAAQ,KAAK,CAAC,GAAY;AAChE,MAAI,CAAC,UAAW,QAAO;AACvB,SAAO,UAAU,SAAS,WAAW,KAAK,UAAU,SAAS,QAAQ;AACvE;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kehto/cli",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.4",
|
|
4
4
|
"description": "Top-level Kehto CLI for local napplet authoring and runtime tooling",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -24,27 +24,21 @@
|
|
|
24
24
|
"access": "public"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@kehto/paja": "
|
|
27
|
+
"@kehto/paja": "^0.3.4"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
|
-
"@napplet/core": ">=0.
|
|
31
|
-
"@napplet/nap": ">=0.
|
|
30
|
+
"@napplet/core": ">=0.23.0 <0.24.0",
|
|
31
|
+
"@napplet/nap": ">=0.23.0 <0.24.0",
|
|
32
32
|
"nostr-tools": ">=2.23.3 <3.0.0"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@napplet/core": "
|
|
36
|
-
"@napplet/nap": "
|
|
35
|
+
"@napplet/core": ">=0.23.0 <0.24.0",
|
|
36
|
+
"@napplet/nap": ">=0.23.0 <0.24.0",
|
|
37
37
|
"nostr-tools": "^2.23.3",
|
|
38
38
|
"tsup": "^8.5.0",
|
|
39
39
|
"typescript": "^5.9.3",
|
|
40
40
|
"vitest": "^4.1.2"
|
|
41
41
|
},
|
|
42
|
-
"scripts": {
|
|
43
|
-
"build": "tsup",
|
|
44
|
-
"type-check": "tsc --noEmit",
|
|
45
|
-
"test:unit": "cd ../.. && vitest run --config vitest.config.ts packages/cli",
|
|
46
|
-
"test": "pnpm test:unit"
|
|
47
|
-
},
|
|
48
42
|
"license": "MIT",
|
|
49
43
|
"repository": {
|
|
50
44
|
"type": "git",
|
|
@@ -58,5 +52,11 @@
|
|
|
58
52
|
"cli",
|
|
59
53
|
"paja",
|
|
60
54
|
"development"
|
|
61
|
-
]
|
|
62
|
-
|
|
55
|
+
],
|
|
56
|
+
"scripts": {
|
|
57
|
+
"build": "tsup",
|
|
58
|
+
"type-check": "tsc --noEmit",
|
|
59
|
+
"test:unit": "cd ../.. && vitest run --config vitest.config.ts packages/cli",
|
|
60
|
+
"test": "pnpm test:unit"
|
|
61
|
+
}
|
|
62
|
+
}
|