trm-client 9.4.0 → 10.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/changelog.txt +12 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +78 -0
- package/dist/command/AbstractCommand.d.ts +9 -4
- package/dist/command/AbstractCommand.js +82 -34
- package/dist/command/implementations/Alias.d.ts +2 -1
- package/dist/command/implementations/Alias.js +44 -13
- package/dist/command/implementations/Cg3y.d.ts +2 -1
- package/dist/command/implementations/Cg3y.js +18 -7
- package/dist/command/implementations/Cg3z.d.ts +2 -1
- package/dist/command/implementations/Cg3z.js +18 -7
- package/dist/command/implementations/ClearCache.d.ts +2 -1
- package/dist/command/implementations/ClearCache.js +11 -3
- package/dist/command/implementations/Compare.d.ts +2 -1
- package/dist/command/implementations/Compare.js +20 -7
- package/dist/command/implementations/Content.d.ts +2 -1
- package/dist/command/implementations/Content.js +21 -9
- package/dist/command/implementations/Deprecate.d.ts +2 -1
- package/dist/command/implementations/Deprecate.js +19 -7
- package/dist/command/implementations/Dirty.d.ts +2 -1
- package/dist/command/implementations/Dirty.js +21 -8
- package/dist/command/implementations/DistTag.d.ts +2 -1
- package/dist/command/implementations/DistTag.js +38 -14
- package/dist/command/implementations/FindDependencies.d.ts +2 -1
- package/dist/command/implementations/FindDependencies.js +20 -8
- package/dist/command/implementations/Info.d.ts +2 -1
- package/dist/command/implementations/Info.js +16 -6
- package/dist/command/implementations/Install.d.ts +4 -1
- package/dist/command/implementations/Install.js +118 -43
- package/dist/command/implementations/List.d.ts +2 -1
- package/dist/command/implementations/List.js +19 -6
- package/dist/command/implementations/Lock.d.ts +2 -1
- package/dist/command/implementations/Lock.js +21 -8
- package/dist/command/implementations/Login.d.ts +2 -1
- package/dist/command/implementations/Login.js +26 -8
- package/dist/command/implementations/Logout.d.ts +2 -1
- package/dist/command/implementations/Logout.js +17 -7
- package/dist/command/implementations/Ping.d.ts +2 -1
- package/dist/command/implementations/Ping.js +15 -5
- package/dist/command/implementations/Publish.d.ts +3 -1
- package/dist/command/implementations/Publish.js +70 -40
- package/dist/command/implementations/Registry.d.ts +2 -1
- package/dist/command/implementations/Registry.js +39 -12
- package/dist/command/implementations/Settings.d.ts +2 -1
- package/dist/command/implementations/Settings.js +18 -6
- package/dist/command/implementations/Unpublish.d.ts +2 -1
- package/dist/command/implementations/Unpublish.js +17 -6
- package/dist/command/implementations/View.d.ts +2 -1
- package/dist/command/implementations/View.js +22 -11
- package/dist/command/implementations/WhoAmI.d.ts +2 -1
- package/dist/command/implementations/WhoAmI.js +17 -7
- package/dist/command/implementations/index.d.ts +27 -0
- package/dist/command/implementations/index.js +65 -0
- package/dist/command/index.d.ts +2 -0
- package/dist/command/index.js +2 -0
- package/dist/command/metadata/CommandMetadata.d.ts +55 -0
- package/dist/command/metadata/CommandMetadata.js +2 -0
- package/dist/command/metadata/applyCommandMetadata.d.ts +3 -0
- package/dist/command/metadata/applyCommandMetadata.js +26 -0
- package/dist/command/metadata/helpers.d.ts +5 -0
- package/dist/command/metadata/helpers.js +42 -0
- package/dist/command/metadata/index.d.ts +3 -0
- package/dist/command/metadata/index.js +19 -0
- package/dist/command/runCommandHandler.d.ts +2 -0
- package/dist/command/runCommandHandler.js +24 -0
- package/dist/index.d.ts +6 -2
- package/dist/index.js +19 -75
- package/dist/utils/GlobalContext.d.ts +3 -1
- package/dist/utils/GlobalContext.js +28 -20
- package/dist/utils/SettingsData.d.ts +4 -0
- package/package.json +5 -6
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { AbstractCommand } from "../AbstractCommand";
|
|
2
|
+
import { CommandMetadata } from "../metadata/CommandMetadata";
|
|
2
3
|
export declare class Ping extends AbstractCommand {
|
|
3
|
-
|
|
4
|
+
static readonly metadata: CommandMetadata;
|
|
4
5
|
protected handler(): Promise<void>;
|
|
5
6
|
}
|
|
@@ -14,11 +14,6 @@ const trm_commons_1 = require("trm-commons");
|
|
|
14
14
|
const trm_core_1 = require("trm-core");
|
|
15
15
|
const AbstractCommand_1 = require("../AbstractCommand");
|
|
16
16
|
class Ping extends AbstractCommand_1.AbstractCommand {
|
|
17
|
-
init() {
|
|
18
|
-
this.registerOpts.requiresConnection = true;
|
|
19
|
-
this.registerOpts.requiresTrmDependencies = true;
|
|
20
|
-
this.command.description(`Ping trm-server (Used for testing purposes).`);
|
|
21
|
-
}
|
|
22
17
|
handler() {
|
|
23
18
|
return __awaiter(this, void 0, void 0, function* () {
|
|
24
19
|
trm_commons_1.Logger.loading(`Pinging trm-server on ${trm_core_1.SystemConnector.getDest()}...`);
|
|
@@ -28,3 +23,18 @@ class Ping extends AbstractCommand_1.AbstractCommand {
|
|
|
28
23
|
}
|
|
29
24
|
}
|
|
30
25
|
exports.Ping = Ping;
|
|
26
|
+
Ping.metadata = {
|
|
27
|
+
id: "ping",
|
|
28
|
+
command: "ping",
|
|
29
|
+
title: "Ping server",
|
|
30
|
+
group: "registry",
|
|
31
|
+
guiRelevant: false,
|
|
32
|
+
description: "Ping the TRM server used by the connected system.",
|
|
33
|
+
icon: "Radar",
|
|
34
|
+
arguments: [],
|
|
35
|
+
options: [],
|
|
36
|
+
requirements: {
|
|
37
|
+
requiresConnection: true,
|
|
38
|
+
requiresTrmDependencies: true
|
|
39
|
+
}
|
|
40
|
+
};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { AbstractCommand } from "../AbstractCommand";
|
|
2
|
+
import { CommandMetadata } from "../metadata/CommandMetadata";
|
|
2
3
|
export declare class Publish extends AbstractCommand {
|
|
3
|
-
|
|
4
|
+
private static readonly releaseOptions;
|
|
5
|
+
static readonly metadata: CommandMetadata[];
|
|
4
6
|
private validateVersion;
|
|
5
7
|
protected handler(): Promise<void>;
|
|
6
8
|
}
|
|
@@ -20,47 +20,8 @@ const utils_1 = require("../../utils");
|
|
|
20
20
|
const semver_1 = require("semver");
|
|
21
21
|
const path_1 = require("path");
|
|
22
22
|
const sanitize_filename_1 = __importDefault(require("sanitize-filename"));
|
|
23
|
+
const helpers_1 = require("../metadata/helpers");
|
|
23
24
|
class Publish extends AbstractCommand_1.AbstractCommand {
|
|
24
|
-
init() {
|
|
25
|
-
this.registerOpts.requiresConnection = true;
|
|
26
|
-
this.registerOpts.requiresTrmDependencies = true;
|
|
27
|
-
if (this.name === 'pack') {
|
|
28
|
-
this.command.description(`Export a package to local file.`);
|
|
29
|
-
this.command.argument(`<package>`, `Name of the package`);
|
|
30
|
-
this.command.argument(`<version>`, `Version of the release`);
|
|
31
|
-
this.command.argument(`[filename]`, `Name (or path) of the output file.`);
|
|
32
|
-
}
|
|
33
|
-
else {
|
|
34
|
-
this.registerOpts.requiresRegistry = true;
|
|
35
|
-
this.command.description(`Publish a package to a registry.`);
|
|
36
|
-
this.command.argument(`<package>`, `Name of the package.`);
|
|
37
|
-
this.command.argument(`[version]`, `Optional: Version of the release to publish.`);
|
|
38
|
-
this.command.option(`-i, --increment <increment>`, `Semantic versioning increment (used when no version is specified)`, `patch`);
|
|
39
|
-
this.command.option(`--pre-release`, `Publish as pre release`, false);
|
|
40
|
-
this.command.option(`--pre-release-identifier <identifier>`, `Identifier (needs to pre a pre release)`);
|
|
41
|
-
this.command.option(`--tag <tag>`, `Release tag(s) (separated by comma)`);
|
|
42
|
-
this.command.option(`--private`, `Package marked as private. Depending on the registry, visibility might not be changed after first publish.`);
|
|
43
|
-
this.command.option(`--readme <readme>`, `Release readme (markdown or path to markdown file)`);
|
|
44
|
-
this.command.option(`--no-keep-manifest`, `Don't default to previous release manifest values.`);
|
|
45
|
-
}
|
|
46
|
-
this.command.option(`-P, --sap-package <sap package>`, `SAP Package.`);
|
|
47
|
-
this.command.option(`-T, --target <target>`, `Transport release target.`);
|
|
48
|
-
this.command.option(`--no-lang-tr`, `Do not generate language (translation) transport.`);
|
|
49
|
-
this.command.option(`--no-cust-tr`, `Do not generate customizing transport.`);
|
|
50
|
-
this.command.option(`--cust <customizing>`, `Customizing transport(s) (separated by comma).`);
|
|
51
|
-
this.command.option(`--no-auto-deps`, `Do not look for dependencies.`);
|
|
52
|
-
this.command.option(`--authors <authors>`, `Release author(s) (separated by comma)`);
|
|
53
|
-
this.command.option(`--backwards-compatible`, `Backwards-compatible release (reserved for future use)`);
|
|
54
|
-
this.command.option(`--description <description>`, `Release description`);
|
|
55
|
-
this.command.option(`--git <git url>`, `Release git URL`);
|
|
56
|
-
this.command.option(`--keywords <keywords>`, `Release keyword(s) (separated by comma)`);
|
|
57
|
-
this.command.option(`--license <license>`, `Release license`);
|
|
58
|
-
this.command.option(`--website <website url>`, `Release website URL`);
|
|
59
|
-
this.command.option(`--dependencies <dependencies>`, `Release dependencies (JSON or path to JSON file)`);
|
|
60
|
-
this.command.option(`--sap-entries <sap entries>`, `Release SAP entries (JSON or path to JSON file)`);
|
|
61
|
-
this.command.option(`--post-activities <post activities>`, `Release post activities (JSON or path to JSON file)`);
|
|
62
|
-
this.command.option(`--no-prompts`, `No prompts (will force some decisions).`);
|
|
63
|
-
}
|
|
64
25
|
validateVersion(v) {
|
|
65
26
|
if ((0, semver_1.valid)(v)) {
|
|
66
27
|
return true;
|
|
@@ -154,3 +115,72 @@ class Publish extends AbstractCommand_1.AbstractCommand {
|
|
|
154
115
|
}
|
|
155
116
|
}
|
|
156
117
|
exports.Publish = Publish;
|
|
118
|
+
Publish.releaseOptions = [
|
|
119
|
+
(0, helpers_1.option)("-P, --sap-package <sap package>", { name: "sapPackage", label: "SAP package", description: "SAP package that owns the release objects." }),
|
|
120
|
+
(0, helpers_1.option)("-T, --target <target>", { name: "target", label: "Transport target", description: "Target system for release transports." }),
|
|
121
|
+
(0, helpers_1.option)("--no-lang-tr", { name: "langTr", label: "Language transport", description: "Skip language transport generation.", control: "checkbox", defaultValue: true }),
|
|
122
|
+
(0, helpers_1.option)("--no-cust-tr", { name: "custTr", label: "Customizing transport", description: "Skip customizing transport generation.", control: "checkbox", defaultValue: true }),
|
|
123
|
+
(0, helpers_1.option)("--cust <customizing>", { name: "cust", label: "Customizing transports", description: "Customizing transport requests, separated by commas.", multiple: true }),
|
|
124
|
+
(0, helpers_1.option)("--no-auto-deps", { name: "autoDeps", label: "Automatic dependencies", description: "Skip automatic dependency detection.", control: "checkbox", defaultValue: true }),
|
|
125
|
+
(0, helpers_1.option)("--authors <authors>", { name: "authors", label: "Authors", description: "Release authors, separated by commas.", multiple: true }),
|
|
126
|
+
(0, helpers_1.option)("--backwards-compatible", { name: "backwardsCompatible", label: "Backwards compatible", description: "Mark the release as backwards compatible.", control: "checkbox" }),
|
|
127
|
+
(0, helpers_1.option)("--description <description>", { name: "description", label: "Description", description: "Release description." }),
|
|
128
|
+
(0, helpers_1.option)("--git <git url>", { name: "git", label: "Git URL", description: "Release Git repository URL." }),
|
|
129
|
+
(0, helpers_1.option)("--keywords <keywords>", { name: "keywords", label: "Keywords", description: "Release keywords, separated by commas.", multiple: true }),
|
|
130
|
+
(0, helpers_1.option)("--license <license>", { name: "license", label: "License", description: "Release license." }),
|
|
131
|
+
(0, helpers_1.option)("--website <website url>", { name: "website", label: "Website", description: "Release website URL." }),
|
|
132
|
+
(0, helpers_1.option)("--dependencies <dependencies>", { name: "dependencies", label: "Dependencies", description: "Release dependencies as JSON, or a path to a JSON file.", control: "textarea" }),
|
|
133
|
+
(0, helpers_1.option)("--sap-entries <sap entries>", { name: "sapEntries", label: "SAP entries", description: "Release SAP entries as JSON, or a path to a JSON file.", control: "textarea" }),
|
|
134
|
+
(0, helpers_1.option)("--post-activities <post activities>", { name: "postActivities", label: "Post activities", description: "Release post activities as JSON, or a path to a JSON file.", control: "textarea" }),
|
|
135
|
+
(0, helpers_1.option)("--no-prompts", { name: "prompts", label: "Prompts", description: "Disable prompts and use automatic decisions.", control: "checkbox", defaultValue: true, guiRelevant: false })
|
|
136
|
+
];
|
|
137
|
+
Publish.metadata = [
|
|
138
|
+
{
|
|
139
|
+
id: "publish",
|
|
140
|
+
command: "publish",
|
|
141
|
+
title: "Publish package",
|
|
142
|
+
group: "package",
|
|
143
|
+
groupPriority: 9,
|
|
144
|
+
description: "Publish a package release to the registry.",
|
|
145
|
+
icon: "PackagePlus",
|
|
146
|
+
arguments: [
|
|
147
|
+
(0, helpers_1.argument)(0, { name: "package", label: "Package", description: "Package name." }),
|
|
148
|
+
(0, helpers_1.argument)(1, { name: "version", label: "Version", description: "Release version to publish.", required: false })
|
|
149
|
+
],
|
|
150
|
+
options: [
|
|
151
|
+
(0, helpers_1.option)("-i, --increment <increment>", { name: "increment", label: "Version increment", description: "Semantic version increment to use when no version is provided.", control: "select", defaultValue: "patch" }),
|
|
152
|
+
(0, helpers_1.option)("--pre-release", { name: "preRelease", label: "Pre-release", description: "Publish the release as a pre-release.", control: "checkbox", defaultValue: false }),
|
|
153
|
+
(0, helpers_1.option)("--pre-release-identifier <identifier>", { name: "preReleaseIdentifier", label: "Pre-release identifier", description: "Identifier to append to a pre-release version." }),
|
|
154
|
+
(0, helpers_1.option)("--tag <tag>", { name: "tag", label: "Tags", description: "Release distribution tags, separated by commas.", multiple: true }),
|
|
155
|
+
(0, helpers_1.option)("--private", { name: "private", label: "Private", description: "Mark the package as private. Registry visibility may not be changeable after the first publish.", control: "checkbox" }),
|
|
156
|
+
(0, helpers_1.option)("--readme <readme>", { name: "readme", label: "Readme", description: "Release readme as Markdown, or a path to a Markdown file.", control: "textarea" }),
|
|
157
|
+
(0, helpers_1.option)("--no-keep-manifest", { name: "keepManifest", label: "Reuse manifest", description: "Do not reuse values from the previous release manifest.", control: "checkbox", defaultValue: true }),
|
|
158
|
+
...Publish.releaseOptions
|
|
159
|
+
],
|
|
160
|
+
requirements: {
|
|
161
|
+
requiresConnection: true,
|
|
162
|
+
requiresTrmDependencies: true,
|
|
163
|
+
requiresRegistry: true
|
|
164
|
+
}
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
id: "pack",
|
|
168
|
+
command: "pack",
|
|
169
|
+
aliases: ["export"],
|
|
170
|
+
title: "Export package",
|
|
171
|
+
group: "package",
|
|
172
|
+
groupPriority: 7,
|
|
173
|
+
description: "Export a package release to a local file.",
|
|
174
|
+
icon: "PackageOpen",
|
|
175
|
+
arguments: [
|
|
176
|
+
(0, helpers_1.argument)(0, { name: "package", label: "Package", description: "Package name." }),
|
|
177
|
+
(0, helpers_1.argument)(1, { name: "version", label: "Version", description: "Release version." }),
|
|
178
|
+
(0, helpers_1.argument)(2, { name: "filename", label: "Output file", description: "Output file name or path.", required: false, control: "file-picker" })
|
|
179
|
+
],
|
|
180
|
+
options: Publish.releaseOptions,
|
|
181
|
+
requirements: {
|
|
182
|
+
requiresConnection: true,
|
|
183
|
+
requiresTrmDependencies: true
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
];
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { AbstractCommand } from "../AbstractCommand";
|
|
2
|
+
import { CommandMetadata } from "../metadata/CommandMetadata";
|
|
2
3
|
export declare class Registry extends AbstractCommand {
|
|
3
|
-
|
|
4
|
+
static readonly metadata: CommandMetadata[];
|
|
4
5
|
protected handler(): Promise<void>;
|
|
5
6
|
}
|
|
@@ -14,19 +14,8 @@ const trm_core_1 = require("trm-core");
|
|
|
14
14
|
const AbstractCommand_1 = require("../AbstractCommand");
|
|
15
15
|
const trm_commons_1 = require("trm-commons");
|
|
16
16
|
const registryAlias_1 = require("../../registryAlias");
|
|
17
|
+
const helpers_1 = require("../metadata/helpers");
|
|
17
18
|
class Registry extends AbstractCommand_1.AbstractCommand {
|
|
18
|
-
init() {
|
|
19
|
-
this.registerOpts.requiresRegistry = true;
|
|
20
|
-
if (this.subcommand === 'add') {
|
|
21
|
-
this.command.description(`Add a new registry.`);
|
|
22
|
-
this.command.argument(`<registry name>`, `Name of the registry to generate. Name "${trm_core_1.PUBLIC_RESERVED_KEYWORD}" and "${trm_core_1.LOCAL_RESERVED_KEYWORD}" are protected and cannot be used.`);
|
|
23
|
-
}
|
|
24
|
-
else if (this.subcommand === 'rm') {
|
|
25
|
-
this.command.description(`Remove a registry.`);
|
|
26
|
-
this.command.argument(`<registry name>`, `Name of the registry to delete. Registries "${trm_core_1.PUBLIC_RESERVED_KEYWORD}" and "${trm_core_1.LOCAL_RESERVED_KEYWORD}" are protected and cannot be deleted.`);
|
|
27
|
-
}
|
|
28
|
-
this.command.option(`-E, --registry-endpoint <endpoint>`, `Registry endpoint.`);
|
|
29
|
-
}
|
|
30
19
|
handler() {
|
|
31
20
|
return __awaiter(this, void 0, void 0, function* () {
|
|
32
21
|
const registryName = this.args.registryName.trim();
|
|
@@ -83,3 +72,41 @@ class Registry extends AbstractCommand_1.AbstractCommand {
|
|
|
83
72
|
}
|
|
84
73
|
}
|
|
85
74
|
exports.Registry = Registry;
|
|
75
|
+
Registry.metadata = [
|
|
76
|
+
{
|
|
77
|
+
id: "registry:add",
|
|
78
|
+
command: "registry",
|
|
79
|
+
subcommand: "add",
|
|
80
|
+
title: "Add registry",
|
|
81
|
+
group: "registry",
|
|
82
|
+
description: "Add a registry alias.",
|
|
83
|
+
icon: "DatabaseZap",
|
|
84
|
+
arguments: [
|
|
85
|
+
(0, helpers_1.argument)(0, { name: "registryName", cliName: "registry name", label: "Registry name", description: `Registry alias to create. "${trm_core_1.PUBLIC_RESERVED_KEYWORD}" and "${trm_core_1.LOCAL_RESERVED_KEYWORD}" are reserved and cannot be used.` })
|
|
86
|
+
],
|
|
87
|
+
options: [
|
|
88
|
+
(0, helpers_1.option)("-E, --registry-endpoint <endpoint>", { name: "registryEndpoint", label: "Registry endpoint", description: "Endpoint URL for the registry." })
|
|
89
|
+
],
|
|
90
|
+
requirements: {
|
|
91
|
+
requiresRegistry: true
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
id: "registry:rm",
|
|
96
|
+
command: "registry",
|
|
97
|
+
subcommand: "rm",
|
|
98
|
+
title: "Remove registry",
|
|
99
|
+
group: "registry",
|
|
100
|
+
description: "Remove a registry alias.",
|
|
101
|
+
icon: "DatabaseX",
|
|
102
|
+
arguments: [
|
|
103
|
+
(0, helpers_1.argument)(0, { name: "registryName", cliName: "registry name", label: "Registry name", description: `Registry alias to remove. "${trm_core_1.PUBLIC_RESERVED_KEYWORD}" and "${trm_core_1.LOCAL_RESERVED_KEYWORD}" are protected and cannot be deleted.` })
|
|
104
|
+
],
|
|
105
|
+
options: [
|
|
106
|
+
(0, helpers_1.option)("-E, --registry-endpoint <endpoint>", { name: "registryEndpoint", label: "Registry endpoint", description: "Endpoint URL for the registry." })
|
|
107
|
+
],
|
|
108
|
+
requirements: {
|
|
109
|
+
requiresRegistry: true
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
];
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { AbstractCommand } from "../AbstractCommand";
|
|
2
|
+
import { CommandMetadata } from "../metadata/CommandMetadata";
|
|
2
3
|
export declare class Settings extends AbstractCommand {
|
|
3
|
-
|
|
4
|
+
static readonly metadata: CommandMetadata;
|
|
4
5
|
protected handler(): Promise<void>;
|
|
5
6
|
}
|
|
@@ -13,13 +13,8 @@ exports.Settings = void 0;
|
|
|
13
13
|
const trm_commons_1 = require("trm-commons");
|
|
14
14
|
const AbstractCommand_1 = require("../AbstractCommand");
|
|
15
15
|
const utils_1 = require("../../utils");
|
|
16
|
+
const helpers_1 = require("../metadata/helpers");
|
|
16
17
|
class Settings extends AbstractCommand_1.AbstractCommand {
|
|
17
|
-
init() {
|
|
18
|
-
this.registerOpts.requiresConnection = true;
|
|
19
|
-
this.registerOpts.requiresTrmDependencies = true;
|
|
20
|
-
this.command.description(`Show/Set settings.`);
|
|
21
|
-
this.command.option(`-s, --set <property>`, `Property as KEY=VALUE.`);
|
|
22
|
-
}
|
|
23
18
|
handler() {
|
|
24
19
|
return __awaiter(this, void 0, void 0, function* () {
|
|
25
20
|
const setArgument = this.args.set;
|
|
@@ -40,3 +35,20 @@ class Settings extends AbstractCommand_1.AbstractCommand {
|
|
|
40
35
|
}
|
|
41
36
|
}
|
|
42
37
|
exports.Settings = Settings;
|
|
38
|
+
Settings.metadata = {
|
|
39
|
+
id: "settings",
|
|
40
|
+
command: "settings",
|
|
41
|
+
title: "Settings",
|
|
42
|
+
group: "utility",
|
|
43
|
+
guiRelevant: false,
|
|
44
|
+
description: "Show or update client settings.",
|
|
45
|
+
icon: "Settings",
|
|
46
|
+
arguments: [],
|
|
47
|
+
options: [
|
|
48
|
+
(0, helpers_1.option)("-s, --set <property>", { name: "set", label: "Set property", description: "Setting to update, in KEY=VALUE format." })
|
|
49
|
+
],
|
|
50
|
+
requirements: {
|
|
51
|
+
requiresConnection: true,
|
|
52
|
+
requiresTrmDependencies: true
|
|
53
|
+
}
|
|
54
|
+
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { AbstractCommand } from "../AbstractCommand";
|
|
2
|
+
import { CommandMetadata } from "../metadata/CommandMetadata";
|
|
2
3
|
export declare class Unpublish extends AbstractCommand {
|
|
3
|
-
|
|
4
|
+
static readonly metadata: CommandMetadata;
|
|
4
5
|
protected handler(): Promise<void>;
|
|
5
6
|
}
|
|
@@ -13,13 +13,8 @@ exports.Unpublish = void 0;
|
|
|
13
13
|
const trm_commons_1 = require("trm-commons");
|
|
14
14
|
const AbstractCommand_1 = require("../AbstractCommand");
|
|
15
15
|
const semver_1 = require("semver");
|
|
16
|
+
const helpers_1 = require("../metadata/helpers");
|
|
16
17
|
class Unpublish extends AbstractCommand_1.AbstractCommand {
|
|
17
|
-
init() {
|
|
18
|
-
this.registerOpts.requiresRegistry = true;
|
|
19
|
-
this.command.description(`Unpublish a package release from registry.`);
|
|
20
|
-
this.command.argument(`<package>`, `Name of the package.`);
|
|
21
|
-
this.command.argument(`<version>`, `Version of the release.`);
|
|
22
|
-
}
|
|
23
18
|
handler() {
|
|
24
19
|
return __awaiter(this, void 0, void 0, function* () {
|
|
25
20
|
if (!(0, semver_1.valid)(this.args.version)) {
|
|
@@ -32,3 +27,19 @@ class Unpublish extends AbstractCommand_1.AbstractCommand {
|
|
|
32
27
|
}
|
|
33
28
|
}
|
|
34
29
|
exports.Unpublish = Unpublish;
|
|
30
|
+
Unpublish.metadata = {
|
|
31
|
+
id: "unpublish",
|
|
32
|
+
command: "unpublish",
|
|
33
|
+
title: "Unpublish release",
|
|
34
|
+
group: "registry",
|
|
35
|
+
description: "Unpublish a package release from the registry.",
|
|
36
|
+
icon: "PackageX",
|
|
37
|
+
arguments: [
|
|
38
|
+
(0, helpers_1.argument)(0, { name: "package", label: "Package", description: "Package name." }),
|
|
39
|
+
(0, helpers_1.argument)(1, { name: "version", label: "Version", description: "Release version." })
|
|
40
|
+
],
|
|
41
|
+
options: [],
|
|
42
|
+
requirements: {
|
|
43
|
+
requiresRegistry: true
|
|
44
|
+
}
|
|
45
|
+
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { AbstractCommand } from "../AbstractCommand";
|
|
2
|
+
import { CommandMetadata } from "../metadata/CommandMetadata";
|
|
2
3
|
export declare class View extends AbstractCommand {
|
|
3
|
-
|
|
4
|
+
static readonly metadata: CommandMetadata;
|
|
4
5
|
private printHeaderSection;
|
|
5
6
|
private printVersionSection;
|
|
6
7
|
private printManifestSection;
|
|
@@ -20,19 +20,9 @@ const chalk_1 = __importDefault(require("chalk"));
|
|
|
20
20
|
const utils_1 = require("../../utils");
|
|
21
21
|
const semver_1 = require("semver");
|
|
22
22
|
const registryAlias_1 = require("../../registryAlias");
|
|
23
|
+
const helpers_1 = require("../metadata/helpers");
|
|
23
24
|
class View extends AbstractCommand_1.AbstractCommand {
|
|
24
|
-
init() {
|
|
25
|
-
this.registerOpts.requiresConnection = true;
|
|
26
|
-
this.registerOpts.addNoConnection = true;
|
|
27
|
-
this.registerOpts.requiresRegistry = true;
|
|
28
|
-
this.registerOpts.ignoreRegistryUnreachable = true;
|
|
29
|
-
this.command.description(`View package.`);
|
|
30
|
-
this.command.addHelpText(`before`, `Shows package details.
|
|
31
|
-
If the package is not found on the system, it will automatically fall back to the data provided by the registry, granted it exists.`);
|
|
32
|
-
this.command.argument(`<package>`, `Name of the package.`);
|
|
33
|
-
}
|
|
34
25
|
printHeaderSection(sapPackage) {
|
|
35
|
-
trm_commons_1.Logger.info(`Package name: ${chalk_1.default.bold(this.args.package)}`);
|
|
36
26
|
trm_commons_1.Logger.info(`Registry: ${this.getRegistry().name}`);
|
|
37
27
|
if (sapPackage) {
|
|
38
28
|
trm_commons_1.Logger.info(`SAP Package: ${sapPackage}`);
|
|
@@ -232,3 +222,24 @@ If the package is not found on the system, it will automatically fall back to th
|
|
|
232
222
|
}
|
|
233
223
|
}
|
|
234
224
|
exports.View = View;
|
|
225
|
+
View.metadata = {
|
|
226
|
+
id: "view",
|
|
227
|
+
command: "view",
|
|
228
|
+
title: "View package",
|
|
229
|
+
group: "package",
|
|
230
|
+
guiRelevant: false,
|
|
231
|
+
description: "Show package details.",
|
|
232
|
+
longDescription: `Shows package details from the connected system.
|
|
233
|
+
If the package is not installed, the command falls back to registry data when available.`,
|
|
234
|
+
icon: "Eye",
|
|
235
|
+
arguments: [
|
|
236
|
+
(0, helpers_1.argument)(0, { name: "package", label: "Package", description: "Package name." })
|
|
237
|
+
],
|
|
238
|
+
options: [],
|
|
239
|
+
requirements: {
|
|
240
|
+
requiresConnection: true,
|
|
241
|
+
addNoConnection: true,
|
|
242
|
+
requiresRegistry: true,
|
|
243
|
+
ignoreRegistryUnreachable: true
|
|
244
|
+
}
|
|
245
|
+
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { AbstractCommand } from "../AbstractCommand";
|
|
2
|
+
import { CommandMetadata } from "../metadata/CommandMetadata";
|
|
2
3
|
export declare class WhoAmI extends AbstractCommand {
|
|
3
|
-
|
|
4
|
+
static readonly metadata: CommandMetadata;
|
|
4
5
|
protected handler(): Promise<void>;
|
|
5
6
|
}
|
|
@@ -14,13 +14,6 @@ const trm_commons_1 = require("trm-commons");
|
|
|
14
14
|
const AbstractCommand_1 = require("../AbstractCommand");
|
|
15
15
|
const trm_registry_types_1 = require("trm-registry-types");
|
|
16
16
|
class WhoAmI extends AbstractCommand_1.AbstractCommand {
|
|
17
|
-
init() {
|
|
18
|
-
this.registerOpts.requiresRegistry = true;
|
|
19
|
-
this.registerOpts.onlyRegistryAlias = true;
|
|
20
|
-
this.registerOpts.registryAuthBlacklist = [trm_registry_types_1.AuthenticationType.NO_AUTH];
|
|
21
|
-
this.command.description(`Get data about a current registry logged user.`);
|
|
22
|
-
this.command.addHelpText(`before`, `This command has no effect when trying to login into a registry that doesn't require authentication.`);
|
|
23
|
-
}
|
|
24
17
|
handler() {
|
|
25
18
|
return __awaiter(this, void 0, void 0, function* () {
|
|
26
19
|
if (this.hasRegistryAuthData()) {
|
|
@@ -34,3 +27,20 @@ class WhoAmI extends AbstractCommand_1.AbstractCommand {
|
|
|
34
27
|
}
|
|
35
28
|
}
|
|
36
29
|
exports.WhoAmI = WhoAmI;
|
|
30
|
+
WhoAmI.metadata = {
|
|
31
|
+
id: "whoami",
|
|
32
|
+
command: "whoami",
|
|
33
|
+
title: "Current user",
|
|
34
|
+
group: "registry",
|
|
35
|
+
guiRelevant: false,
|
|
36
|
+
description: "Show the currently authenticated registry user.",
|
|
37
|
+
longDescription: "This command has no effect for registries that do not require authentication.",
|
|
38
|
+
icon: "UserRound",
|
|
39
|
+
arguments: [],
|
|
40
|
+
options: [],
|
|
41
|
+
requirements: {
|
|
42
|
+
requiresRegistry: true,
|
|
43
|
+
onlyRegistryAlias: true,
|
|
44
|
+
registryAuthBlacklist: [trm_registry_types_1.AuthenticationType.NO_AUTH]
|
|
45
|
+
}
|
|
46
|
+
};
|
|
@@ -1,3 +1,27 @@
|
|
|
1
|
+
import { CommandClass } from "../metadata/CommandMetadata";
|
|
2
|
+
import { Ping } from "./Ping";
|
|
3
|
+
import { Info } from "./Info";
|
|
4
|
+
import { Registry } from "./Registry";
|
|
5
|
+
import { Login } from "./Login";
|
|
6
|
+
import { WhoAmI } from "./WhoAmI";
|
|
7
|
+
import { Logout } from "./Logout";
|
|
8
|
+
import { Alias } from "./Alias";
|
|
9
|
+
import { Publish } from "./Publish";
|
|
10
|
+
import { DistTag } from "./DistTag";
|
|
11
|
+
import { Lock } from "./Lock";
|
|
12
|
+
import { Unpublish } from "./Unpublish";
|
|
13
|
+
import { Deprecate } from "./Deprecate";
|
|
14
|
+
import { Install } from "./Install";
|
|
15
|
+
import { List } from "./List";
|
|
16
|
+
import { Content } from "./Content";
|
|
17
|
+
import { View } from "./View";
|
|
18
|
+
import { Compare } from "./Compare";
|
|
19
|
+
import { Dirty } from "./Dirty";
|
|
20
|
+
import { FindDependencies } from "./FindDependencies";
|
|
21
|
+
import { Cg3y } from "./Cg3y";
|
|
22
|
+
import { Cg3z } from "./Cg3z";
|
|
23
|
+
import { Settings } from "./Settings";
|
|
24
|
+
import { ClearCache } from "./ClearCache";
|
|
1
25
|
export * from "./Ping";
|
|
2
26
|
export * from "./Info";
|
|
3
27
|
export * from "./Registry";
|
|
@@ -21,3 +45,6 @@ export * from "./Cg3y";
|
|
|
21
45
|
export * from "./Cg3z";
|
|
22
46
|
export * from "./Settings";
|
|
23
47
|
export * from "./ClearCache";
|
|
48
|
+
export declare const commands: (typeof Ping | typeof Info | typeof Registry | typeof Login | typeof WhoAmI | typeof Logout | typeof Alias | typeof Publish | typeof DistTag | typeof Lock | typeof Unpublish | typeof Deprecate | typeof Install | typeof List | typeof Content | typeof View | typeof Compare | typeof Dirty | typeof FindDependencies | typeof Cg3y | typeof Cg3z | typeof Settings | typeof ClearCache)[];
|
|
49
|
+
export declare function getCommand(id: string): CommandClass | undefined;
|
|
50
|
+
export declare function getCommandMetadata(id: string): import("../metadata/CommandMetadata").CommandMetadata;
|
|
@@ -14,6 +14,32 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.commands = void 0;
|
|
18
|
+
exports.getCommand = getCommand;
|
|
19
|
+
exports.getCommandMetadata = getCommandMetadata;
|
|
20
|
+
const Ping_1 = require("./Ping");
|
|
21
|
+
const Info_1 = require("./Info");
|
|
22
|
+
const Registry_1 = require("./Registry");
|
|
23
|
+
const Login_1 = require("./Login");
|
|
24
|
+
const WhoAmI_1 = require("./WhoAmI");
|
|
25
|
+
const Logout_1 = require("./Logout");
|
|
26
|
+
const Alias_1 = require("./Alias");
|
|
27
|
+
const Publish_1 = require("./Publish");
|
|
28
|
+
const DistTag_1 = require("./DistTag");
|
|
29
|
+
const Lock_1 = require("./Lock");
|
|
30
|
+
const Unpublish_1 = require("./Unpublish");
|
|
31
|
+
const Deprecate_1 = require("./Deprecate");
|
|
32
|
+
const Install_1 = require("./Install");
|
|
33
|
+
const List_1 = require("./List");
|
|
34
|
+
const Content_1 = require("./Content");
|
|
35
|
+
const View_1 = require("./View");
|
|
36
|
+
const Compare_1 = require("./Compare");
|
|
37
|
+
const Dirty_1 = require("./Dirty");
|
|
38
|
+
const FindDependencies_1 = require("./FindDependencies");
|
|
39
|
+
const Cg3y_1 = require("./Cg3y");
|
|
40
|
+
const Cg3z_1 = require("./Cg3z");
|
|
41
|
+
const Settings_1 = require("./Settings");
|
|
42
|
+
const ClearCache_1 = require("./ClearCache");
|
|
17
43
|
__exportStar(require("./Ping"), exports);
|
|
18
44
|
__exportStar(require("./Info"), exports);
|
|
19
45
|
__exportStar(require("./Registry"), exports);
|
|
@@ -37,3 +63,42 @@ __exportStar(require("./Cg3y"), exports);
|
|
|
37
63
|
__exportStar(require("./Cg3z"), exports);
|
|
38
64
|
__exportStar(require("./Settings"), exports);
|
|
39
65
|
__exportStar(require("./ClearCache"), exports);
|
|
66
|
+
exports.commands = [
|
|
67
|
+
Ping_1.Ping,
|
|
68
|
+
Info_1.Info,
|
|
69
|
+
Registry_1.Registry,
|
|
70
|
+
Login_1.Login,
|
|
71
|
+
WhoAmI_1.WhoAmI,
|
|
72
|
+
Logout_1.Logout,
|
|
73
|
+
Alias_1.Alias,
|
|
74
|
+
Publish_1.Publish,
|
|
75
|
+
DistTag_1.DistTag,
|
|
76
|
+
Lock_1.Lock,
|
|
77
|
+
Unpublish_1.Unpublish,
|
|
78
|
+
Deprecate_1.Deprecate,
|
|
79
|
+
Install_1.Install,
|
|
80
|
+
List_1.List,
|
|
81
|
+
Content_1.Content,
|
|
82
|
+
View_1.View,
|
|
83
|
+
Compare_1.Compare,
|
|
84
|
+
Dirty_1.Dirty,
|
|
85
|
+
FindDependencies_1.FindDependencies,
|
|
86
|
+
Cg3y_1.Cg3y,
|
|
87
|
+
Cg3z_1.Cg3z,
|
|
88
|
+
Settings_1.Settings,
|
|
89
|
+
ClearCache_1.ClearCache
|
|
90
|
+
];
|
|
91
|
+
function getCommand(id) {
|
|
92
|
+
return exports.commands.find(commandClass => {
|
|
93
|
+
const metadata = Array.isArray(commandClass.metadata) ? commandClass.metadata : [commandClass.metadata];
|
|
94
|
+
return metadata.some(command => command.id === id);
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
function getCommandMetadata(id) {
|
|
98
|
+
const commandClass = getCommand(id);
|
|
99
|
+
if (!commandClass) {
|
|
100
|
+
return undefined;
|
|
101
|
+
}
|
|
102
|
+
const metadata = Array.isArray(commandClass.metadata) ? commandClass.metadata : [commandClass.metadata];
|
|
103
|
+
return metadata.find(command => command.id === id);
|
|
104
|
+
}
|
package/dist/command/index.d.ts
CHANGED
package/dist/command/index.js
CHANGED
|
@@ -18,3 +18,5 @@ __exportStar(require("./AbstractCommand"), exports);
|
|
|
18
18
|
__exportStar(require("./InquirerType"), exports);
|
|
19
19
|
__exportStar(require("./LoggerType"), exports);
|
|
20
20
|
__exportStar(require("./RegisterCommandOpts"), exports);
|
|
21
|
+
__exportStar(require("./metadata"), exports);
|
|
22
|
+
__exportStar(require("./runCommandHandler"), exports);
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { RegisterCommandOpts } from "../RegisterCommandOpts";
|
|
2
|
+
import type { AbstractCommand } from "../AbstractCommand";
|
|
3
|
+
export type CommandControlType = "text-input" | "password-input" | "number-input" | "checkbox" | "select" | "multiselect" | "file-picker" | "textarea";
|
|
4
|
+
export interface CommandValueChoice {
|
|
5
|
+
label: string;
|
|
6
|
+
value: string | number | boolean;
|
|
7
|
+
description?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface CommandFieldMetadata {
|
|
10
|
+
name: string;
|
|
11
|
+
cliName?: string;
|
|
12
|
+
label: string;
|
|
13
|
+
description: string;
|
|
14
|
+
required: boolean;
|
|
15
|
+
control: CommandControlType;
|
|
16
|
+
defaultValue?: unknown;
|
|
17
|
+
choices?: CommandValueChoice[];
|
|
18
|
+
placeholder?: string;
|
|
19
|
+
multiple?: boolean;
|
|
20
|
+
sensitive?: boolean;
|
|
21
|
+
guiRelevant?: boolean;
|
|
22
|
+
}
|
|
23
|
+
export interface CommandArgumentMetadata extends CommandFieldMetadata {
|
|
24
|
+
kind: "argument";
|
|
25
|
+
position: number;
|
|
26
|
+
}
|
|
27
|
+
export interface CommandOptionMetadata extends CommandFieldMetadata {
|
|
28
|
+
kind: "option";
|
|
29
|
+
flags: string;
|
|
30
|
+
}
|
|
31
|
+
export type CommandGroup = "package" | "registry" | "system" | "utility";
|
|
32
|
+
export interface CommandMetadata {
|
|
33
|
+
id: string;
|
|
34
|
+
command: string;
|
|
35
|
+
subcommand?: string;
|
|
36
|
+
aliases?: string[];
|
|
37
|
+
title: string;
|
|
38
|
+
group: CommandGroup;
|
|
39
|
+
groupPriority?: number;
|
|
40
|
+
guiRelevant?: boolean;
|
|
41
|
+
description: string;
|
|
42
|
+
longDescription?: string;
|
|
43
|
+
icon: string;
|
|
44
|
+
arguments: CommandArgumentMetadata[];
|
|
45
|
+
options: CommandOptionMetadata[];
|
|
46
|
+
requirements: RegisterCommandOpts;
|
|
47
|
+
}
|
|
48
|
+
export type CommandMetadataExport = CommandMetadata | CommandMetadata[];
|
|
49
|
+
export interface CommandMetadataProvider {
|
|
50
|
+
readonly metadata: CommandMetadataExport;
|
|
51
|
+
}
|
|
52
|
+
export interface CommandClass extends CommandMetadataProvider {
|
|
53
|
+
new (program: import("commander").Command, name: string, aliases?: string[], subcommand?: string): AbstractCommand;
|
|
54
|
+
new (name: string, aliases?: string[], subcommand?: string): AbstractCommand;
|
|
55
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.applyCommandMetadata = applyCommandMetadata;
|
|
4
|
+
function argumentToken(argument) {
|
|
5
|
+
var _a;
|
|
6
|
+
const name = (_a = argument.cliName) !== null && _a !== void 0 ? _a : argument.name;
|
|
7
|
+
return argument.required ? `<${name}>` : `[${name}]`;
|
|
8
|
+
}
|
|
9
|
+
function applyCommandMetadata(command, metadata) {
|
|
10
|
+
var _a;
|
|
11
|
+
if ((_a = metadata.aliases) === null || _a === void 0 ? void 0 : _a.length) {
|
|
12
|
+
command.aliases(metadata.aliases);
|
|
13
|
+
}
|
|
14
|
+
command.description(metadata.description);
|
|
15
|
+
if (metadata.longDescription) {
|
|
16
|
+
command.addHelpText("before", metadata.longDescription);
|
|
17
|
+
}
|
|
18
|
+
[...metadata.arguments]
|
|
19
|
+
.sort((a, b) => a.position - b.position)
|
|
20
|
+
.forEach(argument => {
|
|
21
|
+
command.argument(argumentToken(argument), argument.description, argument.defaultValue);
|
|
22
|
+
});
|
|
23
|
+
metadata.options.forEach(option => {
|
|
24
|
+
command.option(option.flags, option.description, option.defaultValue);
|
|
25
|
+
});
|
|
26
|
+
}
|