@getmonoceros/workbench 1.21.1 → 1.21.2
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 +33 -6
- package/dist/bin.js.map +1 -1
- package/package.json +1 -1
package/dist/bin.js
CHANGED
|
@@ -5649,6 +5649,15 @@ async function findContainerIds(filters, exec = spawnDocker) {
|
|
|
5649
5649
|
}
|
|
5650
5650
|
return [...ids];
|
|
5651
5651
|
}
|
|
5652
|
+
async function isWorkspaceRunning(root, exec = spawnDocker) {
|
|
5653
|
+
const result = await exec([
|
|
5654
|
+
"ps",
|
|
5655
|
+
"-q",
|
|
5656
|
+
"--filter",
|
|
5657
|
+
`label=devcontainer.local_folder=${root}`
|
|
5658
|
+
]);
|
|
5659
|
+
return result.exitCode === 0 && result.stdout.trim().length > 0;
|
|
5660
|
+
}
|
|
5652
5661
|
async function cleanupDockerObjects(opts) {
|
|
5653
5662
|
const exec = opts.exec ?? spawnDocker;
|
|
5654
5663
|
const tag = opts.logTag ?? "cleanup";
|
|
@@ -6690,7 +6699,7 @@ var CLI_VERSION;
|
|
|
6690
6699
|
var init_version = __esm({
|
|
6691
6700
|
"src/version.ts"() {
|
|
6692
6701
|
"use strict";
|
|
6693
|
-
CLI_VERSION = true ? "1.21.
|
|
6702
|
+
CLI_VERSION = true ? "1.21.2" : "dev";
|
|
6694
6703
|
}
|
|
6695
6704
|
});
|
|
6696
6705
|
|
|
@@ -10045,20 +10054,36 @@ async function runUpgrade(opts) {
|
|
|
10045
10054
|
`No such config: ${containerConfigPath(opts.name, home)}. Run \`monoceros init <template> ${opts.name}\` first.`
|
|
10046
10055
|
);
|
|
10047
10056
|
}
|
|
10048
|
-
const targets = opts.name ? [opts.name] : await listContainerNames2(home);
|
|
10049
10057
|
const apply = opts.applyRunner ?? runApply;
|
|
10058
|
+
const exec = opts.dockerExec ?? spawnDocker;
|
|
10050
10059
|
const now = opts.now ?? /* @__PURE__ */ new Date();
|
|
10060
|
+
let targets;
|
|
10061
|
+
const skipped = [];
|
|
10062
|
+
if (opts.name) {
|
|
10063
|
+
targets = [opts.name];
|
|
10064
|
+
} else {
|
|
10065
|
+
targets = [];
|
|
10066
|
+
for (const name of await listContainerNames2(home)) {
|
|
10067
|
+
if (await isWorkspaceRunning(containerDir(name, home), exec)) {
|
|
10068
|
+
targets.push(name);
|
|
10069
|
+
} else {
|
|
10070
|
+
skipped.push(name);
|
|
10071
|
+
}
|
|
10072
|
+
}
|
|
10073
|
+
}
|
|
10051
10074
|
const pruneAndStamp = async () => {
|
|
10052
10075
|
const result = await pruneStaleImages({
|
|
10053
10076
|
home,
|
|
10054
10077
|
currentContainerNames: new Set(await listContainerNames2(home)),
|
|
10055
|
-
|
|
10078
|
+
exec
|
|
10056
10079
|
});
|
|
10057
10080
|
await markUpgraded(now.toISOString(), home);
|
|
10058
10081
|
return result;
|
|
10059
10082
|
};
|
|
10060
10083
|
if (targets.length === 0) {
|
|
10061
|
-
logger.info(
|
|
10084
|
+
logger.info(
|
|
10085
|
+
opts.name ? "Nothing to upgrade." : skipped.length > 0 ? `No running containers to refresh (${skipped.length} not running: ${skipped.join(", ")}). Start one, or refresh it with \`monoceros upgrade <name>\`.` : "No running containers to refresh."
|
|
10086
|
+
);
|
|
10062
10087
|
await pruneAndStamp();
|
|
10063
10088
|
return 0;
|
|
10064
10089
|
}
|
|
@@ -10100,11 +10125,12 @@ async function runUpgrade(opts) {
|
|
|
10100
10125
|
if (worstExit === 0) {
|
|
10101
10126
|
const prune = await pruneAndStamp();
|
|
10102
10127
|
logger.success(
|
|
10103
|
-
`Upgraded ${opts.name ? `'${opts.name}'` : `${targets.length} container${targets.length === 1 ? "" : "s"}`}
|
|
10128
|
+
`Upgraded ${opts.name ? `'${opts.name}'` : `${targets.length} running container${targets.length === 1 ? "" : "s"}`}
|
|
10104
10129
|
tools rebuilt \u2014 latest pulled
|
|
10105
10130
|
base ${pinVersion} ${bumped > 0 ? `(${bumped} bumped)` : "(already latest)"}
|
|
10106
10131
|
pruned ${formatPruneLine(prune)}
|
|
10107
|
-
|
|
10132
|
+
` + (skipped.length > 0 ? ` skipped ${skipped.length} not running (${skipped.join(", ")})
|
|
10133
|
+
` : "") + ` recorded ${now.toISOString().slice(0, 16).replace("T", " ")} UTC`
|
|
10108
10134
|
);
|
|
10109
10135
|
}
|
|
10110
10136
|
return worstExit;
|
|
@@ -10133,6 +10159,7 @@ var init_upgrade = __esm({
|
|
|
10133
10159
|
init_paths();
|
|
10134
10160
|
init_machine_state();
|
|
10135
10161
|
init_catalog();
|
|
10162
|
+
init_compose();
|
|
10136
10163
|
init_proxy();
|
|
10137
10164
|
init_prune();
|
|
10138
10165
|
init_apply();
|