@geekmidas/cli 0.0.9 → 0.0.11
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/README.md +33 -0
- package/dist/{build-DGJAXiy_.cjs → build-C-UDqpkV.cjs} +15 -19
- package/dist/{build-CE77jmn4.mjs → build-DCAjSjA0.mjs} +16 -20
- package/dist/build.cjs +2 -4
- package/dist/build.mjs +2 -4
- package/dist/{cli-CTfdNl5c.mjs → cli-DPcRbYh5.mjs} +43 -3
- package/dist/{cli-aXPCpkGS.cjs → cli-NvCqdZtD.cjs} +43 -3
- package/dist/cli.cjs +4 -6
- package/dist/cli.mjs +4 -6
- package/dist/config-D8AyiwBU.cjs +23 -0
- package/dist/config-DV1Lwdkx.mjs +17 -0
- package/dist/config.cjs +1 -1
- package/dist/config.mjs +1 -1
- package/dist/index.cjs +4 -6
- package/dist/index.mjs +4 -6
- package/dist/{openapi-C84tyelp.cjs → openapi-BX7ba0w0.cjs} +1 -1
- package/dist/{openapi-UIMy3Lzi.mjs → openapi-BxI6zE0N.mjs} +1 -1
- package/dist/openapi.cjs +2 -2
- package/dist/openapi.mjs +2 -2
- package/package.json +3 -4
- package/src/build.ts +10 -46
- package/src/cli.ts +2 -1
- package/src/config.ts +5 -27
- package/src/types.ts +0 -1
- package/dist/config-D-b45V57.cjs +0 -41
- package/dist/config-Nd751N3o.mjs +0 -35
- package/dist/helpers/pathResolver.cjs +0 -6
- package/dist/helpers/pathResolver.mjs +0 -4
- package/dist/pathResolver-B6y4yoWk.cjs +0 -47
- package/dist/pathResolver-DaMnbf26.mjs +0 -29
- package/dist/tsconfig-83amrDAp.cjs +0 -94
- package/dist/tsconfig-BtO228Cz.mjs +0 -70
- package/dist/tsconfig.cjs +0 -6
- package/dist/tsconfig.mjs +0 -3
- package/src/helpers/pathResolver.ts +0 -46
- package/src/tsconfig.ts +0 -132
package/README.md
CHANGED
|
@@ -618,6 +618,39 @@ jobs:
|
|
|
618
618
|
3. **Import errors**: Verify your environment parser and logger paths are correct
|
|
619
619
|
4. **TypeScript errors**: Ensure your endpoints are properly typed
|
|
620
620
|
|
|
621
|
+
### Working with Different Directories
|
|
622
|
+
|
|
623
|
+
When using the `--cwd` option to run the CLI from a different directory, TypeScript configuration (tsconfig.json) is resolved from the directory where the CLI is invoked, not from the target directory. This can cause issues with path resolution and type checking.
|
|
624
|
+
|
|
625
|
+
**Workarounds:**
|
|
626
|
+
|
|
627
|
+
1. **Run from the target directory** (recommended):
|
|
628
|
+
```bash
|
|
629
|
+
cd /path/to/project && gkm build
|
|
630
|
+
```
|
|
631
|
+
|
|
632
|
+
2. **Use TS_NODE_PROJECT environment variable**:
|
|
633
|
+
```bash
|
|
634
|
+
TS_NODE_PROJECT=/path/to/project/tsconfig.json gkm build --cwd /path/to/project
|
|
635
|
+
```
|
|
636
|
+
|
|
637
|
+
3. **Create a wrapper script**:
|
|
638
|
+
```bash
|
|
639
|
+
#!/bin/bash
|
|
640
|
+
# gkm-wrapper.sh
|
|
641
|
+
cd "$1" && shift && gkm "$@"
|
|
642
|
+
```
|
|
643
|
+
|
|
644
|
+
Then use:
|
|
645
|
+
```bash
|
|
646
|
+
./gkm-wrapper.sh /path/to/project build --provider server
|
|
647
|
+
```
|
|
648
|
+
|
|
649
|
+
4. **Use npx with explicit tsx configuration**:
|
|
650
|
+
```bash
|
|
651
|
+
cd /path/to/project && npx tsx --tsconfig ./tsconfig.json node_modules/.bin/gkm build
|
|
652
|
+
```
|
|
653
|
+
|
|
621
654
|
### Debug Mode
|
|
622
655
|
|
|
623
656
|
Enable verbose logging by setting the environment variable:
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
const require_chunk = require('./chunk-CUT6urMc.cjs');
|
|
2
|
-
const require_config = require('./config-
|
|
2
|
+
const require_config = require('./config-D8AyiwBU.cjs');
|
|
3
3
|
const require_loadEndpoints = require('./loadEndpoints-CYFwuPZr.cjs');
|
|
4
|
-
const require_tsconfig = require('./tsconfig-83amrDAp.cjs');
|
|
5
|
-
const require_pathResolver = require('./pathResolver-B6y4yoWk.cjs');
|
|
6
4
|
const node_fs_promises = require_chunk.__toESM(require("node:fs/promises"));
|
|
7
5
|
const path = require_chunk.__toESM(require("path"));
|
|
8
6
|
|
|
@@ -13,8 +11,6 @@ async function buildCommand(options) {
|
|
|
13
11
|
const config = await require_config.loadConfig();
|
|
14
12
|
logger.log(`Loading routes from: ${config.routes}`);
|
|
15
13
|
logger.log(`Using envParser: ${config.envParser}`);
|
|
16
|
-
const tsConfig = config.tsconfig ? require_tsconfig.loadTsConfig(config.tsconfig) : require_tsconfig.loadTsConfig();
|
|
17
|
-
if (tsConfig) logger.log(`Using TypeScript config from: ${tsConfig.configPath}`);
|
|
18
14
|
const [envParserPath, envParserName] = config.envParser.split("#");
|
|
19
15
|
const envParserImportPattern = !envParserName ? "envParser" : envParserName === "envParser" ? "{ envParser }" : `{ ${envParserName} as envParser }`;
|
|
20
16
|
const [loggerPath, loggerName] = config.logger.split("#");
|
|
@@ -26,7 +22,7 @@ async function buildCommand(options) {
|
|
|
26
22
|
}
|
|
27
23
|
const allEndpoints = loadedEndpoints.map(({ name, endpoint, file }) => {
|
|
28
24
|
const routeInfo = {
|
|
29
|
-
path: endpoint.
|
|
25
|
+
path: endpoint._path,
|
|
30
26
|
method: endpoint.method,
|
|
31
27
|
handler: ""
|
|
32
28
|
};
|
|
@@ -44,7 +40,7 @@ async function buildCommand(options) {
|
|
|
44
40
|
await (0, node_fs_promises.mkdir)(outputDir, { recursive: true });
|
|
45
41
|
logger.log(`\nGenerating handlers for provider: ${provider}`);
|
|
46
42
|
if (provider === "server") {
|
|
47
|
-
const serverFile = await generateServerFile(outputDir, allEndpoints, envParserPath, envParserImportPattern, loggerPath, loggerImportPattern
|
|
43
|
+
const serverFile = await generateServerFile(outputDir, allEndpoints, envParserPath, envParserImportPattern, loggerPath, loggerImportPattern);
|
|
48
44
|
routes.push({
|
|
49
45
|
path: "*",
|
|
50
46
|
method: "ALL",
|
|
@@ -52,7 +48,7 @@ async function buildCommand(options) {
|
|
|
52
48
|
});
|
|
53
49
|
logger.log(`Generated server app with ${allEndpoints.length} endpoints`);
|
|
54
50
|
} else for (const { file, exportName, routeInfo } of allEndpoints) {
|
|
55
|
-
const handlerFile = await generateHandlerFile(outputDir, file, exportName, provider, routeInfo, envParserPath, envParserImportPattern
|
|
51
|
+
const handlerFile = await generateHandlerFile(outputDir, file, exportName, provider, routeInfo, envParserPath, envParserImportPattern);
|
|
56
52
|
routes.push({
|
|
57
53
|
...routeInfo,
|
|
58
54
|
handler: (0, path.relative)(process.cwd(), handlerFile).replace(/\.ts$/, ".handler")
|
|
@@ -66,23 +62,23 @@ async function buildCommand(options) {
|
|
|
66
62
|
logger.log(`Routes manifest: ${(0, path.relative)(process.cwd(), manifestPath)}`);
|
|
67
63
|
}
|
|
68
64
|
}
|
|
69
|
-
async function generateServerFile(outputDir, endpoints, envParserPath, envParserImportPattern, loggerPath, loggerImportPattern
|
|
65
|
+
async function generateServerFile(outputDir, endpoints, envParserPath, envParserImportPattern, loggerPath, loggerImportPattern) {
|
|
70
66
|
const serverFileName = "app.ts";
|
|
71
67
|
const serverPath = (0, path.join)(outputDir, serverFileName);
|
|
72
68
|
const importsByFile = /* @__PURE__ */ new Map();
|
|
73
69
|
for (const { file, exportName } of endpoints) {
|
|
74
|
-
const
|
|
75
|
-
const importPath =
|
|
70
|
+
const relativePath = (0, path.relative)((0, path.dirname)(serverPath), file);
|
|
71
|
+
const importPath = relativePath.replace(/\.ts$/, ".js");
|
|
76
72
|
if (!importsByFile.has(importPath)) importsByFile.set(importPath, []);
|
|
77
73
|
importsByFile.get(importPath).push(exportName);
|
|
78
74
|
}
|
|
79
|
-
const relativeEnvParserPath =
|
|
80
|
-
const relativeLoggerPath =
|
|
75
|
+
const relativeEnvParserPath = (0, path.relative)((0, path.dirname)(serverPath), envParserPath);
|
|
76
|
+
const relativeLoggerPath = (0, path.relative)((0, path.dirname)(serverPath), loggerPath);
|
|
81
77
|
const imports = Array.from(importsByFile.entries()).map(([importPath, exports$1]) => `import { ${exports$1.join(", ")} } from '${importPath}';`).join("\n");
|
|
82
78
|
const allExportNames = endpoints.map(({ exportName }) => exportName);
|
|
83
79
|
const content = `import { HonoEndpoint } from '@geekmidas/api/hono';
|
|
84
80
|
import { Endpoint } from '@geekmidas/api/server';
|
|
85
|
-
import {
|
|
81
|
+
import { ServiceDiscovery } from '@geekmidas/api/services';
|
|
86
82
|
import { Hono } from 'hono';
|
|
87
83
|
import ${envParserImportPattern} from '${relativeEnvParserPath}';
|
|
88
84
|
import ${loggerImportPattern} from '${relativeLoggerPath}';
|
|
@@ -95,7 +91,7 @@ export function createApp(app?: Hono): Hono {
|
|
|
95
91
|
${allExportNames.join(",\n ")}
|
|
96
92
|
];
|
|
97
93
|
|
|
98
|
-
const serviceDiscovery =
|
|
94
|
+
const serviceDiscovery = ServiceDiscovery.getInstance(
|
|
99
95
|
logger,
|
|
100
96
|
envParser
|
|
101
97
|
);
|
|
@@ -111,12 +107,12 @@ export default createApp;
|
|
|
111
107
|
await (0, node_fs_promises.writeFile)(serverPath, content);
|
|
112
108
|
return serverPath;
|
|
113
109
|
}
|
|
114
|
-
async function generateHandlerFile(outputDir, sourceFile, exportName, provider, _routeInfo, envParserPath, envParserImportPattern
|
|
110
|
+
async function generateHandlerFile(outputDir, sourceFile, exportName, provider, _routeInfo, envParserPath, envParserImportPattern) {
|
|
115
111
|
const handlerFileName = `${exportName}.ts`;
|
|
116
112
|
const handlerPath = (0, path.join)(outputDir, handlerFileName);
|
|
117
|
-
const
|
|
118
|
-
const importPath =
|
|
119
|
-
const relativeEnvParserPath =
|
|
113
|
+
const relativePath = (0, path.relative)((0, path.dirname)(handlerPath), sourceFile);
|
|
114
|
+
const importPath = relativePath.replace(/\.ts$/, ".js");
|
|
115
|
+
const relativeEnvParserPath = (0, path.relative)((0, path.dirname)(handlerPath), envParserPath);
|
|
120
116
|
let content;
|
|
121
117
|
switch (provider) {
|
|
122
118
|
case "aws-apigatewayv1":
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { loadConfig } from "./config-
|
|
1
|
+
import { loadConfig } from "./config-DV1Lwdkx.mjs";
|
|
2
2
|
import { loadEndpoints } from "./loadEndpoints-BL8q2rTO.mjs";
|
|
3
|
-
import { loadTsConfig } from "./tsconfig-BtO228Cz.mjs";
|
|
4
|
-
import { resolveModuleSpecifier } from "./pathResolver-DaMnbf26.mjs";
|
|
5
3
|
import { mkdir, writeFile } from "node:fs/promises";
|
|
6
|
-
import { join, relative } from "path";
|
|
4
|
+
import { dirname, join, relative } from "path";
|
|
7
5
|
|
|
8
6
|
//#region src/build.ts
|
|
9
7
|
const logger = console;
|
|
@@ -12,8 +10,6 @@ async function buildCommand(options) {
|
|
|
12
10
|
const config = await loadConfig();
|
|
13
11
|
logger.log(`Loading routes from: ${config.routes}`);
|
|
14
12
|
logger.log(`Using envParser: ${config.envParser}`);
|
|
15
|
-
const tsConfig = config.tsconfig ? loadTsConfig(config.tsconfig) : loadTsConfig();
|
|
16
|
-
if (tsConfig) logger.log(`Using TypeScript config from: ${tsConfig.configPath}`);
|
|
17
13
|
const [envParserPath, envParserName] = config.envParser.split("#");
|
|
18
14
|
const envParserImportPattern = !envParserName ? "envParser" : envParserName === "envParser" ? "{ envParser }" : `{ ${envParserName} as envParser }`;
|
|
19
15
|
const [loggerPath, loggerName] = config.logger.split("#");
|
|
@@ -25,7 +21,7 @@ async function buildCommand(options) {
|
|
|
25
21
|
}
|
|
26
22
|
const allEndpoints = loadedEndpoints.map(({ name, endpoint, file }) => {
|
|
27
23
|
const routeInfo = {
|
|
28
|
-
path: endpoint.
|
|
24
|
+
path: endpoint._path,
|
|
29
25
|
method: endpoint.method,
|
|
30
26
|
handler: ""
|
|
31
27
|
};
|
|
@@ -43,7 +39,7 @@ async function buildCommand(options) {
|
|
|
43
39
|
await mkdir(outputDir, { recursive: true });
|
|
44
40
|
logger.log(`\nGenerating handlers for provider: ${provider}`);
|
|
45
41
|
if (provider === "server") {
|
|
46
|
-
const serverFile = await generateServerFile(outputDir, allEndpoints, envParserPath, envParserImportPattern, loggerPath, loggerImportPattern
|
|
42
|
+
const serverFile = await generateServerFile(outputDir, allEndpoints, envParserPath, envParserImportPattern, loggerPath, loggerImportPattern);
|
|
47
43
|
routes.push({
|
|
48
44
|
path: "*",
|
|
49
45
|
method: "ALL",
|
|
@@ -51,7 +47,7 @@ async function buildCommand(options) {
|
|
|
51
47
|
});
|
|
52
48
|
logger.log(`Generated server app with ${allEndpoints.length} endpoints`);
|
|
53
49
|
} else for (const { file, exportName, routeInfo } of allEndpoints) {
|
|
54
|
-
const handlerFile = await generateHandlerFile(outputDir, file, exportName, provider, routeInfo, envParserPath, envParserImportPattern
|
|
50
|
+
const handlerFile = await generateHandlerFile(outputDir, file, exportName, provider, routeInfo, envParserPath, envParserImportPattern);
|
|
55
51
|
routes.push({
|
|
56
52
|
...routeInfo,
|
|
57
53
|
handler: relative(process.cwd(), handlerFile).replace(/\.ts$/, ".handler")
|
|
@@ -65,23 +61,23 @@ async function buildCommand(options) {
|
|
|
65
61
|
logger.log(`Routes manifest: ${relative(process.cwd(), manifestPath)}`);
|
|
66
62
|
}
|
|
67
63
|
}
|
|
68
|
-
async function generateServerFile(outputDir, endpoints, envParserPath, envParserImportPattern, loggerPath, loggerImportPattern
|
|
64
|
+
async function generateServerFile(outputDir, endpoints, envParserPath, envParserImportPattern, loggerPath, loggerImportPattern) {
|
|
69
65
|
const serverFileName = "app.ts";
|
|
70
66
|
const serverPath = join(outputDir, serverFileName);
|
|
71
67
|
const importsByFile = /* @__PURE__ */ new Map();
|
|
72
68
|
for (const { file, exportName } of endpoints) {
|
|
73
|
-
const
|
|
74
|
-
const importPath =
|
|
69
|
+
const relativePath = relative(dirname(serverPath), file);
|
|
70
|
+
const importPath = relativePath.replace(/\.ts$/, ".js");
|
|
75
71
|
if (!importsByFile.has(importPath)) importsByFile.set(importPath, []);
|
|
76
72
|
importsByFile.get(importPath).push(exportName);
|
|
77
73
|
}
|
|
78
|
-
const relativeEnvParserPath =
|
|
79
|
-
const relativeLoggerPath =
|
|
74
|
+
const relativeEnvParserPath = relative(dirname(serverPath), envParserPath);
|
|
75
|
+
const relativeLoggerPath = relative(dirname(serverPath), loggerPath);
|
|
80
76
|
const imports = Array.from(importsByFile.entries()).map(([importPath, exports]) => `import { ${exports.join(", ")} } from '${importPath}';`).join("\n");
|
|
81
77
|
const allExportNames = endpoints.map(({ exportName }) => exportName);
|
|
82
78
|
const content = `import { HonoEndpoint } from '@geekmidas/api/hono';
|
|
83
79
|
import { Endpoint } from '@geekmidas/api/server';
|
|
84
|
-
import {
|
|
80
|
+
import { ServiceDiscovery } from '@geekmidas/api/services';
|
|
85
81
|
import { Hono } from 'hono';
|
|
86
82
|
import ${envParserImportPattern} from '${relativeEnvParserPath}';
|
|
87
83
|
import ${loggerImportPattern} from '${relativeLoggerPath}';
|
|
@@ -94,7 +90,7 @@ export function createApp(app?: Hono): Hono {
|
|
|
94
90
|
${allExportNames.join(",\n ")}
|
|
95
91
|
];
|
|
96
92
|
|
|
97
|
-
const serviceDiscovery =
|
|
93
|
+
const serviceDiscovery = ServiceDiscovery.getInstance(
|
|
98
94
|
logger,
|
|
99
95
|
envParser
|
|
100
96
|
);
|
|
@@ -110,12 +106,12 @@ export default createApp;
|
|
|
110
106
|
await writeFile(serverPath, content);
|
|
111
107
|
return serverPath;
|
|
112
108
|
}
|
|
113
|
-
async function generateHandlerFile(outputDir, sourceFile, exportName, provider, _routeInfo, envParserPath, envParserImportPattern
|
|
109
|
+
async function generateHandlerFile(outputDir, sourceFile, exportName, provider, _routeInfo, envParserPath, envParserImportPattern) {
|
|
114
110
|
const handlerFileName = `${exportName}.ts`;
|
|
115
111
|
const handlerPath = join(outputDir, handlerFileName);
|
|
116
|
-
const
|
|
117
|
-
const importPath =
|
|
118
|
-
const relativeEnvParserPath =
|
|
112
|
+
const relativePath = relative(dirname(handlerPath), sourceFile);
|
|
113
|
+
const importPath = relativePath.replace(/\.ts$/, ".js");
|
|
114
|
+
const relativeEnvParserPath = relative(dirname(handlerPath), envParserPath);
|
|
119
115
|
let content;
|
|
120
116
|
switch (provider) {
|
|
121
117
|
case "aws-apigatewayv1":
|
package/dist/build.cjs
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
require('./config-
|
|
1
|
+
require('./config-D8AyiwBU.cjs');
|
|
2
2
|
require('./loadEndpoints-CYFwuPZr.cjs');
|
|
3
|
-
require('./
|
|
4
|
-
require('./pathResolver-B6y4yoWk.cjs');
|
|
5
|
-
const require_build = require('./build-DGJAXiy_.cjs');
|
|
3
|
+
const require_build = require('./build-C-UDqpkV.cjs');
|
|
6
4
|
|
|
7
5
|
exports.buildCommand = require_build.buildCommand;
|
package/dist/build.mjs
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import "./config-
|
|
1
|
+
import "./config-DV1Lwdkx.mjs";
|
|
2
2
|
import "./loadEndpoints-BL8q2rTO.mjs";
|
|
3
|
-
import "./
|
|
4
|
-
import "./pathResolver-DaMnbf26.mjs";
|
|
5
|
-
import { buildCommand } from "./build-CE77jmn4.mjs";
|
|
3
|
+
import { buildCommand } from "./build-DCAjSjA0.mjs";
|
|
6
4
|
|
|
7
5
|
export { buildCommand };
|
|
@@ -1,10 +1,50 @@
|
|
|
1
|
-
import { buildCommand } from "./build-
|
|
2
|
-
import { openapiCommand } from "./openapi-
|
|
1
|
+
import { buildCommand } from "./build-DCAjSjA0.mjs";
|
|
2
|
+
import { openapiCommand } from "./openapi-BxI6zE0N.mjs";
|
|
3
3
|
import { Command } from "commander";
|
|
4
4
|
|
|
5
|
+
//#region package.json
|
|
6
|
+
var name = "@geekmidas/cli";
|
|
7
|
+
var version = "0.0.11";
|
|
8
|
+
var private$1 = false;
|
|
9
|
+
var type = "module";
|
|
10
|
+
var bin = { "gkm": "./src/index.ts" };
|
|
11
|
+
var exports = { ".": {
|
|
12
|
+
"import": "./dist/index.mjs",
|
|
13
|
+
"require": "./dist/index.cjs",
|
|
14
|
+
"types": "./src/index.ts"
|
|
15
|
+
} };
|
|
16
|
+
var publishConfig = {
|
|
17
|
+
"registry": "https://registry.npmjs.org/",
|
|
18
|
+
"access": "public"
|
|
19
|
+
};
|
|
20
|
+
var dependencies = {
|
|
21
|
+
"commander": "~14.0.0",
|
|
22
|
+
"lodash.get": "~4.4.2",
|
|
23
|
+
"lodash.set": "~4.3.2",
|
|
24
|
+
"zod": "~3.25.67",
|
|
25
|
+
"fast-glob": "~3.3.3",
|
|
26
|
+
"@geekmidas/api": "workspace:*"
|
|
27
|
+
};
|
|
28
|
+
var devDependencies = {
|
|
29
|
+
"@types/lodash.get": "~4.4.9",
|
|
30
|
+
"@types/lodash.set": "~4.3.9"
|
|
31
|
+
};
|
|
32
|
+
var package_default = {
|
|
33
|
+
name,
|
|
34
|
+
version,
|
|
35
|
+
private: private$1,
|
|
36
|
+
type,
|
|
37
|
+
bin,
|
|
38
|
+
exports,
|
|
39
|
+
publishConfig,
|
|
40
|
+
dependencies,
|
|
41
|
+
devDependencies
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
//#endregion
|
|
5
45
|
//#region src/cli.ts
|
|
6
46
|
const program = new Command();
|
|
7
|
-
program.name("gkm").description("GeekMidas backend framework CLI").version(
|
|
47
|
+
program.name("gkm").description("GeekMidas backend framework CLI").version(package_default.version).option("--cwd <path>", "Change working directory");
|
|
8
48
|
program.command("build").description("Build API handlers from endpoints").option("--providers <providers>", "Target providers for generated handlers (comma-separated)", "aws-apigatewayv1").action(async (options) => {
|
|
9
49
|
try {
|
|
10
50
|
const globalOptions = program.opts();
|
|
@@ -1,11 +1,51 @@
|
|
|
1
1
|
const require_chunk = require('./chunk-CUT6urMc.cjs');
|
|
2
|
-
const require_build = require('./build-
|
|
3
|
-
const require_openapi = require('./openapi-
|
|
2
|
+
const require_build = require('./build-C-UDqpkV.cjs');
|
|
3
|
+
const require_openapi = require('./openapi-BX7ba0w0.cjs');
|
|
4
4
|
const commander = require_chunk.__toESM(require("commander"));
|
|
5
5
|
|
|
6
|
+
//#region package.json
|
|
7
|
+
var name = "@geekmidas/cli";
|
|
8
|
+
var version = "0.0.11";
|
|
9
|
+
var private$1 = false;
|
|
10
|
+
var type = "module";
|
|
11
|
+
var bin = { "gkm": "./src/index.ts" };
|
|
12
|
+
var exports$1 = { ".": {
|
|
13
|
+
"import": "./dist/index.mjs",
|
|
14
|
+
"require": "./dist/index.cjs",
|
|
15
|
+
"types": "./src/index.ts"
|
|
16
|
+
} };
|
|
17
|
+
var publishConfig = {
|
|
18
|
+
"registry": "https://registry.npmjs.org/",
|
|
19
|
+
"access": "public"
|
|
20
|
+
};
|
|
21
|
+
var dependencies = {
|
|
22
|
+
"commander": "~14.0.0",
|
|
23
|
+
"lodash.get": "~4.4.2",
|
|
24
|
+
"lodash.set": "~4.3.2",
|
|
25
|
+
"zod": "~3.25.67",
|
|
26
|
+
"fast-glob": "~3.3.3",
|
|
27
|
+
"@geekmidas/api": "workspace:*"
|
|
28
|
+
};
|
|
29
|
+
var devDependencies = {
|
|
30
|
+
"@types/lodash.get": "~4.4.9",
|
|
31
|
+
"@types/lodash.set": "~4.3.9"
|
|
32
|
+
};
|
|
33
|
+
var package_default = {
|
|
34
|
+
name,
|
|
35
|
+
version,
|
|
36
|
+
private: private$1,
|
|
37
|
+
type,
|
|
38
|
+
bin,
|
|
39
|
+
exports: exports$1,
|
|
40
|
+
publishConfig,
|
|
41
|
+
dependencies,
|
|
42
|
+
devDependencies
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
//#endregion
|
|
6
46
|
//#region src/cli.ts
|
|
7
47
|
const program = new commander.Command();
|
|
8
|
-
program.name("gkm").description("GeekMidas backend framework CLI").version(
|
|
48
|
+
program.name("gkm").description("GeekMidas backend framework CLI").version(package_default.version).option("--cwd <path>", "Change working directory");
|
|
9
49
|
program.command("build").description("Build API handlers from endpoints").option("--providers <providers>", "Target providers for generated handlers (comma-separated)", "aws-apigatewayv1").action(async (options) => {
|
|
10
50
|
try {
|
|
11
51
|
const globalOptions = program.opts();
|
package/dist/cli.cjs
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
require('./config-
|
|
2
|
+
require('./config-D8AyiwBU.cjs');
|
|
3
3
|
require('./loadEndpoints-CYFwuPZr.cjs');
|
|
4
|
-
require('./
|
|
5
|
-
require('./
|
|
6
|
-
require('./
|
|
7
|
-
require('./openapi-C84tyelp.cjs');
|
|
8
|
-
require('./cli-aXPCpkGS.cjs');
|
|
4
|
+
require('./build-C-UDqpkV.cjs');
|
|
5
|
+
require('./cli-NvCqdZtD.cjs');
|
|
6
|
+
require('./openapi-BX7ba0w0.cjs');
|
package/dist/cli.mjs
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import "./config-
|
|
2
|
+
import "./config-DV1Lwdkx.mjs";
|
|
3
3
|
import "./loadEndpoints-BL8q2rTO.mjs";
|
|
4
|
-
import "./
|
|
5
|
-
import "./
|
|
6
|
-
import "./
|
|
7
|
-
import "./openapi-UIMy3Lzi.mjs";
|
|
8
|
-
import "./cli-CTfdNl5c.mjs";
|
|
4
|
+
import "./build-DCAjSjA0.mjs";
|
|
5
|
+
import "./cli-DPcRbYh5.mjs";
|
|
6
|
+
import "./openapi-BxI6zE0N.mjs";
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
const require_chunk = require('./chunk-CUT6urMc.cjs');
|
|
2
|
+
const path = require_chunk.__toESM(require("path"));
|
|
3
|
+
const fs = require_chunk.__toESM(require("fs"));
|
|
4
|
+
|
|
5
|
+
//#region src/config.ts
|
|
6
|
+
async function loadConfig() {
|
|
7
|
+
const configPath = (0, path.join)(process.cwd(), "gkm.config.json");
|
|
8
|
+
if (!(0, fs.existsSync)(configPath)) throw new Error("gkm.config.json not found. Please create a configuration file.");
|
|
9
|
+
try {
|
|
10
|
+
const config = await import(configPath);
|
|
11
|
+
return config.default || config;
|
|
12
|
+
} catch (error) {
|
|
13
|
+
throw new Error(`Failed to load gkm.config.ts: ${error.message}`);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
//#endregion
|
|
18
|
+
Object.defineProperty(exports, 'loadConfig', {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return loadConfig;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { join } from "path";
|
|
2
|
+
import { existsSync } from "fs";
|
|
3
|
+
|
|
4
|
+
//#region src/config.ts
|
|
5
|
+
async function loadConfig() {
|
|
6
|
+
const configPath = join(process.cwd(), "gkm.config.json");
|
|
7
|
+
if (!existsSync(configPath)) throw new Error("gkm.config.json not found. Please create a configuration file.");
|
|
8
|
+
try {
|
|
9
|
+
const config = await import(configPath);
|
|
10
|
+
return config.default || config;
|
|
11
|
+
} catch (error) {
|
|
12
|
+
throw new Error(`Failed to load gkm.config.ts: ${error.message}`);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
//#endregion
|
|
17
|
+
export { loadConfig };
|
package/dist/config.cjs
CHANGED
package/dist/config.mjs
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env -S npx tsx
|
|
2
|
-
require('./config-
|
|
2
|
+
require('./config-D8AyiwBU.cjs');
|
|
3
3
|
require('./loadEndpoints-CYFwuPZr.cjs');
|
|
4
|
-
require('./
|
|
5
|
-
require('./
|
|
6
|
-
require('./
|
|
7
|
-
require('./openapi-C84tyelp.cjs');
|
|
8
|
-
require('./cli-aXPCpkGS.cjs');
|
|
4
|
+
require('./build-C-UDqpkV.cjs');
|
|
5
|
+
require('./cli-NvCqdZtD.cjs');
|
|
6
|
+
require('./openapi-BX7ba0w0.cjs');
|
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env -S npx tsx
|
|
2
|
-
import "./config-
|
|
2
|
+
import "./config-DV1Lwdkx.mjs";
|
|
3
3
|
import "./loadEndpoints-BL8q2rTO.mjs";
|
|
4
|
-
import "./
|
|
5
|
-
import "./
|
|
6
|
-
import "./
|
|
7
|
-
import "./openapi-UIMy3Lzi.mjs";
|
|
8
|
-
import "./cli-CTfdNl5c.mjs";
|
|
4
|
+
import "./build-DCAjSjA0.mjs";
|
|
5
|
+
import "./cli-DPcRbYh5.mjs";
|
|
6
|
+
import "./openapi-BxI6zE0N.mjs";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_chunk = require('./chunk-CUT6urMc.cjs');
|
|
2
|
-
const require_config = require('./config-
|
|
2
|
+
const require_config = require('./config-D8AyiwBU.cjs');
|
|
3
3
|
const require_loadEndpoints = require('./loadEndpoints-CYFwuPZr.cjs');
|
|
4
4
|
const node_fs_promises = require_chunk.__toESM(require("node:fs/promises"));
|
|
5
5
|
const __geekmidas_api_server = require_chunk.__toESM(require("@geekmidas/api/server"));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { loadConfig } from "./config-
|
|
1
|
+
import { loadConfig } from "./config-DV1Lwdkx.mjs";
|
|
2
2
|
import { loadEndpoints } from "./loadEndpoints-BL8q2rTO.mjs";
|
|
3
3
|
import { mkdir, writeFile } from "node:fs/promises";
|
|
4
4
|
import { Endpoint } from "@geekmidas/api/server";
|
package/dist/openapi.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env -S npx tsx
|
|
2
|
-
require('./config-
|
|
2
|
+
require('./config-D8AyiwBU.cjs');
|
|
3
3
|
require('./loadEndpoints-CYFwuPZr.cjs');
|
|
4
|
-
const require_openapi = require('./openapi-
|
|
4
|
+
const require_openapi = require('./openapi-BX7ba0w0.cjs');
|
|
5
5
|
|
|
6
6
|
exports.openapiCommand = require_openapi.openapiCommand;
|
package/dist/openapi.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env -S npx tsx
|
|
2
|
-
import "./config-
|
|
2
|
+
import "./config-DV1Lwdkx.mjs";
|
|
3
3
|
import "./loadEndpoints-BL8q2rTO.mjs";
|
|
4
|
-
import { openapiCommand } from "./openapi-
|
|
4
|
+
import { openapiCommand } from "./openapi-BxI6zE0N.mjs";
|
|
5
5
|
|
|
6
6
|
export { openapiCommand };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@geekmidas/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.11",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -19,12 +19,11 @@
|
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"commander": "~14.0.0",
|
|
22
|
-
"fast-glob": "~3.3.3",
|
|
23
22
|
"lodash.get": "~4.4.2",
|
|
24
23
|
"lodash.set": "~4.3.2",
|
|
25
|
-
"typescript": "~5.8.3",
|
|
26
24
|
"zod": "~3.25.67",
|
|
27
|
-
"
|
|
25
|
+
"fast-glob": "~3.3.3",
|
|
26
|
+
"@geekmidas/api": "0.0.25"
|
|
28
27
|
},
|
|
29
28
|
"devDependencies": {
|
|
30
29
|
"@types/lodash.get": "~4.4.9",
|