@getmonoceros/workbench 1.38.9 → 1.38.12
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 +19 -85
- package/dist/bin.js.map +1 -1
- package/package.json +1 -1
package/dist/bin.js
CHANGED
|
@@ -7290,7 +7290,8 @@ async function runContainerCycle(root, opts) {
|
|
|
7290
7290
|
);
|
|
7291
7291
|
const filters = [
|
|
7292
7292
|
`label=com.docker.compose.project=${projectName}`,
|
|
7293
|
-
`name=^${projectName}
|
|
7293
|
+
`name=^${projectName}-`,
|
|
7294
|
+
`name=^monoceros-${path18.basename(root)}$`
|
|
7294
7295
|
];
|
|
7295
7296
|
const { exitCode: rmExit } = await cleanupDockerObjects({
|
|
7296
7297
|
projectName,
|
|
@@ -9005,7 +9006,7 @@ var CLI_VERSION;
|
|
|
9005
9006
|
var init_version = __esm({
|
|
9006
9007
|
"src/version.ts"() {
|
|
9007
9008
|
"use strict";
|
|
9008
|
-
CLI_VERSION = true ? "1.38.
|
|
9009
|
+
CLI_VERSION = true ? "1.38.12" : "dev";
|
|
9009
9010
|
}
|
|
9010
9011
|
});
|
|
9011
9012
|
|
|
@@ -11373,6 +11374,8 @@ async function runRemove(opts) {
|
|
|
11373
11374
|
if (code !== "EACCES" && code !== "EPERM") {
|
|
11374
11375
|
throw err;
|
|
11375
11376
|
}
|
|
11377
|
+
const parentDir = path29.dirname(containerPath);
|
|
11378
|
+
const childName = path29.basename(containerPath);
|
|
11376
11379
|
logger.info(
|
|
11377
11380
|
`[remove] host-side rm hit ${code} on ${prettyPath(containerPath)}; using a throw-away alpine container to clean root-owned files\u2026`
|
|
11378
11381
|
);
|
|
@@ -11380,20 +11383,18 @@ async function runRemove(opts) {
|
|
|
11380
11383
|
"run",
|
|
11381
11384
|
"--rm",
|
|
11382
11385
|
"-v",
|
|
11383
|
-
`${
|
|
11386
|
+
`${parentDir}:/parent`,
|
|
11384
11387
|
"alpine:3.21",
|
|
11385
|
-
"
|
|
11386
|
-
"
|
|
11387
|
-
|
|
11388
|
-
"1",
|
|
11389
|
-
"-delete"
|
|
11388
|
+
"rm",
|
|
11389
|
+
"-rf",
|
|
11390
|
+
`/parent/${childName}`
|
|
11390
11391
|
]);
|
|
11391
11392
|
try {
|
|
11392
11393
|
await fs19.rm(containerPath, { recursive: true, force: true });
|
|
11393
11394
|
} catch (err2) {
|
|
11394
11395
|
const code2 = err2.code;
|
|
11395
11396
|
throw new Error(
|
|
11396
|
-
`docker-based cleanup of ${containerPath} did not fully clear it (alpine
|
|
11397
|
+
`docker-based cleanup of ${containerPath} did not fully clear it (alpine rm exit ${exit}${stderr.trim() ? `: ${stderr.trim()}` : ""}; host rm: ${code2}). Inspect with \`sudo ls -la ${containerPath}\` and clean manually.`
|
|
11397
11398
|
);
|
|
11398
11399
|
}
|
|
11399
11400
|
}
|
|
@@ -12623,65 +12624,15 @@ var init_caddy = __esm({
|
|
|
12623
12624
|
}
|
|
12624
12625
|
});
|
|
12625
12626
|
|
|
12626
|
-
// src/devcontainer/wsl-networking.ts
|
|
12627
|
-
import { spawn as spawn14 } from "child_process";
|
|
12628
|
-
import os4 from "os";
|
|
12629
|
-
function capture(cmd, args) {
|
|
12630
|
-
return new Promise((resolve) => {
|
|
12631
|
-
let stdout = "";
|
|
12632
|
-
const child = spawn14(cmd, args, {
|
|
12633
|
-
stdio: ["ignore", "pipe", "ignore"]
|
|
12634
|
-
});
|
|
12635
|
-
child.stdout.on("data", (c) => stdout += c.toString());
|
|
12636
|
-
child.on("error", () => resolve({ stdout: "", code: -1 }));
|
|
12637
|
-
child.on("exit", (code) => resolve({ stdout, code: code ?? -1 }));
|
|
12638
|
-
});
|
|
12639
|
-
}
|
|
12640
|
-
async function windowsLanIpv4() {
|
|
12641
|
-
if (!isWsl()) return null;
|
|
12642
|
-
const psScript = "(Get-NetIPConfiguration | Where-Object { $_.IPv4DefaultGateway -ne $null -and $_.NetAdapter.Status -eq 'Up' } | Select-Object -First 1 -ExpandProperty IPv4Address).IPAddress";
|
|
12643
|
-
const r = await capture("powershell.exe", [
|
|
12644
|
-
"-NoProfile",
|
|
12645
|
-
"-NonInteractive",
|
|
12646
|
-
"-Command",
|
|
12647
|
-
psScript
|
|
12648
|
-
]);
|
|
12649
|
-
const ip = r.stdout.replace(/\r/g, "").trim().split(/\s+/)[0] ?? "";
|
|
12650
|
-
return IPV4_RE3.test(ip) ? ip : null;
|
|
12651
|
-
}
|
|
12652
|
-
function localInterfacesInclude(ip) {
|
|
12653
|
-
for (const list of Object.values(os4.networkInterfaces())) {
|
|
12654
|
-
for (const addr of list ?? []) {
|
|
12655
|
-
if (addr.family === "IPv4" && addr.address === ip) return true;
|
|
12656
|
-
}
|
|
12657
|
-
}
|
|
12658
|
-
return false;
|
|
12659
|
-
}
|
|
12660
|
-
async function wslLanTarget() {
|
|
12661
|
-
const lanIp = await windowsLanIpv4();
|
|
12662
|
-
return {
|
|
12663
|
-
lanIp,
|
|
12664
|
-
mirrored: lanIp !== null && localInterfacesInclude(lanIp)
|
|
12665
|
-
};
|
|
12666
|
-
}
|
|
12667
|
-
var IPV4_RE3;
|
|
12668
|
-
var init_wsl_networking = __esm({
|
|
12669
|
-
"src/devcontainer/wsl-networking.ts"() {
|
|
12670
|
-
"use strict";
|
|
12671
|
-
init_ssh_attach();
|
|
12672
|
-
IPV4_RE3 = /^(\d{1,3}\.){3}\d{1,3}$/;
|
|
12673
|
-
}
|
|
12674
|
-
});
|
|
12675
|
-
|
|
12676
12627
|
// src/share/run.ts
|
|
12677
|
-
import
|
|
12678
|
-
import { spawn as
|
|
12628
|
+
import os4 from "os";
|
|
12629
|
+
import { spawn as spawn14, spawnSync as spawnSync2 } from "child_process";
|
|
12679
12630
|
import { consola as consola35 } from "consola";
|
|
12680
12631
|
import { promises as fs22 } from "fs";
|
|
12681
12632
|
import path34 from "path";
|
|
12682
12633
|
function realHostAddresses() {
|
|
12683
12634
|
let ip;
|
|
12684
|
-
for (const list of Object.values(
|
|
12635
|
+
for (const list of Object.values(os4.networkInterfaces())) {
|
|
12685
12636
|
for (const addr of list ?? []) {
|
|
12686
12637
|
if (addr.family === "IPv4" && !addr.internal) {
|
|
12687
12638
|
ip = addr.address;
|
|
@@ -12700,19 +12651,19 @@ function mdnsHostName() {
|
|
|
12700
12651
|
const name = res.status === 0 ? res.stdout.trim() : "";
|
|
12701
12652
|
if (name) return `${name}.local`;
|
|
12702
12653
|
}
|
|
12703
|
-
const hn =
|
|
12654
|
+
const hn = os4.hostname();
|
|
12704
12655
|
return hn.endsWith(".local") ? hn : `${hn}.local`;
|
|
12705
12656
|
}
|
|
12706
12657
|
async function defaultEnsureImage(image, log) {
|
|
12707
12658
|
const present = await new Promise((resolve) => {
|
|
12708
|
-
const c =
|
|
12659
|
+
const c = spawn14("docker", ["image", "inspect", image], { stdio: "ignore" });
|
|
12709
12660
|
c.on("error", () => resolve(false));
|
|
12710
12661
|
c.on("exit", (code) => resolve(code === 0));
|
|
12711
12662
|
});
|
|
12712
12663
|
if (present) return;
|
|
12713
12664
|
log.info(dim(`Pulling ${image} (first run, one-time)\u2026`));
|
|
12714
12665
|
await new Promise((resolve, reject) => {
|
|
12715
|
-
const c =
|
|
12666
|
+
const c = spawn14("docker", ["pull", "-q", image], {
|
|
12716
12667
|
stdio: ["ignore", "ignore", "pipe"]
|
|
12717
12668
|
});
|
|
12718
12669
|
let err = "";
|
|
@@ -12765,14 +12716,7 @@ async function runShare(opts) {
|
|
|
12765
12716
|
for (const port of ports) {
|
|
12766
12717
|
await preflight({ port, address: SHARE_ADDRESS });
|
|
12767
12718
|
}
|
|
12768
|
-
const { ip
|
|
12769
|
-
let ip = rawIp;
|
|
12770
|
-
let wslNatUnreachable = false;
|
|
12771
|
-
if (isWsl()) {
|
|
12772
|
-
const t = await wslLanTarget();
|
|
12773
|
-
if (t.lanIp) ip = t.lanIp;
|
|
12774
|
-
wslNatUnreachable = t.lanIp !== null && !t.mirrored;
|
|
12775
|
-
}
|
|
12719
|
+
const { ip, mdnsName } = (opts.hostAddresses ?? realHostAddresses)();
|
|
12776
12720
|
const sans = [mdnsName, ip, "localhost", "127.0.0.1"].filter(
|
|
12777
12721
|
(s) => typeof s === "string" && s.length > 0
|
|
12778
12722
|
);
|
|
@@ -12819,17 +12763,6 @@ async function runShare(opts) {
|
|
|
12819
12763
|
` First device? Trust the local CA once so HTTPS is warning-free: ${caPath}`
|
|
12820
12764
|
)
|
|
12821
12765
|
);
|
|
12822
|
-
if (wslNatUnreachable) {
|
|
12823
|
-
const warn = log.warn ?? log.info;
|
|
12824
|
-
warn(
|
|
12825
|
-
"WSL is in NAT mode, so the URL above is not reachable from other devices yet."
|
|
12826
|
-
);
|
|
12827
|
-
warn("Enable mirrored networking once, then re-run this command:");
|
|
12828
|
-
warn(" 1. add to %USERPROFILE%\\.wslconfig:");
|
|
12829
|
-
warn(" [wsl2]");
|
|
12830
|
-
warn(" networkingMode=mirrored");
|
|
12831
|
-
warn(" 2. run wsl --shutdown in PowerShell (closes your WSL sessions)");
|
|
12832
|
-
}
|
|
12833
12766
|
const dockerSpawn = opts.dockerSpawn ?? defaultDockerSpawn;
|
|
12834
12767
|
const handles = [
|
|
12835
12768
|
dockerSpawn(
|
|
@@ -12869,7 +12802,6 @@ var init_run4 = __esm({
|
|
|
12869
12802
|
init_caddy();
|
|
12870
12803
|
init_paths();
|
|
12871
12804
|
init_ssh_attach();
|
|
12872
|
-
init_wsl_networking();
|
|
12873
12805
|
init_format();
|
|
12874
12806
|
SHARE_ADDRESS = "0.0.0.0";
|
|
12875
12807
|
}
|
|
@@ -13996,6 +13928,7 @@ var init_main = __esm({
|
|
|
13996
13928
|
|
|
13997
13929
|
// src/bin.ts
|
|
13998
13930
|
import { runMain } from "citty";
|
|
13931
|
+
import { consola as consola42 } from "consola";
|
|
13999
13932
|
|
|
14000
13933
|
// src/devcontainer/docker-group-bootstrap.ts
|
|
14001
13934
|
import { spawnSync } from "child_process";
|
|
@@ -14281,6 +14214,7 @@ init_main();
|
|
|
14281
14214
|
init_notifier();
|
|
14282
14215
|
init_version();
|
|
14283
14216
|
bootstrapDockerGroup();
|
|
14217
|
+
consola42.options.formatOptions.date = false;
|
|
14284
14218
|
consumeInnerArgsFromProcessArgv();
|
|
14285
14219
|
async function entry() {
|
|
14286
14220
|
scheduleUpdateNotice({
|