@mittwald/cli 1.4.0 → 1.4.2
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.
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ExecRenderBaseCommand } from "../../../lib/basecommands/ExecRenderBaseCommand.js";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { AppInstallationResult, AppInstaller } from "../../../lib/resources/app/Installer.js";
|
|
4
|
+
export declare const phpWorkerInstaller: AppInstaller<"site-title" | "entrypoint">;
|
|
5
|
+
export default class InstallPhpWorker extends ExecRenderBaseCommand<typeof InstallPhpWorker, AppInstallationResult> {
|
|
6
|
+
static description: string;
|
|
7
|
+
static flags: import("@oclif/core/interfaces").FlagInput<import("../../../lib/resources/app/flags.js").RelevantFlags<readonly ("entrypoint" | ("wait" | "wait-timeout" | "site-title"))[]>>;
|
|
8
|
+
protected exec(): Promise<{
|
|
9
|
+
appInstallationId: string;
|
|
10
|
+
}>;
|
|
11
|
+
protected render(result: AppInstallationResult): React.ReactNode;
|
|
12
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ExecRenderBaseCommand } from "../../../lib/basecommands/ExecRenderBaseCommand.js";
|
|
2
|
+
import { AppInstaller, } from "../../../lib/resources/app/Installer.js";
|
|
3
|
+
export const phpWorkerInstaller = new AppInstaller("fcac178a-e606-4460-a5fd-b3ad0ae7a3cc", "PHP worker", ["entrypoint", "site-title"]);
|
|
4
|
+
export default class InstallPhpWorker extends ExecRenderBaseCommand {
|
|
5
|
+
static description = phpWorkerInstaller.description;
|
|
6
|
+
static flags = phpWorkerInstaller.flags;
|
|
7
|
+
async exec() {
|
|
8
|
+
return phpWorkerInstaller.exec(this.apiClient, this.args, this.flags, this.config);
|
|
9
|
+
}
|
|
10
|
+
render(result) {
|
|
11
|
+
return phpWorkerInstaller.render(result, this.flags);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -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
|
}
|
|
@@ -8,5 +8,5 @@ export declare abstract class FlagSupportedSetup<TFlags extends FlagInput, TSett
|
|
|
8
8
|
protected constructor(flagsInput: TFlags, settings: TSettings);
|
|
9
9
|
getSetup(flags: InferredFlags<TFlags>): TSettings & TSetupObject;
|
|
10
10
|
protected abstract getFlagsOutput(flags: InferredFlags<TFlags>): TSetupObject;
|
|
11
|
-
static build: <
|
|
11
|
+
static build: <TFlags extends FlagInput, TSettings, TOutput>(flags: TFlags_1, defaultSettings: TSettings_1, buildFlagsOutput: (flags: InferredFlags<TFlags_1>, settings: TSettings_1) => TOutput) => Class<FlagSupportedSetup<TFlags_1, TSettings_1, TOutput>, [Partial<TSettings_1>] | []>;
|
|
12
12
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mittwald/cli",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.2",
|
|
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",
|