@hasna/todos 0.9.10 → 0.9.11
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/dist/cli/index.js +14 -1
- package/dist/server/index.js +19 -1
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -11236,7 +11236,20 @@ program2.command("config").description("View or update configuration").option("-
|
|
|
11236
11236
|
});
|
|
11237
11237
|
program2.command("serve").description("Start the web dashboard").option("--port <port>", "Port number", "19427").option("--no-open", "Don't open browser automatically").action(async (opts) => {
|
|
11238
11238
|
const { startServer: startServer2 } = await Promise.resolve().then(() => (init_serve(), exports_serve));
|
|
11239
|
-
|
|
11239
|
+
const requestedPort = parseInt(opts.port, 10);
|
|
11240
|
+
let port = requestedPort;
|
|
11241
|
+
for (let p = requestedPort;p < requestedPort + 100; p++) {
|
|
11242
|
+
try {
|
|
11243
|
+
const s = Bun.serve({ port: p, fetch: () => new Response("") });
|
|
11244
|
+
s.stop(true);
|
|
11245
|
+
port = p;
|
|
11246
|
+
break;
|
|
11247
|
+
} catch {}
|
|
11248
|
+
}
|
|
11249
|
+
if (port !== requestedPort) {
|
|
11250
|
+
console.log(`Port ${requestedPort} in use, using ${port}`);
|
|
11251
|
+
}
|
|
11252
|
+
await startServer2(port, { open: opts.open !== false });
|
|
11240
11253
|
});
|
|
11241
11254
|
program2.command("watch").description("Live-updating task list (refreshes every few seconds)").option("-s, --status <status>", "Filter by status (default: pending,in_progress)").option("-i, --interval <seconds>", "Refresh interval in seconds", "5").action(async (opts) => {
|
|
11242
11255
|
const globalOpts = program2.opts();
|
package/dist/server/index.js
CHANGED
|
@@ -1282,4 +1282,22 @@ function parsePort() {
|
|
|
1282
1282
|
}
|
|
1283
1283
|
return DEFAULT_PORT;
|
|
1284
1284
|
}
|
|
1285
|
-
|
|
1285
|
+
async function findFreePort(start) {
|
|
1286
|
+
for (let port = start;port < start + 100; port++) {
|
|
1287
|
+
try {
|
|
1288
|
+
const server = Bun.serve({ port, fetch: () => new Response("") });
|
|
1289
|
+
server.stop(true);
|
|
1290
|
+
return port;
|
|
1291
|
+
} catch {}
|
|
1292
|
+
}
|
|
1293
|
+
return start;
|
|
1294
|
+
}
|
|
1295
|
+
async function main() {
|
|
1296
|
+
const requestedPort = parsePort();
|
|
1297
|
+
const port = await findFreePort(requestedPort);
|
|
1298
|
+
if (port !== requestedPort) {
|
|
1299
|
+
console.log(`Port ${requestedPort} in use, using ${port}`);
|
|
1300
|
+
}
|
|
1301
|
+
startServer(port);
|
|
1302
|
+
}
|
|
1303
|
+
main();
|