@geekmidas/cli 0.0.8 → 0.0.10
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-BOIEItQ4.cjs → build-GTFSYaDw.cjs} +2 -2
- package/dist/{build-HqXSd7ux.mjs → build-fWeaXigm.mjs} +2 -2
- package/dist/build.cjs +1 -1
- package/dist/build.mjs +1 -1
- package/dist/{cli-8JB9d4XW.mjs → cli--DOGIUC5.mjs} +43 -3
- package/dist/{cli-8aXEWjpV.cjs → cli-BFQ-Dso8.cjs} +43 -3
- package/dist/cli.cjs +3 -3
- package/dist/cli.mjs +3 -3
- package/dist/index.cjs +3 -3
- package/dist/index.mjs +3 -3
- package/dist/openapi.cjs +1 -1
- package/dist/openapi.mjs +1 -1
- package/package.json +2 -2
- package/src/build.ts +5 -3
- package/src/cli.ts +5 -2
- /package/dist/{openapi-DD-MfKrj.cjs → openapi-BX7ba0w0.cjs} +0 -0
- /package/dist/{openapi-CVu3aUU8.mjs → openapi-BxI6zE0N.mjs} +0 -0
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:
|
|
@@ -78,7 +78,7 @@ async function generateServerFile(outputDir, endpoints, envParserPath, envParser
|
|
|
78
78
|
const allExportNames = endpoints.map(({ exportName }) => exportName);
|
|
79
79
|
const content = `import { HonoEndpoint } from '@geekmidas/api/hono';
|
|
80
80
|
import { Endpoint } from '@geekmidas/api/server';
|
|
81
|
-
import {
|
|
81
|
+
import { ServiceDiscovery } from '@geekmidas/api/services';
|
|
82
82
|
import { Hono } from 'hono';
|
|
83
83
|
import ${envParserImportPattern} from '${relativeEnvParserPath}';
|
|
84
84
|
import ${loggerImportPattern} from '${relativeLoggerPath}';
|
|
@@ -91,7 +91,7 @@ export function createApp(app?: Hono): Hono {
|
|
|
91
91
|
${allExportNames.join(",\n ")}
|
|
92
92
|
];
|
|
93
93
|
|
|
94
|
-
const serviceDiscovery =
|
|
94
|
+
const serviceDiscovery = ServiceDiscovery.getInstance(
|
|
95
95
|
logger,
|
|
96
96
|
envParser
|
|
97
97
|
);
|
|
@@ -77,7 +77,7 @@ async function generateServerFile(outputDir, endpoints, envParserPath, envParser
|
|
|
77
77
|
const allExportNames = endpoints.map(({ exportName }) => exportName);
|
|
78
78
|
const content = `import { HonoEndpoint } from '@geekmidas/api/hono';
|
|
79
79
|
import { Endpoint } from '@geekmidas/api/server';
|
|
80
|
-
import {
|
|
80
|
+
import { ServiceDiscovery } from '@geekmidas/api/services';
|
|
81
81
|
import { Hono } from 'hono';
|
|
82
82
|
import ${envParserImportPattern} from '${relativeEnvParserPath}';
|
|
83
83
|
import ${loggerImportPattern} from '${relativeLoggerPath}';
|
|
@@ -90,7 +90,7 @@ export function createApp(app?: Hono): Hono {
|
|
|
90
90
|
${allExportNames.join(",\n ")}
|
|
91
91
|
];
|
|
92
92
|
|
|
93
|
-
const serviceDiscovery =
|
|
93
|
+
const serviceDiscovery = ServiceDiscovery.getInstance(
|
|
94
94
|
logger,
|
|
95
95
|
envParser
|
|
96
96
|
);
|
package/dist/build.cjs
CHANGED
package/dist/build.mjs
CHANGED
|
@@ -1,10 +1,50 @@
|
|
|
1
|
-
import { buildCommand } from "./build-
|
|
2
|
-
import { openapiCommand } from "./openapi-
|
|
1
|
+
import { buildCommand } from "./build-fWeaXigm.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.10";
|
|
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-GTFSYaDw.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.10";
|
|
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,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
require('./config-D8AyiwBU.cjs');
|
|
3
3
|
require('./loadEndpoints-CYFwuPZr.cjs');
|
|
4
|
-
require('./build-
|
|
5
|
-
require('./
|
|
6
|
-
require('./
|
|
4
|
+
require('./build-GTFSYaDw.cjs');
|
|
5
|
+
require('./cli-BFQ-Dso8.cjs');
|
|
6
|
+
require('./openapi-BX7ba0w0.cjs');
|
package/dist/cli.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import "./config-DV1Lwdkx.mjs";
|
|
3
3
|
import "./loadEndpoints-BL8q2rTO.mjs";
|
|
4
|
-
import "./build-
|
|
5
|
-
import "./
|
|
6
|
-
import "./
|
|
4
|
+
import "./build-fWeaXigm.mjs";
|
|
5
|
+
import "./cli--DOGIUC5.mjs";
|
|
6
|
+
import "./openapi-BxI6zE0N.mjs";
|
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env -S npx tsx
|
|
2
2
|
require('./config-D8AyiwBU.cjs');
|
|
3
3
|
require('./loadEndpoints-CYFwuPZr.cjs');
|
|
4
|
-
require('./build-
|
|
5
|
-
require('./
|
|
6
|
-
require('./
|
|
4
|
+
require('./build-GTFSYaDw.cjs');
|
|
5
|
+
require('./cli-BFQ-Dso8.cjs');
|
|
6
|
+
require('./openapi-BX7ba0w0.cjs');
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env -S npx tsx
|
|
2
2
|
import "./config-DV1Lwdkx.mjs";
|
|
3
3
|
import "./loadEndpoints-BL8q2rTO.mjs";
|
|
4
|
-
import "./build-
|
|
5
|
-
import "./
|
|
6
|
-
import "./
|
|
4
|
+
import "./build-fWeaXigm.mjs";
|
|
5
|
+
import "./cli--DOGIUC5.mjs";
|
|
6
|
+
import "./openapi-BxI6zE0N.mjs";
|
package/dist/openapi.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env -S npx tsx
|
|
2
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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@geekmidas/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.10",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"lodash.set": "~4.3.2",
|
|
24
24
|
"zod": "~3.25.67",
|
|
25
25
|
"fast-glob": "~3.3.3",
|
|
26
|
-
"@geekmidas/api": "0.0.
|
|
26
|
+
"@geekmidas/api": "0.0.22"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@types/lodash.get": "~4.4.9",
|
package/src/build.ts
CHANGED
|
@@ -110,7 +110,9 @@ export async function buildCommand(options: BuildOptions): Promise<void> {
|
|
|
110
110
|
),
|
|
111
111
|
});
|
|
112
112
|
|
|
113
|
-
logger.log(
|
|
113
|
+
logger.log(
|
|
114
|
+
`Generated handler for ${routeInfo.method} ${routeInfo.path}`,
|
|
115
|
+
);
|
|
114
116
|
}
|
|
115
117
|
}
|
|
116
118
|
|
|
@@ -170,7 +172,7 @@ async function generateServerFile(
|
|
|
170
172
|
|
|
171
173
|
const content = `import { HonoEndpoint } from '@geekmidas/api/hono';
|
|
172
174
|
import { Endpoint } from '@geekmidas/api/server';
|
|
173
|
-
import {
|
|
175
|
+
import { ServiceDiscovery } from '@geekmidas/api/services';
|
|
174
176
|
import { Hono } from 'hono';
|
|
175
177
|
import ${envParserImportPattern} from '${relativeEnvParserPath}';
|
|
176
178
|
import ${loggerImportPattern} from '${relativeLoggerPath}';
|
|
@@ -183,7 +185,7 @@ export function createApp(app?: Hono): Hono {
|
|
|
183
185
|
${allExportNames.join(',\n ')}
|
|
184
186
|
];
|
|
185
187
|
|
|
186
|
-
const serviceDiscovery =
|
|
188
|
+
const serviceDiscovery = ServiceDiscovery.getInstance(
|
|
187
189
|
logger,
|
|
188
190
|
envParser
|
|
189
191
|
);
|
package/src/cli.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
import { Command } from 'commander';
|
|
4
|
+
import pkg from '../package.json' assert { type: 'json' };
|
|
4
5
|
import { buildCommand } from './build.js';
|
|
5
6
|
import { openapiCommand } from './openapi.js';
|
|
6
7
|
import type { Provider } from './types.js';
|
|
@@ -10,7 +11,7 @@ const program = new Command();
|
|
|
10
11
|
program
|
|
11
12
|
.name('gkm')
|
|
12
13
|
.description('GeekMidas backend framework CLI')
|
|
13
|
-
.version(
|
|
14
|
+
.version(pkg.version)
|
|
14
15
|
.option('--cwd <path>', 'Change working directory');
|
|
15
16
|
|
|
16
17
|
program
|
|
@@ -27,7 +28,9 @@ program
|
|
|
27
28
|
if (globalOptions.cwd) {
|
|
28
29
|
process.chdir(globalOptions.cwd);
|
|
29
30
|
}
|
|
30
|
-
const providerList = [
|
|
31
|
+
const providerList = [
|
|
32
|
+
...new Set(options.providers.split(',').map((p) => p.trim())),
|
|
33
|
+
] as Provider[];
|
|
31
34
|
await buildCommand({ providers: providerList });
|
|
32
35
|
} catch (error) {
|
|
33
36
|
console.error('Build failed:', (error as Error).message);
|
|
File without changes
|
|
File without changes
|