@geekmidas/cli 1.10.21 → 1.10.22
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/CHANGELOG.md +6 -0
- package/bin/gkm.mjs +30 -0
- package/dist/index.cjs +25 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +25 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/dev/index.ts +29 -12
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @geekmidas/cli
|
|
2
2
|
|
|
3
|
+
## 1.10.22
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 🐛 [`acfc00a`](https://github.com/geekmidas/toolbox/commit/acfc00a0ec99691e978c3d0978f3ec63e1ec9869) Thanks [@geekmidas](https://github.com/geekmidas)! - Fix tsx loader for loading extentionless typescript files
|
|
8
|
+
|
|
3
9
|
## 1.10.21
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
package/bin/gkm.mjs
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { register } from 'node:module';
|
|
3
|
+
import { pathToFileURL } from 'node:url';
|
|
4
|
+
|
|
5
|
+
// Register tsx loader hooks BEFORE any .ts imports.
|
|
6
|
+
// --import tsx works but register() alone doesn't override
|
|
7
|
+
// Node 22's built-in strip-only type handling (which lacks enum support).
|
|
8
|
+
// Using --import via NODE_OPTIONS ensures tsx fully handles .ts files.
|
|
9
|
+
const nodeOptions = process.env.NODE_OPTIONS || '';
|
|
10
|
+
if (
|
|
11
|
+
!nodeOptions.includes('--import tsx') &&
|
|
12
|
+
!nodeOptions.includes('--import=tsx')
|
|
13
|
+
) {
|
|
14
|
+
const { execFileSync } = await import('node:child_process');
|
|
15
|
+
try {
|
|
16
|
+
execFileSync(process.execPath, process.argv.slice(1), {
|
|
17
|
+
stdio: 'inherit',
|
|
18
|
+
env: {
|
|
19
|
+
...process.env,
|
|
20
|
+
NODE_OPTIONS: `${nodeOptions} --import tsx`.trim(),
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
} catch (e) {
|
|
24
|
+
process.exit(e.status ?? 1);
|
|
25
|
+
}
|
|
26
|
+
process.exit(0);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// tsx is loaded — run the CLI
|
|
30
|
+
await import('../dist/index.mjs');
|
package/dist/index.cjs
CHANGED
|
@@ -35,7 +35,7 @@ const prompts = require_chunk.__toESM(require("prompts"));
|
|
|
35
35
|
|
|
36
36
|
//#region package.json
|
|
37
37
|
var name = "@geekmidas/cli";
|
|
38
|
-
var version = "1.10.
|
|
38
|
+
var version = "1.10.21";
|
|
39
39
|
var description = "CLI tools for building Lambda handlers, server applications, and generating OpenAPI specs";
|
|
40
40
|
var private$1 = false;
|
|
41
41
|
var type = "module";
|
|
@@ -66,7 +66,7 @@ var exports$1 = {
|
|
|
66
66
|
"require": "./dist/openapi-react-query.cjs"
|
|
67
67
|
}
|
|
68
68
|
};
|
|
69
|
-
var bin = { "gkm": "./
|
|
69
|
+
var bin = { "gkm": "./bin/gkm.mjs" };
|
|
70
70
|
var scripts = {
|
|
71
71
|
"ts": "tsc --noEmit --skipLibCheck src/**/*.ts",
|
|
72
72
|
"sync-versions": "tsx scripts/sync-versions.ts",
|
|
@@ -1807,7 +1807,11 @@ var EntryRunner = class {
|
|
|
1807
1807
|
this.isRunning = false;
|
|
1808
1808
|
});
|
|
1809
1809
|
await new Promise((resolve$4) => setTimeout(resolve$4, 500));
|
|
1810
|
-
if (this.isRunning)
|
|
1810
|
+
if (this.isRunning) {
|
|
1811
|
+
logger$11.log("");
|
|
1812
|
+
logger$11.log(` \x1b[32m✓ Ready\x1b[0m at \x1b[36mhttp://localhost:${this.port}\x1b[0m`);
|
|
1813
|
+
logger$11.log("");
|
|
1814
|
+
}
|
|
1811
1815
|
}
|
|
1812
1816
|
async restart() {
|
|
1813
1817
|
this.stopProcess();
|
|
@@ -1898,6 +1902,7 @@ var DevServer = class {
|
|
|
1898
1902
|
serverProcess = null;
|
|
1899
1903
|
isRunning = false;
|
|
1900
1904
|
actualPort;
|
|
1905
|
+
startTime = Date.now();
|
|
1901
1906
|
constructor(provider, requestedPort, portExplicit, enableOpenApi, telescope, studio, runtime = "node", appRoot = process.cwd(), secretsJsonPath) {
|
|
1902
1907
|
this.provider = provider;
|
|
1903
1908
|
this.requestedPort = requestedPort;
|
|
@@ -1911,6 +1916,7 @@ var DevServer = class {
|
|
|
1911
1916
|
this.actualPort = requestedPort;
|
|
1912
1917
|
}
|
|
1913
1918
|
async start() {
|
|
1919
|
+
this.startTime = Date.now();
|
|
1914
1920
|
if (this.isRunning) await this.stop();
|
|
1915
1921
|
if (this.portExplicit) {
|
|
1916
1922
|
const available = await isPortAvailable(this.requestedPort);
|
|
@@ -1922,7 +1928,7 @@ var DevServer = class {
|
|
|
1922
1928
|
}
|
|
1923
1929
|
const serverEntryPath = (0, node_path.join)(this.appRoot, ".gkm", this.provider, "server.ts");
|
|
1924
1930
|
await this.createServerEntry();
|
|
1925
|
-
logger$11.log(`\n
|
|
1931
|
+
logger$11.log(`\n⏳ Starting server...`);
|
|
1926
1932
|
this.serverProcess = (0, node_child_process.spawn)("npx", [
|
|
1927
1933
|
"tsx",
|
|
1928
1934
|
serverEntryPath,
|
|
@@ -1946,10 +1952,21 @@ var DevServer = class {
|
|
|
1946
1952
|
});
|
|
1947
1953
|
await new Promise((resolve$4) => setTimeout(resolve$4, 1e3));
|
|
1948
1954
|
if (this.isRunning) {
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
if (this.
|
|
1952
|
-
if (this.
|
|
1955
|
+
const base = `http://localhost:${this.actualPort}`;
|
|
1956
|
+
const lines = [` Local: ${base}`];
|
|
1957
|
+
if (this.enableOpenApi) lines.push(` API Docs: ${base}/__docs`);
|
|
1958
|
+
if (this.telescope) lines.push(` Telescope: ${base}${this.telescope.path}`);
|
|
1959
|
+
if (this.studio) lines.push(` Studio: ${base}${this.studio.path}`);
|
|
1960
|
+
const maxLen = Math.max(...lines.map((l) => l.length));
|
|
1961
|
+
const pad = (s) => s.padEnd(maxLen);
|
|
1962
|
+
const border = "─".repeat(maxLen + 2);
|
|
1963
|
+
logger$11.log("");
|
|
1964
|
+
logger$11.log(` \x1b[32m✓ Ready\x1b[0m in ${((Date.now() - this.startTime) / 1e3).toFixed(1)}s`);
|
|
1965
|
+
logger$11.log("");
|
|
1966
|
+
logger$11.log(` ┌${border}┐`);
|
|
1967
|
+
for (const line of lines) logger$11.log(` │ ${pad(line)} │`);
|
|
1968
|
+
logger$11.log(` └${border}┘`);
|
|
1969
|
+
logger$11.log("");
|
|
1953
1970
|
}
|
|
1954
1971
|
}
|
|
1955
1972
|
async stop() {
|