@everystack/cli 0.2.3 → 0.2.5

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": "@everystack/cli",
3
- "version": "0.2.3",
3
+ "version": "0.2.5",
4
4
  "description": "CLI and OTA updates for Expo apps on everystack",
5
5
  "license": "AGPL-3.0-only",
6
6
  "publishConfig": {
@@ -16,6 +16,7 @@ export interface UpdateFlags {
16
16
  branch?: string;
17
17
  message?: string;
18
18
  platform?: string;
19
+ environment?: string;
19
20
  export?: string;
20
21
  }
21
22
 
@@ -26,12 +27,13 @@ export async function updateCommand(flags: UpdateFlags & Record<string, string>)
26
27
  // (e.g. OUTBOUND_HOST=localhost → LAN IP) to leak into the manifest.
27
28
  process.env.EVERYSTACK_UPDATE = '1';
28
29
 
29
- // Propagate --stage to ENVIRONMENT before app.config.js evaluation.
30
- // Without this, the manifest snapshots whatever the local shell has
31
- // (often unset 'development'), baking wrong API URLs and feature
32
- // flags into the OTA update. Only set if not already supplied.
33
- if (flags.stage) {
34
- process.env.ENVIRONMENT ||= flags.stage;
30
+ // Set ENVIRONMENT before app.config.js evaluation so the manifest
31
+ // snapshots the correct API URLs and feature flags for the target.
32
+ // --environment is explicit; --stage is NOT used as a fallback because
33
+ // SST stage names (dev, prod) don't match EAS profile names
34
+ // (development, production) and conflating them causes config failures.
35
+ if (flags.environment) {
36
+ process.env.ENVIRONMENT ||= flags.environment;
35
37
  }
36
38
 
37
39
  // When --stage is provided, resolve deployed config early so HOST_URL
@@ -412,8 +414,17 @@ async function loadAppConfig(): Promise<any> {
412
414
  // Handle Expo's function export pattern: export default () => ({ ... })
413
415
  if (typeof resolved === 'function') resolved = resolved();
414
416
  return resolved.expo || resolved;
415
- } catch {
416
- throw new Error('Could not find app.json or app.config.js');
417
+ } catch (e) {
418
+ const configPath = path.resolve('app.config.js');
419
+ try {
420
+ await fs.access(configPath);
421
+ // File exists but failed to import — surface the real error
422
+ throw new Error(`Failed to load app.config.js: ${e instanceof Error ? e.message : e}`);
423
+ } catch (accessErr) {
424
+ if (accessErr instanceof Error && accessErr.message.startsWith('Failed to load'))
425
+ throw accessErr;
426
+ throw new Error('Could not find app.json or app.config.js');
427
+ }
417
428
  }
418
429
  }
419
430
  }
package/src/cli/index.ts CHANGED
@@ -150,8 +150,8 @@ function printHelp() {
150
150
  everystack - CLI for Expo apps on everystack
151
151
 
152
152
  Usage:
153
- everystack update --branch <name> --message <msg> [--platform ios|android|web|all] [--stage <name>] [--skip-export]
154
- everystack update --channel <name> --message <msg> [--platform ios|android|web|all] [--stage <name>] [--skip-export]
153
+ everystack update --branch <name> --message <msg> [--platform ios|android|web|all] [--stage <name>] [--environment <name>] [--skip-export]
154
+ everystack update --channel <name> --message <msg> [--platform ios|android|web|all] [--stage <name>] [--environment <name>] [--skip-export]
155
155
  everystack db:migrate [--stage <name>] Run database migrations on deployed Lambda
156
156
  everystack db:seed [--stage <name>] Seed database on deployed Lambda (dev only)
157
157
  everystack db:reset [--stage <name>] Drop all schemas + re-run migrations (dev only)
@@ -183,6 +183,9 @@ Stage resolution:
183
183
 
184
184
  Without --stage, reads .sst/outputs.json (written by the last \`sst deploy\`).
185
185
 
186
+ --environment <name> Set ENVIRONMENT for app.config.js evaluation (e.g. development, staging, production).
187
+ Use this when your SST stage name differs from your EAS build profile name.
188
+
186
189
  Auth:
187
190
  All commands use AWS IAM credentials (default credential chain).
188
191
  Mobile publishes also accept EVERYSTACK_TOKEN env var.