lianrouter 2.0.0 → 2.1.1
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 +17 -9
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -17,7 +17,7 @@ var package_default;
|
|
|
17
17
|
var init_package = __esm(() => {
|
|
18
18
|
package_default = {
|
|
19
19
|
name: "lianrouter",
|
|
20
|
-
version: "2.
|
|
20
|
+
version: "2.1.1",
|
|
21
21
|
description: "LianRouter launcher: install, run and control the gateway from one command",
|
|
22
22
|
type: "module",
|
|
23
23
|
bin: {
|
|
@@ -2605,8 +2605,14 @@ class GatewaySupervisor {
|
|
|
2605
2605
|
}
|
|
2606
2606
|
|
|
2607
2607
|
// cli/src/update-flow.ts
|
|
2608
|
+
init_version_file();
|
|
2609
|
+
async function resolveGatewayVersion(installRoot, launcherVersion) {
|
|
2610
|
+
const record = await readInstalledVersion(installRoot);
|
|
2611
|
+
return record?.version ?? launcherVersion;
|
|
2612
|
+
}
|
|
2608
2613
|
async function runUpdateSequence(deps) {
|
|
2609
|
-
const
|
|
2614
|
+
const gatewayVersion = await resolveGatewayVersion(deps.installRoot, deps.launcherVersion);
|
|
2615
|
+
const info = await deps.checkForUpdate({ currentVersion: gatewayVersion });
|
|
2610
2616
|
deps.publish({
|
|
2611
2617
|
current: info.current,
|
|
2612
2618
|
latest: info.latest,
|
|
@@ -2625,7 +2631,7 @@ async function runUpdateSequence(deps) {
|
|
|
2625
2631
|
try {
|
|
2626
2632
|
await deps.runUpdate({
|
|
2627
2633
|
installRoot: deps.installRoot,
|
|
2628
|
-
currentVersion:
|
|
2634
|
+
currentVersion: gatewayVersion,
|
|
2629
2635
|
onProgress: (progress) => {
|
|
2630
2636
|
deps.publishProgress({
|
|
2631
2637
|
phase: progress.phase,
|
|
@@ -3041,7 +3047,7 @@ async function openSession(supervisor, runtime, host) {
|
|
|
3041
3047
|
try {
|
|
3042
3048
|
const engine = await Promise.resolve().then(() => (init_engine(), {}));
|
|
3043
3049
|
await runUpdateSequence({
|
|
3044
|
-
|
|
3050
|
+
launcherVersion: CLI_VERSION,
|
|
3045
3051
|
installRoot: runtime.installRoot,
|
|
3046
3052
|
checkForUpdate: (options) => checkForUpdate(options),
|
|
3047
3053
|
runUpdate: (options) => runUpdate(options),
|
|
@@ -3107,7 +3113,7 @@ async function runInteractive(supervisor, options, runtime) {
|
|
|
3107
3113
|
if (options.headless) {
|
|
3108
3114
|
return await blockUntilTrayExit(supervisor, session, runtime);
|
|
3109
3115
|
}
|
|
3110
|
-
const update = await readUpdateInfo();
|
|
3116
|
+
const update = await readUpdateInfo(runtime.installRoot);
|
|
3111
3117
|
const action = await promptMenu({
|
|
3112
3118
|
version: CLI_VERSION,
|
|
3113
3119
|
port: supervisor.status.port,
|
|
@@ -3158,7 +3164,7 @@ async function runUpdateWithProgress(supervisor, session, runtime) {
|
|
|
3158
3164
|
session.control.setUpdateRunning(true);
|
|
3159
3165
|
try {
|
|
3160
3166
|
await runUpdateSequence({
|
|
3161
|
-
|
|
3167
|
+
launcherVersion: CLI_VERSION,
|
|
3162
3168
|
installRoot: runtime.installRoot,
|
|
3163
3169
|
checkForUpdate: (options) => checkForUpdate(options),
|
|
3164
3170
|
runUpdate: (options) => runUpdate(options),
|
|
@@ -3266,7 +3272,7 @@ async function runUpdateFlow(supervisor, runtime) {
|
|
|
3266
3272
|
const wasRunning = await supervisor.adoptExisting();
|
|
3267
3273
|
try {
|
|
3268
3274
|
await runUpdateSequence({
|
|
3269
|
-
|
|
3275
|
+
launcherVersion: CLI_VERSION,
|
|
3270
3276
|
installRoot: runtime.installRoot,
|
|
3271
3277
|
checkForUpdate: (options) => checkForUpdate(options),
|
|
3272
3278
|
runUpdate: (options) => runUpdate(options),
|
|
@@ -3294,10 +3300,12 @@ async function runUpdateFlow(supervisor, runtime) {
|
|
|
3294
3300
|
console.log("Update complete.");
|
|
3295
3301
|
return 0;
|
|
3296
3302
|
}
|
|
3297
|
-
async function readUpdateInfo() {
|
|
3303
|
+
async function readUpdateInfo(installRoot) {
|
|
3298
3304
|
try {
|
|
3299
3305
|
const engine = await Promise.resolve().then(() => (init_engine(), {}));
|
|
3300
|
-
const info = await checkForUpdate({
|
|
3306
|
+
const info = await checkForUpdate({
|
|
3307
|
+
currentVersion: await resolveGatewayVersion(installRoot, CLI_VERSION)
|
|
3308
|
+
});
|
|
3301
3309
|
return { current: info.current, latest: info.latest, available: info.available };
|
|
3302
3310
|
} catch {
|
|
3303
3311
|
return null;
|