@boxes-dev/dvb 1.0.654 → 1.0.655
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/dvb-update.cjs
CHANGED
|
@@ -3955,6 +3955,35 @@ var runBackgroundUpdaterDaemon = async (homeDir = process.env.HOME?.trim() || im
|
|
|
3955
3955
|
}
|
|
3956
3956
|
};
|
|
3957
3957
|
|
|
3958
|
+
// src/bootstrap/updateCommand.ts
|
|
3959
|
+
var formatRuntimeUpdateMessage = (result) => {
|
|
3960
|
+
if (!result.changed) {
|
|
3961
|
+
return `dvb runtime is already current at ${result.currentVersion}.`;
|
|
3962
|
+
}
|
|
3963
|
+
return `Updated dvb runtime ${result.previousVersion ?? "unknown"} -> ${result.currentVersion}.`;
|
|
3964
|
+
};
|
|
3965
|
+
var formatStandaloneUpdateMessage = (result) => {
|
|
3966
|
+
if (!result.changed) {
|
|
3967
|
+
return `Standalone dvb is already current at ${result.currentVersion}.`;
|
|
3968
|
+
}
|
|
3969
|
+
return `Updated standalone dvb ${result.previousVersion ?? "unknown"} -> ${result.currentVersion}.`;
|
|
3970
|
+
};
|
|
3971
|
+
var runForegroundUpdate = async (options = {}) => {
|
|
3972
|
+
const updateRuntimeOnceFn = options.updateRuntimeOnceFn ?? updateRuntimeOnce;
|
|
3973
|
+
const isStandaloneModeFn = options.isStandaloneModeFn ?? isStandaloneMode;
|
|
3974
|
+
const updateStandaloneOnceFn = options.updateStandaloneOnceFn ?? updateStandaloneOnce;
|
|
3975
|
+
const runtime = await updateRuntimeOnceFn();
|
|
3976
|
+
const standalone = isStandaloneModeFn() ? await updateStandaloneOnceFn() : null;
|
|
3977
|
+
return { runtime, standalone };
|
|
3978
|
+
};
|
|
3979
|
+
var formatForegroundUpdateMessages = (result) => {
|
|
3980
|
+
const lines = [formatRuntimeUpdateMessage(result.runtime)];
|
|
3981
|
+
if (result.standalone) {
|
|
3982
|
+
lines.push(formatStandaloneUpdateMessage(result.standalone));
|
|
3983
|
+
}
|
|
3984
|
+
return lines;
|
|
3985
|
+
};
|
|
3986
|
+
|
|
3958
3987
|
// src/bin/dvb-update.ts
|
|
3959
3988
|
var parseArgs = (args) => {
|
|
3960
3989
|
const parsed = { daemon: false, json: false };
|
|
@@ -3980,18 +4009,14 @@ void (async () => {
|
|
|
3980
4009
|
await runBackgroundUpdaterDaemon();
|
|
3981
4010
|
return;
|
|
3982
4011
|
}
|
|
3983
|
-
const result = await
|
|
4012
|
+
const result = await runForegroundUpdate();
|
|
3984
4013
|
if (parsed.json) {
|
|
3985
4014
|
console.log(JSON.stringify(result, null, 2));
|
|
3986
4015
|
return;
|
|
3987
4016
|
}
|
|
3988
|
-
|
|
3989
|
-
console.log(
|
|
3990
|
-
return;
|
|
4017
|
+
for (const line of formatForegroundUpdateMessages(result)) {
|
|
4018
|
+
console.log(line);
|
|
3991
4019
|
}
|
|
3992
|
-
console.log(
|
|
3993
|
-
`Updated dvb runtime ${result.previousVersion ?? "unknown"} -> ${result.currentVersion}.`
|
|
3994
|
-
);
|
|
3995
4020
|
})().catch((error) => {
|
|
3996
4021
|
const message = error instanceof Error ? error.message : String(error);
|
|
3997
4022
|
console.error(message);
|