@flowscripter/dynamic-cli-framework 8.0.0 → 9.0.0
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/src/runtime/values/subCommandValuePopulation.d.ts.map +1 -1
- package/dist/src/runtime/values/subCommandValuePopulation.js +2 -2
- package/dist/src/service/upgrade/DefaultUpgradeService.d.ts +2 -2
- package/dist/src/service/upgrade/DefaultUpgradeService.d.ts.map +1 -1
- package/dist/src/service/upgrade/DefaultUpgradeService.js +7 -8
- package/dist/src/service/upgrade/command/UpgradeSubCommand.d.ts.map +1 -1
- package/dist/src/service/upgrade/command/UpgradeSubCommand.js +5 -14
- package/package.json +2 -2
- package/src/runtime/values/subCommandValuePopulation.ts +2 -3
- package/src/service/upgrade/DefaultUpgradeService.ts +9 -18
- package/src/service/upgrade/command/UpgradeSubCommand.ts +4 -15
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subCommandValuePopulation.d.ts","sourceRoot":"","sources":["../../../../src/runtime/values/subCommandValuePopulation.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yCAAyC,CAAC;AAC1E,OAAO,EAIL,KAAK,eAAe,EAErB,MAAM,yCAAyC,CAAC;AAGjD,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"subCommandValuePopulation.d.ts","sourceRoot":"","sources":["../../../../src/runtime/values/subCommandValuePopulation.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yCAAyC,CAAC;AAC1E,OAAO,EAIL,KAAK,eAAe,EAErB,MAAM,yCAAyC,CAAC;AAGjD,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,4BAA4B,CAAC;AAsjBlF;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,wBAAwB,CAC9C,UAAU,EAAE,UAAU,EACtB,aAAa,EAAE,aAAa,CAAC,MAAM,CAAC,EACpC,aAAa,EAAE,eAAe,GAAG,SAAS,GACzC,+BAA+B,CAkEjC"}
|
|
@@ -131,6 +131,7 @@ class ParseContext {
|
|
|
131
131
|
const complexAndArrayPathElements = [];
|
|
132
132
|
let option = undefined;
|
|
133
133
|
let currentValue = this.populatedArgumentValues;
|
|
134
|
+
let lookupPath = this.subCommand.name;
|
|
134
135
|
for (let i = 0; i < complexPathElements.length; i++) {
|
|
135
136
|
let arrayIndexString;
|
|
136
137
|
let complexPathElement = complexPathElements[i];
|
|
@@ -140,7 +141,6 @@ class ParseContext {
|
|
|
140
141
|
.slice(0, complexPathElement.length - 1)
|
|
141
142
|
.split("[");
|
|
142
143
|
}
|
|
143
|
-
let lookupPath = this.subCommand.name;
|
|
144
144
|
// root option navigation
|
|
145
145
|
if (i === 0) {
|
|
146
146
|
if (complexPathElement.startsWith("--")) {
|
|
@@ -164,7 +164,7 @@ class ParseContext {
|
|
|
164
164
|
complexPathElement = option.name;
|
|
165
165
|
} // complex option property navigation
|
|
166
166
|
else {
|
|
167
|
-
lookupPath = `${lookupPath}
|
|
167
|
+
lookupPath = `${lookupPath}.${option.name}`;
|
|
168
168
|
// lazy creation of nested option paths to options
|
|
169
169
|
if (!this.optionLookupMapsByPath.has(lookupPath)) {
|
|
170
170
|
const properties = option.properties;
|
|
@@ -50,7 +50,7 @@ export default class DefaultUpgradeService implements UpgradeService {
|
|
|
50
50
|
detectOs(): SupportedOs | undefined;
|
|
51
51
|
detectArch(): SupportedArch | undefined;
|
|
52
52
|
detectInstallMethod(os: SupportedOs): Promise<InstallMethod | undefined>;
|
|
53
|
-
checkForUpgrade(
|
|
54
|
-
upgrade(
|
|
53
|
+
checkForUpgrade(installMethodOverride?: InstallMethod): Promise<UpgradeCheckResult>;
|
|
54
|
+
upgrade(installMethodOverride?: InstallMethod): Promise<UpgradeResult>;
|
|
55
55
|
}
|
|
56
56
|
//# sourceMappingURL=DefaultUpgradeService.d.ts.map
|
|
@@ -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KG;IACI,yBAAyB,CAAC,aAAa,EAAE,aAAa,GAAG,MAAM,GAAG,SAAS,CAUjF;IAoBD;;;;;;;OAOG;IACU,OAAO,CAClB,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,aAAa,CAAC,MAAM,CAAC,GAC1B,OAAO,CAAC,QAAQ,GAAG,SAAS,CAAC,CAY/B;IAEM,QAAQ,IAAI,WAAW,GAAG,SAAS,CAWzC;IAEM,UAAU,IAAI,aAAa,GAAG,SAAS,CAQ7C;IAEY,mBAAmB,CAAC,EAAE,EAAE,WAAW,GAAG,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC,CAoDpF;IA2CY,eAAe,CAAC,qBAAqB,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAsC/F;IAEY,OAAO,CAAC,qBAAqB,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC,CAiDlF;CA2TF"}
|
|
@@ -341,9 +341,9 @@ export default class DefaultUpgradeService {
|
|
|
341
341
|
await this.#safeKeyValueCall(() => keyValueService.set(INSTALL_METHOD_CACHE_KEY, { method, checkedAt: Date.now() }));
|
|
342
342
|
}
|
|
343
343
|
}
|
|
344
|
-
async checkForUpgrade(
|
|
345
|
-
const os =
|
|
346
|
-
const arch =
|
|
344
|
+
async checkForUpgrade(installMethodOverride) {
|
|
345
|
+
const os = this.detectOs();
|
|
346
|
+
const arch = this.detectArch();
|
|
347
347
|
if (!os || !arch || !this.#isPlatformSupported(os, arch)) {
|
|
348
348
|
return { status: "unsupported" };
|
|
349
349
|
}
|
|
@@ -374,17 +374,16 @@ export default class DefaultUpgradeService {
|
|
|
374
374
|
installMethod,
|
|
375
375
|
};
|
|
376
376
|
}
|
|
377
|
-
async upgrade(
|
|
377
|
+
async upgrade(installMethodOverride) {
|
|
378
378
|
const oldVersion = this.#cliConfig.version;
|
|
379
|
-
const
|
|
380
|
-
|
|
381
|
-
? await this.checkForUpgrade(osOverride, archOverride, installMethodOverride)
|
|
379
|
+
const checkResult = installMethodOverride !== undefined
|
|
380
|
+
? await this.checkForUpgrade(installMethodOverride)
|
|
382
381
|
: await this.getUpgradeCheckResult();
|
|
383
382
|
if (checkResult.status === "unsupported") {
|
|
384
383
|
return {
|
|
385
384
|
ok: false,
|
|
386
385
|
oldVersion,
|
|
387
|
-
error: new Error("No upgrade location configured for the detected
|
|
386
|
+
error: new Error("No upgrade location configured for the detected platform"),
|
|
388
387
|
};
|
|
389
388
|
}
|
|
390
389
|
if (checkResult.status === "failed") {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UpgradeSubCommand.d.ts","sourceRoot":"","sources":["../../../../../src/service/upgrade/command/UpgradeSubCommand.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yCAAyC,CAAC;AAC1E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yCAAyC,CAAC;AACtE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yCAAyC,CAAC;AACvE,OAAO,EAAE,KAAK,MAAM,EAAiB,MAAM,yCAAyC,CAAC;
|
|
1
|
+
{"version":3,"file":"UpgradeSubCommand.d.ts","sourceRoot":"","sources":["../../../../../src/service/upgrade/command/UpgradeSubCommand.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yCAAyC,CAAC;AAC1E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yCAAyC,CAAC;AACtE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yCAAyC,CAAC;AACvE,OAAO,EAAE,KAAK,MAAM,EAAiB,MAAM,yCAAyC,CAAC;AAUrF,qBAAa,iBAAkB,YAAW,UAAU;IAClD,QAAQ,CAAC,IAAI,aAAa;IAC1B,QAAQ,CAAC,WAAW,6CAA6C;IACjE,QAAQ,CAAC,mBAAmB,SAAS;IACrC,QAAQ,CAAC,WAAW,UAAM;IAE1B,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC,MAAM,CAAC,CAQrC;IAEW,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAqD5E;CACF"}
|
|
@@ -1,18 +1,11 @@
|
|
|
1
1
|
import { ValueTypeName } from "@flowscripter/dynamic-cli-framework-api";
|
|
2
|
-
import { Icon, InstallMethod, PRINTER_SERVICE_ID,
|
|
2
|
+
import { Icon, InstallMethod, PRINTER_SERVICE_ID, UPGRADE_SERVICE_ID, } from "@flowscripter/dynamic-cli-framework-api";
|
|
3
3
|
export class UpgradeSubCommand {
|
|
4
4
|
name = "upgrade";
|
|
5
5
|
description = "Upgrade to the latest available version";
|
|
6
6
|
enableConfiguration = false;
|
|
7
7
|
positionals = [];
|
|
8
8
|
options = [
|
|
9
|
-
{
|
|
10
|
-
name: "os",
|
|
11
|
-
type: ValueTypeName.STRING,
|
|
12
|
-
isOptional: true,
|
|
13
|
-
allowableValues: Object.values(SupportedOs),
|
|
14
|
-
description: "Override the detected operating system",
|
|
15
|
-
},
|
|
16
9
|
{
|
|
17
10
|
name: "install-method",
|
|
18
11
|
type: ValueTypeName.STRING,
|
|
@@ -26,16 +19,14 @@ export class UpgradeSubCommand {
|
|
|
26
19
|
const upgradeService = context.getServiceById(UPGRADE_SERVICE_ID);
|
|
27
20
|
const cliName = context.cliConfig.name;
|
|
28
21
|
const currentVersion = context.cliConfig.version;
|
|
29
|
-
const os = argumentValues.os;
|
|
30
|
-
const arch = undefined;
|
|
31
22
|
const installMethod = argumentValues["install-method"];
|
|
32
23
|
await printerService.showSpinner(`Looking for version newer than ${currentVersion}`);
|
|
33
|
-
const checkResult =
|
|
24
|
+
const checkResult = installMethod === undefined
|
|
34
25
|
? await upgradeService.refreshUpgradeCheckCache()
|
|
35
|
-
: await upgradeService.checkForUpgrade(
|
|
26
|
+
: await upgradeService.checkForUpgrade(installMethod);
|
|
36
27
|
await printerService.hideSpinner();
|
|
37
28
|
if (checkResult.status === "unsupported") {
|
|
38
|
-
await printerService.error(`No upgrade location is configured for the detected
|
|
29
|
+
await printerService.error(`No upgrade location is configured for the detected platform.\n`, Icon.FAILURE);
|
|
39
30
|
return;
|
|
40
31
|
}
|
|
41
32
|
if (checkResult.status === "failed") {
|
|
@@ -46,7 +37,7 @@ export class UpgradeSubCommand {
|
|
|
46
37
|
await printerService.print(`${cliName} is already up to date: ${checkResult.currentVersion}\n`, Icon.INFORMATION);
|
|
47
38
|
return;
|
|
48
39
|
}
|
|
49
|
-
const upgradeResult = await upgradeService.upgrade(
|
|
40
|
+
const upgradeResult = await upgradeService.upgrade(installMethod);
|
|
50
41
|
if (!upgradeResult.ok) {
|
|
51
42
|
await printerService.error(`Failed to upgrade ${cliName}: ${upgradeResult.error?.message ?? "unknown error"}\n`, Icon.FAILURE);
|
|
52
43
|
return;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flowscripter/dynamic-cli-framework",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "9.0.0",
|
|
4
4
|
"description": "A framework for developing CLI applications which supports dynamic discovery and installation of new commands",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"bun",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"build": "tsc -p tsconfig.build.json"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@flowscripter/dynamic-cli-framework-api": "^
|
|
52
|
+
"@flowscripter/dynamic-cli-framework-api": "^5.0.0",
|
|
53
53
|
"@flowscripter/dynamic-plugin-framework": "^2.2.16",
|
|
54
54
|
"emphasize": "^7.0.0",
|
|
55
55
|
"fastest-levenshtein": "^1.0.16",
|
|
@@ -168,6 +168,7 @@ class ParseContext {
|
|
|
168
168
|
| PopulatedValueType
|
|
169
169
|
| undefined = this.populatedArgumentValues;
|
|
170
170
|
|
|
171
|
+
let lookupPath = this.subCommand.name;
|
|
171
172
|
for (let i = 0; i < complexPathElements.length; i++) {
|
|
172
173
|
let arrayIndexString: string | undefined;
|
|
173
174
|
let complexPathElement = complexPathElements[i]!;
|
|
@@ -179,8 +180,6 @@ class ParseContext {
|
|
|
179
180
|
.split("[") as [string, string | undefined];
|
|
180
181
|
}
|
|
181
182
|
|
|
182
|
-
let lookupPath = this.subCommand.name;
|
|
183
|
-
|
|
184
183
|
// root option navigation
|
|
185
184
|
if (i === 0) {
|
|
186
185
|
if (complexPathElement.startsWith("--")) {
|
|
@@ -205,7 +204,7 @@ class ParseContext {
|
|
|
205
204
|
complexPathElement = option.name;
|
|
206
205
|
} // complex option property navigation
|
|
207
206
|
else {
|
|
208
|
-
lookupPath = `${lookupPath}
|
|
207
|
+
lookupPath = `${lookupPath}.${option!.name}`;
|
|
209
208
|
|
|
210
209
|
// lazy creation of nested option paths to options
|
|
211
210
|
if (!this.optionLookupMapsByPath.has(lookupPath)) {
|
|
@@ -436,13 +436,9 @@ export default class DefaultUpgradeService implements UpgradeService {
|
|
|
436
436
|
}
|
|
437
437
|
}
|
|
438
438
|
|
|
439
|
-
public async checkForUpgrade(
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
installMethodOverride?: InstallMethod,
|
|
443
|
-
): Promise<UpgradeCheckResult> {
|
|
444
|
-
const os = osOverride ?? this.detectOs();
|
|
445
|
-
const arch = archOverride ?? this.detectArch();
|
|
439
|
+
public async checkForUpgrade(installMethodOverride?: InstallMethod): Promise<UpgradeCheckResult> {
|
|
440
|
+
const os = this.detectOs();
|
|
441
|
+
const arch = this.detectArch();
|
|
446
442
|
if (!os || !arch || !this.#isPlatformSupported(os, arch)) {
|
|
447
443
|
return { status: "unsupported" };
|
|
448
444
|
}
|
|
@@ -480,22 +476,17 @@ export default class DefaultUpgradeService implements UpgradeService {
|
|
|
480
476
|
};
|
|
481
477
|
}
|
|
482
478
|
|
|
483
|
-
public async upgrade(
|
|
484
|
-
osOverride?: SupportedOs,
|
|
485
|
-
archOverride?: SupportedArch,
|
|
486
|
-
installMethodOverride?: InstallMethod,
|
|
487
|
-
): Promise<UpgradeResult> {
|
|
479
|
+
public async upgrade(installMethodOverride?: InstallMethod): Promise<UpgradeResult> {
|
|
488
480
|
const oldVersion = this.#cliConfig.version;
|
|
489
|
-
const
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
: await this.getUpgradeCheckResult();
|
|
481
|
+
const checkResult =
|
|
482
|
+
installMethodOverride !== undefined
|
|
483
|
+
? await this.checkForUpgrade(installMethodOverride)
|
|
484
|
+
: await this.getUpgradeCheckResult();
|
|
494
485
|
if (checkResult.status === "unsupported") {
|
|
495
486
|
return {
|
|
496
487
|
ok: false,
|
|
497
488
|
oldVersion,
|
|
498
|
-
error: new Error("No upgrade location configured for the detected
|
|
489
|
+
error: new Error("No upgrade location configured for the detected platform"),
|
|
499
490
|
};
|
|
500
491
|
}
|
|
501
492
|
if (checkResult.status === "failed") {
|
|
@@ -6,8 +6,6 @@ import {
|
|
|
6
6
|
Icon,
|
|
7
7
|
InstallMethod,
|
|
8
8
|
PRINTER_SERVICE_ID,
|
|
9
|
-
SupportedArch,
|
|
10
|
-
SupportedOs,
|
|
11
9
|
UPGRADE_SERVICE_ID,
|
|
12
10
|
} from "@flowscripter/dynamic-cli-framework-api";
|
|
13
11
|
import type { PrinterService } from "@flowscripter/dynamic-cli-framework-api";
|
|
@@ -20,13 +18,6 @@ export class UpgradeSubCommand implements SubCommand {
|
|
|
20
18
|
readonly positionals = [];
|
|
21
19
|
|
|
22
20
|
readonly options: ReadonlyArray<Option> = [
|
|
23
|
-
{
|
|
24
|
-
name: "os",
|
|
25
|
-
type: ValueTypeName.STRING,
|
|
26
|
-
isOptional: true,
|
|
27
|
-
allowableValues: Object.values(SupportedOs),
|
|
28
|
-
description: "Override the detected operating system",
|
|
29
|
-
},
|
|
30
21
|
{
|
|
31
22
|
name: "install-method",
|
|
32
23
|
type: ValueTypeName.STRING,
|
|
@@ -42,21 +33,19 @@ export class UpgradeSubCommand implements SubCommand {
|
|
|
42
33
|
const cliName = context.cliConfig.name;
|
|
43
34
|
const currentVersion = context.cliConfig.version;
|
|
44
35
|
|
|
45
|
-
const os = argumentValues.os as SupportedOs | undefined;
|
|
46
|
-
const arch = undefined as SupportedArch | undefined;
|
|
47
36
|
const installMethod = argumentValues["install-method"] as InstallMethod | undefined;
|
|
48
37
|
|
|
49
38
|
await printerService.showSpinner(`Looking for version newer than ${currentVersion}`);
|
|
50
39
|
|
|
51
40
|
const checkResult =
|
|
52
|
-
|
|
41
|
+
installMethod === undefined
|
|
53
42
|
? await upgradeService.refreshUpgradeCheckCache()
|
|
54
|
-
: await upgradeService.checkForUpgrade(
|
|
43
|
+
: await upgradeService.checkForUpgrade(installMethod);
|
|
55
44
|
|
|
56
45
|
await printerService.hideSpinner();
|
|
57
46
|
if (checkResult.status === "unsupported") {
|
|
58
47
|
await printerService.error(
|
|
59
|
-
`No upgrade location is configured for the detected
|
|
48
|
+
`No upgrade location is configured for the detected platform.\n`,
|
|
60
49
|
Icon.FAILURE,
|
|
61
50
|
);
|
|
62
51
|
return;
|
|
@@ -78,7 +67,7 @@ export class UpgradeSubCommand implements SubCommand {
|
|
|
78
67
|
return;
|
|
79
68
|
}
|
|
80
69
|
|
|
81
|
-
const upgradeResult = await upgradeService.upgrade(
|
|
70
|
+
const upgradeResult = await upgradeService.upgrade(installMethod);
|
|
82
71
|
if (!upgradeResult.ok) {
|
|
83
72
|
await printerService.error(
|
|
84
73
|
`Failed to upgrade ${cliName}: ${upgradeResult.error?.message ?? "unknown error"}\n`,
|