@geekmidas/cli 0.32.0 → 0.33.0

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": "@geekmidas/cli",
3
- "version": "0.32.0",
3
+ "version": "0.33.0",
4
4
  "description": "CLI tools for building Lambda handlers, server applications, and generating OpenAPI specs",
5
5
  "private": false,
6
6
  "type": "module",
@@ -49,10 +49,10 @@
49
49
  "openapi-typescript": "^7.4.2",
50
50
  "prompts": "~2.4.2",
51
51
  "@geekmidas/constructs": "~0.6.0",
52
- "@geekmidas/envkit": "~0.5.0",
53
- "@geekmidas/logger": "~0.4.0",
52
+ "@geekmidas/schema": "~0.1.0",
54
53
  "@geekmidas/errors": "~0.1.0",
55
- "@geekmidas/schema": "~0.1.0"
54
+ "@geekmidas/envkit": "~0.5.0",
55
+ "@geekmidas/logger": "~0.4.0"
56
56
  },
57
57
  "devDependencies": {
58
58
  "@types/lodash.kebabcase": "^4.1.9",
@@ -77,7 +77,7 @@ describe('createEntryWrapper', () => {
77
77
 
78
78
  const content = await readFile(wrapperPath, 'utf-8');
79
79
 
80
- expect(content).toContain("import '/path/to/entry.ts'");
80
+ expect(content).toContain("await import('/path/to/entry.ts')");
81
81
  expect(content).not.toContain('Credentials');
82
82
  expect(content).toContain("Entry wrapper generated by 'gkm dev --entry'");
83
83
  });
@@ -96,7 +96,7 @@ describe('createEntryWrapper', () => {
96
96
  );
97
97
  expect(content).toContain(secretsPath);
98
98
  expect(content).toContain('Object.assign(Credentials');
99
- expect(content).toContain("import '/path/to/entry.ts'");
99
+ expect(content).toContain("await import('/path/to/entry.ts')");
100
100
  });
101
101
 
102
102
  it('should inject secrets before entry import', async () => {
@@ -109,7 +109,7 @@ describe('createEntryWrapper', () => {
109
109
  const content = await readFile(wrapperPath, 'utf-8');
110
110
 
111
111
  const credentialsIndex = content.indexOf('Credentials');
112
- const importIndex = content.indexOf("import '/path/to/entry.ts'");
112
+ const importIndex = content.indexOf("await import('/path/to/entry.ts')");
113
113
 
114
114
  expect(credentialsIndex).toBeGreaterThan(-1);
115
115
  expect(importIndex).toBeGreaterThan(-1);
package/src/dev/index.ts CHANGED
@@ -1291,12 +1291,14 @@ if (existsSync(secretsPath)) {
1291
1291
  `
1292
1292
  : '';
1293
1293
 
1294
+ // Use dynamic import() to ensure secrets are assigned before the entry file loads
1295
+ // Static imports are hoisted, so Object.assign would run after the entry file is loaded
1294
1296
  const content = `#!/usr/bin/env node
1295
1297
  /**
1296
1298
  * Entry wrapper generated by 'gkm dev --entry'
1297
1299
  */
1298
- ${credentialsInjection}// Import and run the user's entry file
1299
- import '${entryPath}';
1300
+ ${credentialsInjection}// Import and run the user's entry file (dynamic import ensures secrets load first)
1301
+ await import('${entryPath}');
1300
1302
  `;
1301
1303
 
1302
1304
  await writeFile(wrapperPath, content);
@@ -1329,14 +1331,20 @@ async function entryDevCommand(options: DevOptions): Promise<void> {
1329
1331
 
1330
1332
  // Determine secrets root (current dir or workspace root)
1331
1333
  const secretsRoot = findSecretsRoot(process.cwd());
1334
+ logger.log(`🔍 Secrets root: ${secretsRoot}`);
1332
1335
 
1333
1336
  // Determine app name for per-app secret mapping
1334
1337
  const appName = getAppNameFromCwd() ?? undefined;
1338
+ if (appName) {
1339
+ logger.log(`📦 App name: ${appName}`);
1340
+ }
1335
1341
 
1336
1342
  // Load secrets
1337
1343
  const appSecrets = await loadSecretsForApp(secretsRoot, appName);
1338
1344
  if (Object.keys(appSecrets).length > 0) {
1339
1345
  logger.log(`🔐 Loaded ${Object.keys(appSecrets).length} secret(s)`);
1346
+ } else {
1347
+ logger.log(`⚠️ No secrets found in ${secretsRoot}/.gkm/secrets/`);
1340
1348
  }
1341
1349
 
1342
1350
  // Write secrets to temp JSON file
@@ -22,7 +22,7 @@ export function generateAuthAppFiles(
22
22
  private: true,
23
23
  type: 'module',
24
24
  scripts: {
25
- dev: 'tsx watch src/index.ts',
25
+ dev: 'gkm dev --entry ./src/index.ts',
26
26
  build: 'tsc',
27
27
  start: 'node dist/index.js',
28
28
  typecheck: 'tsc --noEmit',
@@ -38,6 +38,7 @@ export function generateAuthAppFiles(
38
38
  pg: '~8.13.0',
39
39
  },
40
40
  devDependencies: {
41
+ '@geekmidas/cli': GEEKMIDAS_VERSIONS['@geekmidas/cli'],
41
42
  '@types/node': '~22.0.0',
42
43
  '@types/pg': '~8.11.0',
43
44
  tsx: '~4.20.0',