@everystack/cli 0.2.11 → 0.2.12

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.11",
3
+ "version": "0.2.12",
4
4
  "description": "CLI and OTA updates for Expo apps on everystack",
5
5
  "license": "AGPL-3.0-only",
6
6
  "publishConfig": {
@@ -99,11 +99,9 @@ export async function updateCommand(flags: UpdateFlags & Record<string, string>)
99
99
 
100
100
  // First export: mobile-safe bundles (no SSR_ENABLED).
101
101
  // Always re-export — stale dist/ is the #1 cause of broken OTA pushes.
102
- // Export mobile platforms only — web static pre-rendering can hang when
103
- // OUTBOUND_HOST points to a real server (open HTTP handles prevent exit).
104
102
  if (needsMobile) {
105
103
  step('Exporting app...');
106
- await exportApp('ios,android');
104
+ await exportApp();
107
105
  success('Export complete');
108
106
  }
109
107
 
@@ -1,12 +1,36 @@
1
- import { execSync } from 'child_process';
1
+ import { spawn } from 'child_process';
2
2
  import fs from 'fs/promises';
3
3
  import path from 'path';
4
4
 
5
- export async function exportApp(platform?: string): Promise<void> {
6
- const platformFlag = platform ? ` --platform ${platform}` : '';
7
- execSync(`npx expo export --output-dir dist${platformFlag}`, {
8
- stdio: 'inherit',
9
- env: { ...process.env },
5
+ export function exportApp(platform?: string): Promise<void> {
6
+ const args = ['expo', 'export', '--output-dir', 'dist'];
7
+ if (platform) args.push('--platform', platform);
8
+
9
+ return new Promise((resolve, reject) => {
10
+ const child = spawn('npx', args, {
11
+ stdio: ['inherit', 'pipe', 'inherit'],
12
+ env: { ...process.env, FORCE_COLOR: '1' },
13
+ });
14
+
15
+ let done = false;
16
+
17
+ child.stdout.on('data', (chunk: Buffer) => {
18
+ process.stdout.write(chunk);
19
+ // "Exported: dist" means all files are written. Static pre-rendering
20
+ // can leave open HTTP handles that prevent the process from exiting.
21
+ // Kill cleanly once we know the work is complete.
22
+ if (!done && chunk.toString().includes('Exported:')) {
23
+ done = true;
24
+ setTimeout(() => { if (!child.killed) child.kill(); }, 2000);
25
+ }
26
+ });
27
+
28
+ child.on('close', (code, signal) => {
29
+ if (code === 0 || (done && signal === 'SIGTERM')) resolve();
30
+ else reject(new Error(`Export failed with exit code ${code}`));
31
+ });
32
+
33
+ child.on('error', reject);
10
34
  });
11
35
  }
12
36