@mittwald/cli 1.4.0 → 1.4.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.
|
@@ -54,18 +54,20 @@ export default class Update extends ExecRenderBaseCommand {
|
|
|
54
54
|
if (!systemSoftware) {
|
|
55
55
|
throw new Error(`unknown system software ${software}`);
|
|
56
56
|
}
|
|
57
|
-
const versions = await this.getVersions(process, systemSoftware);
|
|
57
|
+
const versions = await this.getVersions(process, systemSoftware, versionSpec);
|
|
58
58
|
const version = await process.runStep(`determining version for ${software}`, async () => {
|
|
59
59
|
const exactMatch = versions.find((v) => v.externalVersion === versionSpec);
|
|
60
60
|
if (exactMatch) {
|
|
61
61
|
return exactMatch;
|
|
62
62
|
}
|
|
63
|
-
const
|
|
64
|
-
if (
|
|
65
|
-
|
|
66
|
-
throw new Error(`unknown version ${versionSpec} for ${software}; available versions are: ${available}`);
|
|
63
|
+
const recommendedVersion = versions.find((v) => v.recommended);
|
|
64
|
+
if (recommendedVersion) {
|
|
65
|
+
return recommendedVersion;
|
|
67
66
|
}
|
|
68
|
-
|
|
67
|
+
if (versions.length === 0) {
|
|
68
|
+
throw new Error(`no versions found for ${software} and version constraint ${versionSpec}`);
|
|
69
|
+
}
|
|
70
|
+
return versions[versions.length - 1];
|
|
69
71
|
});
|
|
70
72
|
process.addInfo(_jsxs(Text, { children: ["selected ", _jsx(Value, { children: systemSoftware.name }), " version:", " ", _jsx(Value, { children: version.externalVersion })] }));
|
|
71
73
|
versionsToUpdate[systemSoftware.id] = {
|
|
@@ -84,10 +86,13 @@ export default class Update extends ExecRenderBaseCommand {
|
|
|
84
86
|
});
|
|
85
87
|
process.complete(_jsx(Success, { children: "The dependencies of this app were successfully updated!" }));
|
|
86
88
|
}
|
|
87
|
-
async getVersions(p, systemSoftware) {
|
|
89
|
+
async getVersions(p, systemSoftware, versionRange) {
|
|
88
90
|
const versions = await p.runStep(`fetching versions for ${systemSoftware.name}`, async () => {
|
|
89
91
|
const r = await this.apiClient.app.listSystemsoftwareversions({
|
|
90
92
|
systemSoftwareId: systemSoftware.id,
|
|
93
|
+
queryParameters: {
|
|
94
|
+
versionRange,
|
|
95
|
+
},
|
|
91
96
|
});
|
|
92
97
|
assertStatus(r, 200);
|
|
93
98
|
return r.data;
|
|
@@ -5,12 +5,12 @@ import { validate as validateUuid } from "uuid";
|
|
|
5
5
|
import { articleForWord } from "../util/language/articleForWord.js";
|
|
6
6
|
export class MissingFlagError extends Error {
|
|
7
7
|
constructor(name, flagName) {
|
|
8
|
-
super(`No ${name} ID given. Please specify one with --${flagName} or set a default ${name} with '
|
|
8
|
+
super(`No ${name} ID given. Please specify one with --${flagName} or set a default ${name} with 'mw context set --${flagName} <${flagName}>'`);
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
11
|
export class MissingArgError extends Error {
|
|
12
12
|
constructor(name, flagName) {
|
|
13
|
-
super(`No ${name} ID given. Please specify one as positional argument or set a default ${name} with '
|
|
13
|
+
super(`No ${name} ID given. Please specify one as positional argument or set a default ${name} with 'mw context set --${flagName} <${flagName}>'`);
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
export function makeMissingContextInputError(commandType, name, flagName, contextSupport = true) {
|
|
@@ -27,7 +27,7 @@ export function makeMissingContextInputError(commandType, name, flagName, contex
|
|
|
27
27
|
return new MissingArgError(name, flagName);
|
|
28
28
|
}
|
|
29
29
|
if (contextSupport) {
|
|
30
|
-
return new Error(`No ${name} ID given. Please consult the --help page of this command or set a default ${name} with '
|
|
30
|
+
return new Error(`No ${name} ID given. Please consult the --help page of this command or set a default ${name} with 'mw context set --${flagName} <${flagName}>'`);
|
|
31
31
|
}
|
|
32
32
|
return new Error(`No ${name} ID given. Please consult the --help page of this command.`);
|
|
33
33
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mittwald/cli",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.1",
|
|
4
4
|
"description": "Hand-crafted CLI for the mittwald API",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
"eslint-config-prettier": "^10.0.1",
|
|
90
90
|
"eslint-plugin-json": "^4.0.0",
|
|
91
91
|
"eslint-plugin-prettier": "^5.1.3",
|
|
92
|
-
"globals": "^
|
|
92
|
+
"globals": "^16.0.0",
|
|
93
93
|
"jest": "^29.7.0",
|
|
94
94
|
"license-checker-rseidelsohn": "^4.2.6",
|
|
95
95
|
"nock": "^14.0.0",
|