@nanocollective/roster 0.1.0-alpha.8 → 0.1.0-alpha.9
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.js +31 -0
- package/docs/commands.md +4 -0
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -5354,6 +5354,29 @@ function short3(e) {
|
|
|
5354
5354
|
return line.length > 200 ? `${line.slice(0, 199)}\u2026` : line;
|
|
5355
5355
|
}
|
|
5356
5356
|
|
|
5357
|
+
// src/lib/browser.ts
|
|
5358
|
+
import { spawn } from "child_process";
|
|
5359
|
+
function shouldOpen(env, isTTY, noOpen) {
|
|
5360
|
+
if (noOpen || !isTTY) return false;
|
|
5361
|
+
if (env.CI || env.BROWSER === "none" || env.SSH_CONNECTION) return false;
|
|
5362
|
+
return true;
|
|
5363
|
+
}
|
|
5364
|
+
function openerFor(platform, url) {
|
|
5365
|
+
if (platform === "darwin") return ["open", [url]];
|
|
5366
|
+
if (platform === "win32") return ["cmd", ["/c", "start", "", url]];
|
|
5367
|
+
return ["xdg-open", [url]];
|
|
5368
|
+
}
|
|
5369
|
+
function openBrowser(url) {
|
|
5370
|
+
const [cmd, args] = openerFor(process.platform, url);
|
|
5371
|
+
try {
|
|
5372
|
+
const child = spawn(cmd, args, { stdio: "ignore", detached: true });
|
|
5373
|
+
child.on("error", () => {
|
|
5374
|
+
});
|
|
5375
|
+
child.unref();
|
|
5376
|
+
} catch {
|
|
5377
|
+
}
|
|
5378
|
+
}
|
|
5379
|
+
|
|
5357
5380
|
// src/lib/inbox.ts
|
|
5358
5381
|
import { execFile as execFile5 } from "child_process";
|
|
5359
5382
|
import { promisify as promisify4 } from "util";
|
|
@@ -6268,6 +6291,7 @@ roster portal
|
|
|
6268
6291
|
--host <addr> default 127.0.0.1. Anything else exposes write actions to the network.
|
|
6269
6292
|
--ops <dir> ops repo directory (default: found by walking up)
|
|
6270
6293
|
--dir <path> where a tenant would be created or checked out (default: here)
|
|
6294
|
+
--no-open don't open a browser (also off in CI, over SSH, or with BROWSER=none)
|
|
6271
6295
|
`;
|
|
6272
6296
|
var MIME = {
|
|
6273
6297
|
".md": "text/plain; charset=utf-8",
|
|
@@ -7380,6 +7404,9 @@ ${warn}
|
|
|
7380
7404
|
|
|
7381
7405
|
`
|
|
7382
7406
|
);
|
|
7407
|
+
if (shouldOpen(process.env, Boolean(process.stdout.isTTY), opts.noOpen === true)) {
|
|
7408
|
+
openBrowser(`http://localhost:${port}`);
|
|
7409
|
+
}
|
|
7383
7410
|
});
|
|
7384
7411
|
});
|
|
7385
7412
|
}
|
|
@@ -7480,6 +7507,10 @@ function parseFlags11(argv) {
|
|
|
7480
7507
|
const out = {};
|
|
7481
7508
|
for (let i = 0; i < argv.length; i++) {
|
|
7482
7509
|
const flag = argv[i];
|
|
7510
|
+
if (flag === "--no-open") {
|
|
7511
|
+
out.noOpen = true;
|
|
7512
|
+
continue;
|
|
7513
|
+
}
|
|
7483
7514
|
const value = argv[++i];
|
|
7484
7515
|
if (value === void 0) throw new Error(`${flag} needs a value`);
|
|
7485
7516
|
if (flag === "--port") out.port = Number(value);
|
package/docs/commands.md
CHANGED
|
@@ -271,8 +271,12 @@ which is the shortest way in.
|
|
|
271
271
|
--port <n> default 4300
|
|
272
272
|
--host <a> default 127.0.0.1. Anything else exposes write actions to the network.
|
|
273
273
|
--dir <path> where a tenant would be created or checked out. Default: here.
|
|
274
|
+
--no-open don't open a browser
|
|
274
275
|
```
|
|
275
276
|
|
|
277
|
+
It opens the page in your browser when it starts. It stays closed in CI, over SSH, when output
|
|
278
|
+
is not a terminal, or with `BROWSER=none`.
|
|
279
|
+
|
|
276
280
|
**With no tenant where you started it, this is the setup screen**: it stands up a new org, or
|
|
277
281
|
checks out one that already runs roster. Local only. See [the portal](portal.md).
|
|
278
282
|
|