@jskit-ai/create-app 0.1.14 → 0.1.15
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jskit-ai/create-app",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.15",
|
|
4
4
|
"description": "Scaffold minimal JSKIT app shells.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -20,9 +20,7 @@
|
|
|
20
20
|
"./server": "./src/server/index.js",
|
|
21
21
|
"./client": "./src/client/index.js"
|
|
22
22
|
},
|
|
23
|
-
"dependencies": {
|
|
24
|
-
"@jskit-ai/cli-runtime": "0.1.0"
|
|
25
|
-
},
|
|
23
|
+
"dependencies": {},
|
|
26
24
|
"engines": {
|
|
27
25
|
"node": "20.x"
|
|
28
26
|
},
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import process from "node:process";
|
|
2
2
|
|
|
3
3
|
function shellQuote(value) {
|
|
4
4
|
const raw = String(value ?? "");
|
|
@@ -11,4 +11,15 @@ function shellQuote(value) {
|
|
|
11
11
|
return `'${raw.replace(/'/g, "'\\''")}'`;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
+
async function runCliEntrypoint(runCli, argv = process.argv.slice(2)) {
|
|
15
|
+
if (typeof runCli !== "function") {
|
|
16
|
+
throw new TypeError("runCliEntrypoint requires a runCli function");
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const exitCode = await runCli(argv);
|
|
20
|
+
if (exitCode !== 0) {
|
|
21
|
+
process.exit(exitCode);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
14
25
|
export { shellQuote, runCliEntrypoint };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
function createCliError(message, { showUsage = false, exitCode = 1 } = {}) {
|
|
2
|
+
const error = new Error(String(message || "Unknown CLI error"));
|
|
3
|
+
error.name = "CliError";
|
|
4
|
+
error.showUsage = Boolean(showUsage);
|
|
5
|
+
error.exitCode = Number.isInteger(exitCode) ? exitCode : 1;
|
|
6
|
+
return error;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export { createCliError };
|
package/src/server/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import path from "node:path";
|
|
|
3
3
|
import process from "node:process";
|
|
4
4
|
import { createInterface } from "node:readline/promises";
|
|
5
5
|
import { fileURLToPath } from "node:url";
|
|
6
|
-
import { createCliError } from "
|
|
6
|
+
import { createCliError } from "./cliError.js";
|
|
7
7
|
import { shellQuote } from "./cliEntrypoint.js";
|
|
8
8
|
|
|
9
9
|
const DEFAULT_TEMPLATE = "base-shell";
|