@geekmidas/cli 0.51.0 → 0.53.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.51.0",
3
+ "version": "0.53.0",
4
4
  "description": "CLI tools for building Lambda handlers, server applications, and generating OpenAPI specs",
5
5
  "private": false,
6
6
  "type": "module",
@@ -50,9 +50,9 @@
50
50
  "pg": "~8.17.1",
51
51
  "prompts": "~2.4.2",
52
52
  "@geekmidas/envkit": "~0.7.0",
53
- "@geekmidas/constructs": "~0.8.0",
54
53
  "@geekmidas/errors": "~0.1.0",
55
54
  "@geekmidas/logger": "~0.4.0",
55
+ "@geekmidas/constructs": "~0.8.0",
56
56
  "@geekmidas/schema": "~0.1.0"
57
57
  },
58
58
  "devDependencies": {
@@ -68,6 +68,7 @@ export interface EnvResolutionResult {
68
68
  export const AUTO_SUPPORTED_VARS = [
69
69
  'PORT',
70
70
  'NODE_ENV',
71
+ 'STAGE',
71
72
  'DATABASE_URL',
72
73
  'REDIS_URL',
73
74
  'BETTER_AUTH_URL',
@@ -157,7 +158,11 @@ export function resolveEnvVar(
157
158
  return String(context.app.port);
158
159
 
159
160
  case 'NODE_ENV':
160
- return context.stage === 'production' ? 'production' : 'development';
161
+ // Always 'production' for deployed apps (gkm dev handles development mode)
162
+ return 'production';
163
+
164
+ case 'STAGE':
165
+ return context.stage;
161
166
 
162
167
  case 'DATABASE_URL':
163
168
  if (context.appCredentials && context.postgres) {
@@ -1395,8 +1395,12 @@ export async function workspaceDeployCommand(
1395
1395
  };
1396
1396
 
1397
1397
  // Resolve all required environment variables
1398
+ // Always include PORT, NODE_ENV, STAGE even if not explicitly required
1398
1399
  const appRequirements = sniffedApps.get(appName);
1399
- const requiredVars = appRequirements?.requiredEnvVars ?? [];
1400
+ const sniffedVars = appRequirements?.requiredEnvVars ?? [];
1401
+ const requiredVars = [
1402
+ ...new Set(['PORT', 'NODE_ENV', 'STAGE', ...sniffedVars]),
1403
+ ];
1400
1404
  const { valid, missing, resolved } = validateEnvVars(
1401
1405
  requiredVars,
1402
1406
  envContext,
@@ -1582,7 +1586,11 @@ export async function workspaceDeployCommand(
1582
1586
  });
1583
1587
 
1584
1588
  // Prepare environment variables - no secrets needed
1585
- const envVars: string[] = [`NODE_ENV=production`, `PORT=${app.port}`];
1589
+ const envVars: string[] = [
1590
+ `NODE_ENV=production`,
1591
+ `PORT=${app.port}`,
1592
+ `STAGE=${stage}`,
1593
+ ];
1586
1594
 
1587
1595
  // Configure and deploy application in Dokploy
1588
1596
  await api.saveDockerProvider(application.applicationId, imageRef, {
@@ -292,14 +292,8 @@ WORKDIR /app
292
292
  # Copy source (deps already installed)
293
293
  COPY . .
294
294
 
295
- # Debug: Show node_modules/.bin contents and build production server
296
- RUN echo "=== node_modules/.bin contents ===" && \
297
- ls -la node_modules/.bin/ 2>/dev/null || echo "node_modules/.bin not found" && \
298
- echo "=== Checking for gkm ===" && \
299
- which gkm 2>/dev/null || echo "gkm not in PATH" && \
300
- ls -la node_modules/.bin/gkm 2>/dev/null || echo "gkm binary not found in node_modules/.bin" && \
301
- echo "=== Running build ===" && \
302
- ./node_modules/.bin/gkm build --provider server --production
295
+ # Build production server using gkm
296
+ RUN pnpm exec gkm build --provider server --production
303
297
 
304
298
  # Stage 3: Production
305
299
  FROM ${baseImage} AS runner
@@ -389,14 +383,8 @@ WORKDIR /app
389
383
  # Copy pruned source
390
384
  COPY --from=pruner /app/out/full/ ./
391
385
 
392
- # Debug: Show node_modules/.bin contents and build production server
393
- RUN echo "=== node_modules/.bin contents ===" && \
394
- ls -la node_modules/.bin/ 2>/dev/null || echo "node_modules/.bin not found" && \
395
- echo "=== Checking for gkm ===" && \
396
- which gkm 2>/dev/null || echo "gkm not in PATH" && \
397
- ls -la node_modules/.bin/gkm 2>/dev/null || echo "gkm binary not found in node_modules/.bin" && \
398
- echo "=== Running build ===" && \
399
- ./node_modules/.bin/gkm build --provider server --production
386
+ # Build production server using gkm
387
+ RUN pnpm exec gkm build --provider server --production
400
388
 
401
389
  # Stage 4: Production
402
390
  FROM ${baseImage} AS runner
@@ -768,7 +756,7 @@ RUN if [ -n "$GKM_ENCRYPTED_CREDENTIALS" ]; then \
768
756
  fi
769
757
 
770
758
  # Build production server using gkm
771
- RUN cd ${appPath} && ./node_modules/.bin/gkm build --provider server --production
759
+ RUN cd ${appPath} && pnpm exec gkm build --provider server --production
772
760
 
773
761
  # Stage 4: Production
774
762
  FROM ${baseImage} AS runner
@@ -823,7 +811,9 @@ export interface EntryDockerfileOptions {
823
811
  * This is used for apps that don't use gkm routes (e.g., Better Auth servers).
824
812
  * @internal Exported for testing
825
813
  */
826
- export function generateEntryDockerfile(options: EntryDockerfileOptions): string {
814
+ export function generateEntryDockerfile(
815
+ options: EntryDockerfileOptions,
816
+ ): string {
827
817
  const {
828
818
  baseImage,
829
819
  port,