@owox/ctl 0.37.0 → 0.39.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.
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { OWOXPluginCheckResult } from '@owox/api-client';
|
|
2
|
+
import { BaseCommand } from '../../base-command.js';
|
|
3
|
+
import { type PluginsClient } from '../../plugins-support.js';
|
|
4
|
+
export declare function checkPlugin(client: PluginsClient, repository: string, ref: string, version?: string): Promise<OWOXPluginCheckResult>;
|
|
5
|
+
/** One line per issue, then what a clean result means. Goes to stderr so stdout stays JSON. */
|
|
6
|
+
export declare function checkSummary(result: OWOXPluginCheckResult): string;
|
|
7
|
+
export default class PluginsCheck extends BaseCommand {
|
|
8
|
+
static description: string;
|
|
9
|
+
static args: {
|
|
10
|
+
repository: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
11
|
+
};
|
|
12
|
+
static flags: {
|
|
13
|
+
ref: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
14
|
+
version: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
15
|
+
'env-file': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
16
|
+
};
|
|
17
|
+
static examples: string[];
|
|
18
|
+
run(): Promise<void>;
|
|
19
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { Flags } from '@oclif/core';
|
|
2
|
+
import { BaseCommand } from '../../base-command.js';
|
|
3
|
+
import { installationHint, repositoryArg } from '../../plugins-support.js';
|
|
4
|
+
export function checkPlugin(client, repository, ref, version) {
|
|
5
|
+
return client.plugins.check({ repository, ref, ...(version !== undefined ? { version } : {}) });
|
|
6
|
+
}
|
|
7
|
+
/** One line per issue, then what a clean result means. Goes to stderr so stdout stays JSON. */
|
|
8
|
+
export function checkSummary(result) {
|
|
9
|
+
const lines = result.issues.map(issue => `${issue.code}: ${issue.detail}`);
|
|
10
|
+
if (lines.length === 0) {
|
|
11
|
+
const sha = result.commitSha?.slice(0, 7);
|
|
12
|
+
lines.push(result.candidateVersion
|
|
13
|
+
? `A release of version ${result.candidateVersion}${sha ? ` from ${sha}` : ''} would pass the checks.`
|
|
14
|
+
: `No issues found${sha ? ` in ${sha}` : ''}.`);
|
|
15
|
+
}
|
|
16
|
+
if (!result.collectionsEvaluated && result.commitSha) {
|
|
17
|
+
if (!result.candidateVersion) {
|
|
18
|
+
lines.push('Collection compatibility was not checked: the plugin has no current version and no --version was given.');
|
|
19
|
+
}
|
|
20
|
+
else if (result.baselineVersion === null) {
|
|
21
|
+
lines.push('Collection compatibility was not checked: no version is recorded in that compatibility line.');
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return lines.join('\n');
|
|
25
|
+
}
|
|
26
|
+
export default class PluginsCheck extends BaseCommand {
|
|
27
|
+
static description = 'Check whether a release from a branch, tag or commit would be accepted, without releasing anything';
|
|
28
|
+
static args = repositoryArg;
|
|
29
|
+
static flags = {
|
|
30
|
+
...BaseCommand.baseFlags,
|
|
31
|
+
ref: Flags.string({ description: 'Branch, tag or commit SHA to check', required: true }),
|
|
32
|
+
version: Flags.string({
|
|
33
|
+
description: 'Candidate SemVer; defaults to the next version after the current one',
|
|
34
|
+
}),
|
|
35
|
+
};
|
|
36
|
+
static examples = [
|
|
37
|
+
'<%= config.bin %> <%= command.id %> OWOX/example-plugin --ref main',
|
|
38
|
+
'<%= config.bin %> <%= command.id %> OWOX/example-plugin --ref 3f2a1bc --version 1.5.0',
|
|
39
|
+
];
|
|
40
|
+
async run() {
|
|
41
|
+
let result;
|
|
42
|
+
try {
|
|
43
|
+
const { args, flags } = await this.parse(PluginsCheck);
|
|
44
|
+
this.loadEnvironment(flags);
|
|
45
|
+
result = await checkPlugin(this.getAuthenticatedClient(), args.repository, flags.ref, flags.version);
|
|
46
|
+
process.stderr.write(`${checkSummary(result)}\n`);
|
|
47
|
+
this.writeJson(result);
|
|
48
|
+
}
|
|
49
|
+
catch (error) {
|
|
50
|
+
const hint = installationHint(error);
|
|
51
|
+
if (hint) {
|
|
52
|
+
process.stderr.write(`${hint}\n`);
|
|
53
|
+
}
|
|
54
|
+
this.handleCliError(error);
|
|
55
|
+
}
|
|
56
|
+
if (result.issues.length > 0)
|
|
57
|
+
this.exit(1);
|
|
58
|
+
}
|
|
59
|
+
}
|
package/oclif.manifest.json
CHANGED
|
@@ -182,6 +182,62 @@
|
|
|
182
182
|
"list.js"
|
|
183
183
|
]
|
|
184
184
|
},
|
|
185
|
+
"plugins:check": {
|
|
186
|
+
"aliases": [],
|
|
187
|
+
"args": {
|
|
188
|
+
"repository": {
|
|
189
|
+
"description": "GitHub repository, as a URL or owner/name",
|
|
190
|
+
"name": "repository",
|
|
191
|
+
"required": true
|
|
192
|
+
}
|
|
193
|
+
},
|
|
194
|
+
"description": "Check whether a release from a branch, tag or commit would be accepted, without releasing anything",
|
|
195
|
+
"examples": [
|
|
196
|
+
"<%= config.bin %> <%= command.id %> OWOX/example-plugin --ref main",
|
|
197
|
+
"<%= config.bin %> <%= command.id %> OWOX/example-plugin --ref 3f2a1bc --version 1.5.0"
|
|
198
|
+
],
|
|
199
|
+
"flags": {
|
|
200
|
+
"env-file": {
|
|
201
|
+
"char": "e",
|
|
202
|
+
"description": "Path to environment file to load variables from",
|
|
203
|
+
"name": "env-file",
|
|
204
|
+
"hasDynamicHelp": false,
|
|
205
|
+
"helpValue": "/path/to/.env",
|
|
206
|
+
"multiple": false,
|
|
207
|
+
"type": "option"
|
|
208
|
+
},
|
|
209
|
+
"ref": {
|
|
210
|
+
"description": "Branch, tag or commit SHA to check",
|
|
211
|
+
"name": "ref",
|
|
212
|
+
"required": true,
|
|
213
|
+
"hasDynamicHelp": false,
|
|
214
|
+
"multiple": false,
|
|
215
|
+
"type": "option"
|
|
216
|
+
},
|
|
217
|
+
"version": {
|
|
218
|
+
"description": "Candidate SemVer; defaults to the next version after the current one",
|
|
219
|
+
"name": "version",
|
|
220
|
+
"hasDynamicHelp": false,
|
|
221
|
+
"multiple": false,
|
|
222
|
+
"type": "option"
|
|
223
|
+
}
|
|
224
|
+
},
|
|
225
|
+
"hasDynamicHelp": false,
|
|
226
|
+
"hiddenAliases": [],
|
|
227
|
+
"id": "plugins:check",
|
|
228
|
+
"pluginAlias": "@owox/ctl",
|
|
229
|
+
"pluginName": "@owox/ctl",
|
|
230
|
+
"pluginType": "core",
|
|
231
|
+
"strict": true,
|
|
232
|
+
"enableJsonFlag": false,
|
|
233
|
+
"isESM": true,
|
|
234
|
+
"relativePath": [
|
|
235
|
+
"dist",
|
|
236
|
+
"commands",
|
|
237
|
+
"plugins",
|
|
238
|
+
"check.js"
|
|
239
|
+
]
|
|
240
|
+
},
|
|
185
241
|
"plugins:publish": {
|
|
186
242
|
"aliases": [],
|
|
187
243
|
"args": {
|
|
@@ -531,5 +587,5 @@
|
|
|
531
587
|
]
|
|
532
588
|
}
|
|
533
589
|
},
|
|
534
|
-
"version": "0.
|
|
590
|
+
"version": "0.39.0"
|
|
535
591
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@owox/ctl",
|
|
3
3
|
"description": "OWOX Data Marts Control CLI",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.39.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "OWOX",
|
|
7
7
|
"license": "ELv2",
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"@oclif/core": "^4",
|
|
17
17
|
"@oclif/plugin-help": "^6",
|
|
18
|
-
"@owox/api-client": "0.
|
|
19
|
-
"@owox/internal-helpers": "0.
|
|
18
|
+
"@owox/api-client": "0.39.0",
|
|
19
|
+
"@owox/internal-helpers": "0.39.0",
|
|
20
20
|
"undici": "^6.26.0"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|