@flowscripter/dynamic-cli-framework 8.0.1 → 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.
@@ -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(osOverride?: SupportedOs, archOverride?: SupportedArch, installMethodOverride?: InstallMethod): Promise<UpgradeCheckResult>;
54
- upgrade(osOverride?: SupportedOs, archOverride?: SupportedArch, installMethodOverride?: InstallMethod): Promise<UpgradeResult>;
53
+ checkForUpgrade(installMethodOverride?: InstallMethod): Promise<UpgradeCheckResult>;
54
+ upgrade(installMethodOverride?: InstallMethod): Promise<UpgradeResult>;
55
55
  }
56
56
  //# sourceMappingURL=DefaultUpgradeService.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DefaultUpgradeService.d.ts","sourceRoot":"","sources":["../../../../src/service/upgrade/DefaultUpgradeService.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,SAAS,EACT,OAAO,EAKP,WAAW,EAEX,kBAAkB,EAClB,aAAa,EAEd,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAEL,aAAa,EAGb,QAAQ,EAER,aAAa,EACb,WAAW,EACX,KAAK,cAAc,EACpB,MAAM,yCAAyC,CAAC;AAEjD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAwC1E,eAAO,MAAM,uBAAuB,yBAAyB,CAAC;AAY9D,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,kBAAkB,GAAG,MAAM,CAI7E;AAaD;;;;;;;;;GASG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,WAAW,GAAG,QAAQ,GAAG,SAAS,CAiBpE;AAQD,MAAM,CAAC,OAAO,OAAO,qBAAsB,YAAW,cAAc;;IAKl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a,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(osOverride, archOverride, installMethodOverride) {
345
- const os = osOverride ?? this.detectOs();
346
- const arch = archOverride ?? this.detectArch();
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(osOverride, archOverride, installMethodOverride) {
377
+ async upgrade(installMethodOverride) {
378
378
  const oldVersion = this.#cliConfig.version;
379
- const hasOverride = osOverride !== undefined || archOverride !== undefined || installMethodOverride !== undefined;
380
- const checkResult = hasOverride
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 or requested platform"),
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,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
1
  import { ValueTypeName } from "@flowscripter/dynamic-cli-framework-api";
2
- import { Icon, InstallMethod, PRINTER_SERVICE_ID, SupportedArch, SupportedOs, UPGRADE_SERVICE_ID, } from "@flowscripter/dynamic-cli-framework-api";
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 = os === undefined && installMethod === undefined
24
+ const checkResult = installMethod === undefined
34
25
  ? await upgradeService.refreshUpgradeCheckCache()
35
- : await upgradeService.checkForUpgrade(os, arch, installMethod);
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 or requested platform.\n`, Icon.FAILURE);
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(os, arch, installMethod);
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": "8.0.1",
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": "^4.2.2",
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",
@@ -436,13 +436,9 @@ export default class DefaultUpgradeService implements UpgradeService {
436
436
  }
437
437
  }
438
438
 
439
- public async checkForUpgrade(
440
- osOverride?: SupportedOs,
441
- archOverride?: SupportedArch,
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 hasOverride =
490
- osOverride !== undefined || archOverride !== undefined || installMethodOverride !== undefined;
491
- const checkResult = hasOverride
492
- ? await this.checkForUpgrade(osOverride, archOverride, installMethodOverride)
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 or requested platform"),
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
- os === undefined && installMethod === undefined
41
+ installMethod === undefined
53
42
  ? await upgradeService.refreshUpgradeCheckCache()
54
- : await upgradeService.checkForUpgrade(os, arch, installMethod);
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 or requested platform.\n`,
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(os, arch, installMethod);
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`,