@nicmeriano/spool-server 0.0.2 → 0.0.4
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/bin.js +8 -6
- package/dist/bin.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +8 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -420,6 +420,8 @@ interface ServerOptions {
|
|
|
420
420
|
port?: number;
|
|
421
421
|
/** Working directory for state file and agent (default: process.cwd()) */
|
|
422
422
|
cwd?: string;
|
|
423
|
+
/** Don't open the browser when the app URL is reported */
|
|
424
|
+
noOpen?: boolean;
|
|
423
425
|
}
|
|
424
426
|
declare function startServer(options?: ServerOptions): Promise<void>;
|
|
425
427
|
|
package/dist/index.js
CHANGED
|
@@ -126,11 +126,13 @@ function createEventsRoutes(ctx) {
|
|
|
126
126
|
app.post("/app-url", async (c) => {
|
|
127
127
|
const body = await c.req.json();
|
|
128
128
|
console.error(`[spool] Received app URL: ${body.url}`);
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
129
|
+
if (!ctx.noOpen) {
|
|
130
|
+
const host = c.req.header("host") || "localhost:3142";
|
|
131
|
+
const shellUrl = `http://${host}`;
|
|
132
|
+
console.error(`[spool] Opening ${shellUrl}`);
|
|
133
|
+
const cmd = platform() === "darwin" ? "open" : platform() === "win32" ? "start" : "xdg-open";
|
|
134
|
+
execFile(cmd, [shellUrl]);
|
|
135
|
+
}
|
|
134
136
|
let state = ctx.getState();
|
|
135
137
|
state = { ...state, appUrl: body.url };
|
|
136
138
|
ctx.setState(state);
|
|
@@ -2061,7 +2063,7 @@ async function startServer(options = {}) {
|
|
|
2061
2063
|
}
|
|
2062
2064
|
}
|
|
2063
2065
|
}));
|
|
2064
|
-
app.route("/api", createEventsRoutes(routeCtx));
|
|
2066
|
+
app.route("/api", createEventsRoutes({ ...routeCtx, noOpen: options.noOpen ?? false }));
|
|
2065
2067
|
app.route("/api/annotations", createAnnotationsRoutes(routeCtx));
|
|
2066
2068
|
app.route("/api/changes", createChangesRoutes(routeCtx));
|
|
2067
2069
|
app.route("/api/tasks", createTasksRoutes(routeCtx));
|