@aidoris/kineti-cli 0.0.1 → 0.0.2
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.js +39 -1
- package/package.json +2 -1
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { Command } from "commander";
|
|
|
6
6
|
// package.json
|
|
7
7
|
var package_default = {
|
|
8
8
|
name: "@aidoris/kineti-cli",
|
|
9
|
-
version: "0.0.
|
|
9
|
+
version: "0.0.2",
|
|
10
10
|
type: "module",
|
|
11
11
|
author: "Pranav Sukumara Kurup <pranavs.nkm@gmail.com>",
|
|
12
12
|
repository: {
|
|
@@ -44,6 +44,7 @@ var package_default = {
|
|
|
44
44
|
typecheck: "tsc --noEmit"
|
|
45
45
|
},
|
|
46
46
|
dependencies: {
|
|
47
|
+
"@aidoris/kineti-web": "workspace:*",
|
|
47
48
|
commander: "^14.0.3"
|
|
48
49
|
},
|
|
49
50
|
devDependencies: {
|
|
@@ -55,12 +56,49 @@ var package_default = {
|
|
|
55
56
|
}
|
|
56
57
|
};
|
|
57
58
|
|
|
59
|
+
// src/start-web.ts
|
|
60
|
+
import { spawn } from "child_process";
|
|
61
|
+
import { existsSync } from "fs";
|
|
62
|
+
import { createRequire } from "module";
|
|
63
|
+
import { dirname, join } from "path";
|
|
64
|
+
var require2 = createRequire(import.meta.url);
|
|
65
|
+
var resolveWebOutputDir = () => {
|
|
66
|
+
const packageJsonPath = require2.resolve("@aidoris/kineti-web/package.json");
|
|
67
|
+
return join(dirname(packageJsonPath), ".output");
|
|
68
|
+
};
|
|
69
|
+
var startWeb = (port) => {
|
|
70
|
+
const outputDir = resolveWebOutputDir();
|
|
71
|
+
const serverEntry = join(outputDir, "server/index.mjs");
|
|
72
|
+
if (!existsSync(serverEntry)) {
|
|
73
|
+
console.error(
|
|
74
|
+
"Kineti web is not built. Install a published @aidoris/kineti-web build or run `bun run build` in the monorepo."
|
|
75
|
+
);
|
|
76
|
+
process.exit(1);
|
|
77
|
+
}
|
|
78
|
+
console.log(`Starting Kineti web on http://localhost:${port}`);
|
|
79
|
+
const child = spawn(process.execPath, [serverEntry], {
|
|
80
|
+
cwd: outputDir,
|
|
81
|
+
stdio: "inherit",
|
|
82
|
+
env: {
|
|
83
|
+
...process.env,
|
|
84
|
+
PORT: port,
|
|
85
|
+
NITRO_PORT: port
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
child.on("exit", (code) => {
|
|
89
|
+
process.exit(code ?? 0);
|
|
90
|
+
});
|
|
91
|
+
};
|
|
92
|
+
|
|
58
93
|
// src/cli.ts
|
|
59
94
|
var createCli = () => {
|
|
60
95
|
const program2 = new Command().name("kineti").description("Kineti command-line interface").version(package_default.version);
|
|
61
96
|
program2.command("hello").description("Print a greeting").argument("[name]", "Name to greet", "world").action((name) => {
|
|
62
97
|
console.log(`Hello, ${name}!`);
|
|
63
98
|
});
|
|
99
|
+
program2.command("start").description("Start the Kineti web server (@aidoris/kineti-web)").option("-p, --port <port>", "Port to listen on", "3000").action((options) => {
|
|
100
|
+
startWeb(options.port);
|
|
101
|
+
});
|
|
64
102
|
return program2;
|
|
65
103
|
};
|
|
66
104
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aidoris/kineti-cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"author": "Pranav Sukumara Kurup <pranavs.nkm@gmail.com>",
|
|
6
6
|
"repository": {
|
|
@@ -38,6 +38,7 @@
|
|
|
38
38
|
"typecheck": "tsc --noEmit"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
+
"@aidoris/kineti-web": "workspace:*",
|
|
41
42
|
"commander": "^14.0.3"
|
|
42
43
|
},
|
|
43
44
|
"devDependencies": {
|