Skip to content
Source
Sign inSign up
pingdotgg/t3code

Replace wait-on with internal desktop resource polling #1600

Mergedjuliusmarmingemerged 4 commits intomain fromrefs/pull/1600/headmerged by juliusmarminge View on GitHub

Showing 4 changed files with 125 additions and 5 deletions (loading 1).

x
0 of 4 viewed, 4 left
5 additions and 3 deletionsapps/desktop/scripts/dev-electron.mjsModified
View file
@@ -1,9 +1,9 @@
import { spawn, spawnSync } from "node:child_process";
import { watch } from "node:fs";
import { join } from "node:path";
-import waitOn from "wait-on";
​
import { desktopDir, resolveElectronPath } from "./electron-launcher.mjs";
+import { waitForResources } from "./wait-for-resources.mjs";
​
const port = Number(process.env.ELECTRON_RENDERER_PORT ?? 5733);
const devServerUrl = `http://localhost:${port}`;
@@ -20,8 +20,10 @@
const restartDebounceMs = 120;
const childTreeGracePeriodMs = 1_200;
​
-await waitOn({
- resources: [`tcp:${port}`, ...requiredFiles.map((filePath) => `file:${filePath}`)],
+await waitForResources({
+ baseDir: desktopDir,
+ files: requiredFiles,
+ tcpPort: port,
});
​
const childEnv = { ...process.env };
119 additions and 0 deletionsapps/desktop/scripts/wait-for-resources.mjsAdded
View file
@@ -0,0 +1,119 @@
+import * as FileSystem from "node:fs/promises";
+import * as Net from "node:net";