forge-remote 2.1.1 → 2.1.2

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": "forge-remote",
3
- "version": "2.1.1",
3
+ "version": "2.1.2",
4
4
  "description": "Desktop relay for Forge Remote — mobile command center for AI coding agents",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",
@@ -231,88 +231,60 @@ export async function runBuild(projectPath, platform, onOutput) {
231
231
  process.env.DEVELOPER_DIR ||
232
232
  "/Applications/Xcode.app/Contents/Developer",
233
233
  };
234
- // For iOS builds, run flutter clean first to avoid stale storyboard caches
235
- const fullCmd =
236
- platform === "ios"
237
- ? `flutter clean > /dev/null 2>&1; ${buildCmd}`
238
- : buildCmd;
239
- const proc = spawn(shell, ["-l", "-c", fullCmd], {
240
- cwd: projectPath,
241
- env: buildEnv,
242
- stdio: ["pipe", "pipe", "pipe"],
243
- });
234
+ try {
235
+ const output = execSync(buildCmd, {
236
+ cwd: projectPath,
237
+ env: buildEnv,
238
+ timeout: 600000, // 10 minutes
239
+ encoding: "utf-8",
240
+ stdio: ["pipe", "pipe", "pipe"],
241
+ shell: shell,
242
+ });
244
243
 
245
- // Timeout: 10 minutes max for any build
246
- const buildTimeout = setTimeout(() => {
247
- log.warn(`Build timed out after 10 minutes: ${buildCmd}`);
248
- try {
249
- proc.kill("SIGTERM");
250
- } catch {}
251
- setTimeout(() => {
252
- try {
253
- proc.kill("SIGKILL");
254
- } catch {}
255
- }, 5000);
256
- reject(new Error(`Build timed out after 10 minutes`));
257
- }, 600000);
244
+ const duration = Math.round((Date.now() - startTime) / 1000);
245
+ const outputPath =
246
+ projectInfo.outputPaths[platform] ||
247
+ projectInfo.outputPaths.web ||
248
+ projectInfo.outputPaths.default ||
249
+ null;
258
250
 
259
- proc.stdout.on("data", (data) => {
260
- const text = data.toString();
261
- for (const line of text.split("\n")) {
251
+ // Stream output lines to callback
252
+ for (const line of output.split("\n")) {
262
253
  const trimmed = line.trim();
263
254
  if (trimmed) {
264
255
  outputLines.push(trimmed);
265
256
  if (onOutput) onOutput(trimmed, "stdout");
266
257
  }
267
258
  }
268
- });
269
259
 
270
- proc.stderr.on("data", (data) => {
271
- const text = data.toString();
272
- for (const line of text.split("\n")) {
260
+ log.info(`Build succeeded in ${duration}s`);
261
+ resolve({
262
+ success: true,
263
+ output: outputLines.join("\n"),
264
+ duration,
265
+ outputPath: outputPath ? path.resolve(projectPath, outputPath) : null,
266
+ framework: projectInfo.framework,
267
+ platform,
268
+ });
269
+ } catch (err) {
270
+ const duration = Math.round((Date.now() - startTime) / 1000);
271
+ const stderr = err.stderr?.toString() || "";
272
+ const stdout = err.stdout?.toString() || "";
273
+ const allOutput = (stdout + "\n" + stderr).trim();
274
+
275
+ // Stream output lines to callback
276
+ for (const line of allOutput.split("\n")) {
273
277
  const trimmed = line.trim();
274
278
  if (trimmed) {
275
279
  outputLines.push(trimmed);
276
280
  if (onOutput) onOutput(trimmed, "stderr");
277
281
  }
278
282
  }
279
- });
280
283
 
281
- proc.on("error", (err) => {
282
- clearTimeout(buildTimeout);
283
- reject(new Error(`Build process error: ${err.message}`));
284
- });
285
-
286
- proc.on("close", (code) => {
287
- clearTimeout(buildTimeout);
288
- const duration = Math.round((Date.now() - startTime) / 1000);
289
- const outputPath =
290
- projectInfo.outputPaths[platform] ||
291
- projectInfo.outputPaths.web ||
292
- projectInfo.outputPaths.default ||
293
- null;
294
-
295
- if (code === 0) {
296
- log.info(`Build succeeded in ${duration}s`);
297
- resolve({
298
- success: true,
299
- output: outputLines.join("\n"),
300
- duration,
301
- outputPath: outputPath ? path.resolve(projectPath, outputPath) : null,
302
- framework: projectInfo.framework,
303
- platform,
304
- });
305
- } else {
306
- const tail = outputLines.slice(-15).join("\n");
307
- log.error(`Build failed (exit code ${code})`);
308
- reject(new Error(`Build failed (exit code ${code})\n${tail}`));
309
- }
310
- });
311
-
312
- proc.on("error", (err) => {
313
- log.error(`Build process error: ${err.message}`);
314
- reject(new Error(`Build process error: ${err.message}`));
315
- });
284
+ const tail = outputLines.slice(-15).join("\n");
285
+ log.error(`Build failed (exit code ${err.status}) after ${duration}s`);
286
+ reject(new Error(`Build failed (exit code ${err.status})\n${tail}`));
287
+ }
316
288
  });
317
289
  }
318
290