trm-client 6.1.1 → 7.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/LICENSE +20 -20
- package/README.md +65 -65
- package/changelog.txt +179 -165
- package/dist/command/AbstractCommand.d.ts +42 -0
- package/dist/command/AbstractCommand.js +418 -0
- package/dist/command/InquirerType.d.ts +3 -0
- package/dist/command/InquirerType.js +7 -0
- package/dist/{utils/executeCommand.d.ts → command/LoggerType.d.ts} +0 -4
- package/dist/command/LoggerType.js +11 -0
- package/dist/{utils/registerCommand.d.ts → command/RegisterCommandOpts.d.ts} +4 -3
- package/dist/command/implementations/Alias.d.ts +8 -0
- package/dist/command/implementations/Alias.js +172 -0
- package/dist/command/implementations/Compare.d.ts +7 -0
- package/dist/command/implementations/Compare.js +133 -0
- package/dist/command/implementations/Content.d.ts +5 -0
- package/dist/command/implementations/Content.js +195 -0
- package/dist/command/implementations/Deprecate.d.ts +5 -0
- package/dist/command/implementations/Deprecate.js +33 -0
- package/dist/command/implementations/DistTag.d.ts +5 -0
- package/dist/command/implementations/DistTag.js +48 -0
- package/dist/command/implementations/FindDependencies.d.ts +5 -0
- package/dist/command/implementations/FindDependencies.js +42 -0
- package/dist/command/implementations/Info.d.ts +11 -0
- package/dist/command/implementations/Info.js +245 -0
- package/dist/command/implementations/Install.d.ts +13 -0
- package/dist/command/implementations/Install.js +201 -0
- package/dist/command/implementations/List.d.ts +5 -0
- package/dist/command/implementations/List.js +116 -0
- package/dist/command/implementations/Lock.d.ts +5 -0
- package/dist/command/implementations/Lock.js +40 -0
- package/dist/command/implementations/Login.d.ts +5 -0
- package/dist/command/implementations/Login.js +66 -0
- package/dist/command/implementations/Logout.d.ts +5 -0
- package/dist/command/implementations/Logout.js +37 -0
- package/dist/command/implementations/Ping.d.ts +5 -0
- package/dist/{commands/findDependencies.js → command/implementations/Ping.js} +15 -16
- package/dist/command/implementations/Publish.d.ts +6 -0
- package/dist/command/implementations/Publish.js +145 -0
- package/dist/command/implementations/Registry.d.ts +5 -0
- package/dist/command/implementations/Registry.js +88 -0
- package/dist/command/implementations/Settings.d.ts +5 -0
- package/dist/command/implementations/Settings.js +42 -0
- package/dist/command/implementations/Unpublish.d.ts +5 -0
- package/dist/command/implementations/Unpublish.js +34 -0
- package/dist/command/implementations/View.d.ts +9 -0
- package/dist/command/implementations/View.js +237 -0
- package/dist/command/implementations/WhoAmI.d.ts +5 -0
- package/dist/command/implementations/WhoAmI.js +36 -0
- package/dist/command/implementations/index.d.ts +19 -0
- package/dist/command/implementations/index.js +35 -0
- package/dist/command/index.d.ts +4 -0
- package/dist/{commands/commons → command}/index.js +4 -2
- package/dist/{commands/arguments/ConnectArguments.d.ts → command/prompts/connect.d.ts} +2 -0
- package/dist/{commands → command}/prompts/connect.js +3 -3
- package/dist/command/prompts/createAlias.d.ts +1 -0
- package/dist/{commands → command/prompts}/createAlias.js +8 -8
- package/dist/command/prompts/deleteAlias.d.ts +1 -0
- package/dist/{commands → command/prompts}/deleteAlias.js +3 -4
- package/dist/command/prompts/index.d.ts +4 -0
- package/dist/{commands → command}/prompts/index.js +2 -0
- package/dist/index.js +34 -278
- package/dist/registryAlias/RegistryAlias.js +1 -1
- package/dist/systemAlias/SystemAlias.js +4 -4
- package/dist/utils/{Context.d.ts → GlobalContext.d.ts} +3 -3
- package/dist/utils/{Context.js → GlobalContext.js} +6 -6
- package/dist/utils/checkCliUpdate.d.ts +3 -2
- package/dist/utils/checkCliUpdate.js +3 -3
- package/dist/utils/getSapLogonConnections.js +3 -3
- package/dist/utils/index.d.ts +1 -4
- package/dist/utils/index.js +1 -4
- package/package.json +67 -65
- package/dist/commands/addRegistry.d.ts +0 -2
- package/dist/commands/addRegistry.js +0 -66
- package/dist/commands/alias.d.ts +0 -2
- package/dist/commands/alias.js +0 -156
- package/dist/commands/arguments/AddRegistryArguments.d.ts +0 -5
- package/dist/commands/arguments/AliasArguments.d.ts +0 -3
- package/dist/commands/arguments/AliasArguments.js +0 -2
- package/dist/commands/arguments/CheckArguments.d.ts +0 -4
- package/dist/commands/arguments/CheckArguments.js +0 -2
- package/dist/commands/arguments/CompareArguments.d.ts +0 -4
- package/dist/commands/arguments/CompareArguments.js +0 -2
- package/dist/commands/arguments/ConnectArguments.js +0 -2
- package/dist/commands/arguments/ContentArguments.d.ts +0 -6
- package/dist/commands/arguments/ContentArguments.js +0 -2
- package/dist/commands/arguments/CreateAliasArguments.d.ts +0 -3
- package/dist/commands/arguments/CreateAliasArguments.js +0 -2
- package/dist/commands/arguments/DeleteAliasArguments.d.ts +0 -3
- package/dist/commands/arguments/DeleteAliasArguments.js +0 -2
- package/dist/commands/arguments/FindDependenciesArguments.d.ts +0 -5
- package/dist/commands/arguments/FindDependenciesArguments.js +0 -2
- package/dist/commands/arguments/ImportArguments.d.ts +0 -19
- package/dist/commands/arguments/ImportArguments.js +0 -2
- package/dist/commands/arguments/InfoArguments.d.ts +0 -1
- package/dist/commands/arguments/InfoArguments.js +0 -2
- package/dist/commands/arguments/InstallArguments.d.ts +0 -20
- package/dist/commands/arguments/InstallArguments.js +0 -2
- package/dist/commands/arguments/ListArguments.d.ts +0 -3
- package/dist/commands/arguments/ListArguments.js +0 -2
- package/dist/commands/arguments/LockArguments.d.ts +0 -4
- package/dist/commands/arguments/LockArguments.js +0 -2
- package/dist/commands/arguments/LoginArguments.d.ts +0 -4
- package/dist/commands/arguments/LoginArguments.js +0 -2
- package/dist/commands/arguments/LogoutArguments.d.ts +0 -1
- package/dist/commands/arguments/LogoutArguments.js +0 -2
- package/dist/commands/arguments/PackArguments.d.ts +0 -22
- package/dist/commands/arguments/PackArguments.js +0 -2
- package/dist/commands/arguments/PingArguments.d.ts +0 -1
- package/dist/commands/arguments/PingArguments.js +0 -2
- package/dist/commands/arguments/PublishArguments.d.ts +0 -24
- package/dist/commands/arguments/PublishArguments.js +0 -2
- package/dist/commands/arguments/RemoveRegistryArguments.d.ts +0 -4
- package/dist/commands/arguments/RemoveRegistryArguments.js +0 -2
- package/dist/commands/arguments/SettingsArgument.d.ts +0 -3
- package/dist/commands/arguments/SettingsArgument.js +0 -2
- package/dist/commands/arguments/UnpublishArguments.d.ts +0 -4
- package/dist/commands/arguments/UnpublishArguments.js +0 -2
- package/dist/commands/arguments/UpdateArguments.d.ts +0 -2
- package/dist/commands/arguments/UpdateArguments.js +0 -2
- package/dist/commands/arguments/ViewArguments.d.ts +0 -3
- package/dist/commands/arguments/ViewArguments.js +0 -2
- package/dist/commands/arguments/WhoAmIArguments.d.ts +0 -1
- package/dist/commands/arguments/WhoAmIArguments.js +0 -2
- package/dist/commands/arguments/index.d.ts +0 -24
- package/dist/commands/arguments/index.js +0 -40
- package/dist/commands/check.d.ts +0 -2
- package/dist/commands/check.js +0 -87
- package/dist/commands/commons/CommandContext.d.ts +0 -9
- package/dist/commands/commons/CommandContext.js +0 -41
- package/dist/commands/commons/index.d.ts +0 -2
- package/dist/commands/commons/viewRegistryPackage.d.ts +0 -2
- package/dist/commands/commons/viewRegistryPackage.js +0 -48
- package/dist/commands/compare.d.ts +0 -2
- package/dist/commands/compare.js +0 -167
- package/dist/commands/content.d.ts +0 -2
- package/dist/commands/content.js +0 -182
- package/dist/commands/createAlias.d.ts +0 -2
- package/dist/commands/deleteAlias.d.ts +0 -2
- package/dist/commands/findDependencies.d.ts +0 -2
- package/dist/commands/import.d.ts +0 -2
- package/dist/commands/import.js +0 -84
- package/dist/commands/index.d.ts +0 -27
- package/dist/commands/index.js +0 -43
- package/dist/commands/info.d.ts +0 -2
- package/dist/commands/info.js +0 -233
- package/dist/commands/install.d.ts +0 -2
- package/dist/commands/install.js +0 -85
- package/dist/commands/list.d.ts +0 -2
- package/dist/commands/list.js +0 -70
- package/dist/commands/lock.d.ts +0 -2
- package/dist/commands/lock.js +0 -64
- package/dist/commands/login.d.ts +0 -2
- package/dist/commands/login.js +0 -59
- package/dist/commands/logout.d.ts +0 -2
- package/dist/commands/logout.js +0 -27
- package/dist/commands/pack.d.ts +0 -2
- package/dist/commands/pack.js +0 -95
- package/dist/commands/ping.d.ts +0 -2
- package/dist/commands/ping.js +0 -21
- package/dist/commands/prompts/connect.d.ts +0 -3
- package/dist/commands/prompts/index.d.ts +0 -2
- package/dist/commands/publish.d.ts +0 -2
- package/dist/commands/publish.js +0 -128
- package/dist/commands/removeRegistry.d.ts +0 -2
- package/dist/commands/removeRegistry.js +0 -36
- package/dist/commands/selfUpdate.d.ts +0 -1
- package/dist/commands/selfUpdate.js +0 -77
- package/dist/commands/settings.d.ts +0 -2
- package/dist/commands/settings.js +0 -32
- package/dist/commands/unpublish.d.ts +0 -2
- package/dist/commands/unpublish.js +0 -61
- package/dist/commands/update.d.ts +0 -2
- package/dist/commands/update.js +0 -20
- package/dist/commands/view.d.ts +0 -2
- package/dist/commands/view.js +0 -219
- package/dist/commands/whoami.d.ts +0 -2
- package/dist/commands/whoami.js +0 -34
- package/dist/utils/checkTrmDependencies.d.ts +0 -1
- package/dist/utils/checkTrmDependencies.js +0 -43
- package/dist/utils/executeCommand.js +0 -213
- package/dist/utils/registerCommand.js +0 -93
- /package/dist/{commands/arguments/AddRegistryArguments.js → command/RegisterCommandOpts.js} +0 -0
- /package/dist/{commands → command}/prompts/pickRegistry.d.ts +0 -0
- /package/dist/{commands → command}/prompts/pickRegistry.js +0 -0
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.Login = void 0;
|
|
13
|
+
const trm_commons_1 = require("trm-commons");
|
|
14
|
+
const AbstractCommand_1 = require("../AbstractCommand");
|
|
15
|
+
const registryAlias_1 = require("../../registryAlias");
|
|
16
|
+
const trm_registry_types_1 = require("trm-registry-types");
|
|
17
|
+
class Login extends AbstractCommand_1.AbstractCommand {
|
|
18
|
+
init() {
|
|
19
|
+
this.registerOpts.requiresRegistry = true;
|
|
20
|
+
this.registerOpts.onlyRegistryAlias = true;
|
|
21
|
+
this.registerOpts.registryAuthBlacklist = [trm_registry_types_1.AuthenticationType.NO_AUTH];
|
|
22
|
+
this.command.description(`Log into a registry.`);
|
|
23
|
+
this.command.addHelpText(`before`, `This command has no effect when trying to login into a registry that doesn't require authentication.`);
|
|
24
|
+
this.command.option(`-A, --registry-auth <authentication>`, `Registry authentication (JSON or path to JSON file).`);
|
|
25
|
+
}
|
|
26
|
+
handler() {
|
|
27
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
28
|
+
const registry = this.getRegistry();
|
|
29
|
+
var authData;
|
|
30
|
+
if (this.parseJsonArg('registryAuth')) {
|
|
31
|
+
if (!this.getRegistryAuthError()) {
|
|
32
|
+
authData = registry.getAuthData();
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
var continueLogin;
|
|
37
|
+
try {
|
|
38
|
+
const whoami = yield registry.whoAmI();
|
|
39
|
+
continueLogin = (yield trm_commons_1.Inquirer.prompt({
|
|
40
|
+
type: "confirm",
|
|
41
|
+
name: "continue",
|
|
42
|
+
message: `Already logged in as "${whoami.user}". Do you want to logout?`,
|
|
43
|
+
default: false
|
|
44
|
+
})).continue;
|
|
45
|
+
}
|
|
46
|
+
catch (_a) {
|
|
47
|
+
continueLogin = true;
|
|
48
|
+
}
|
|
49
|
+
if (continueLogin) {
|
|
50
|
+
yield registry.authenticate({});
|
|
51
|
+
authData = registry.getAuthData();
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
if (authData) {
|
|
55
|
+
registryAlias_1.RegistryAlias.update(registry.name, authData);
|
|
56
|
+
try {
|
|
57
|
+
yield this.registryWhoAmI();
|
|
58
|
+
}
|
|
59
|
+
catch (_b) {
|
|
60
|
+
registryAlias_1.RegistryAlias.update(registry.name);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
exports.Login = Login;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.Logout = void 0;
|
|
13
|
+
const trm_commons_1 = require("trm-commons");
|
|
14
|
+
const registryAlias_1 = require("../../registryAlias");
|
|
15
|
+
const AbstractCommand_1 = require("../AbstractCommand");
|
|
16
|
+
const trm_registry_types_1 = require("trm-registry-types");
|
|
17
|
+
class Logout extends AbstractCommand_1.AbstractCommand {
|
|
18
|
+
init() {
|
|
19
|
+
this.registerOpts.requiresRegistry = true;
|
|
20
|
+
this.registerOpts.onlyRegistryAlias = true;
|
|
21
|
+
this.registerOpts.registryAuthBlacklist = [trm_registry_types_1.AuthenticationType.NO_AUTH];
|
|
22
|
+
this.command.description(`Log out of a registry.`);
|
|
23
|
+
this.command.addHelpText(`before`, `This command has no effect when trying to login into a registry that doesn't require authentication.`);
|
|
24
|
+
}
|
|
25
|
+
handler() {
|
|
26
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
27
|
+
const registry = this.getRegistry();
|
|
28
|
+
if (this.hasRegistryAuthData()) {
|
|
29
|
+
registryAlias_1.RegistryAlias.update(registry.name);
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
trm_commons_1.Logger.info(`Not logged in.`);
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
exports.Logout = Logout;
|
|
@@ -9,23 +9,22 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.
|
|
12
|
+
exports.Ping = void 0;
|
|
13
13
|
const trm_commons_1 = require("trm-commons");
|
|
14
14
|
const trm_core_1 = require("trm-core");
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
sapObjectDependencies: commandArgs.sapEntries
|
|
28
|
-
}
|
|
15
|
+
const AbstractCommand_1 = require("../AbstractCommand");
|
|
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
|
+
handler() {
|
|
23
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
24
|
+
trm_commons_1.Logger.loading(`Pinging trm-server on ${trm_core_1.SystemConnector.getDest()}...`);
|
|
25
|
+
const pingValue = yield trm_core_1.SystemConnector.ping();
|
|
26
|
+
trm_commons_1.Logger.info(pingValue);
|
|
29
27
|
});
|
|
30
|
-
}
|
|
28
|
+
}
|
|
31
29
|
}
|
|
30
|
+
exports.Ping = Ping;
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.Publish = void 0;
|
|
13
|
+
const trm_commons_1 = require("trm-commons");
|
|
14
|
+
const trm_core_1 = require("trm-core");
|
|
15
|
+
const AbstractCommand_1 = require("../AbstractCommand");
|
|
16
|
+
const utils_1 = require("../../utils");
|
|
17
|
+
const semver_1 = require("semver");
|
|
18
|
+
class Publish extends AbstractCommand_1.AbstractCommand {
|
|
19
|
+
init() {
|
|
20
|
+
this.registerOpts.requiresConnection = true;
|
|
21
|
+
this.registerOpts.requiresTrmDependencies = true;
|
|
22
|
+
if (this.name === 'pack') {
|
|
23
|
+
this.command.description(`Export a package to local file.`);
|
|
24
|
+
this.command.argument(`<filename>`, `Name (or path) of the file.`);
|
|
25
|
+
this.command.option(`--package <package>`, `Name of the package`);
|
|
26
|
+
this.command.option(`--version <version>`, `Version of the release`);
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
this.registerOpts.requiresRegistry = true;
|
|
30
|
+
this.command.description(`Publish a package to a registry.`);
|
|
31
|
+
this.command.argument(`<package>`, `Name of the package.`);
|
|
32
|
+
this.command.argument(`[version]`, `Optional: Version of the release to publish.`);
|
|
33
|
+
this.command.option(`-i, --increment <increment>`, `Semantic versioning increment (used when no version is specified)`, `patch`);
|
|
34
|
+
this.command.option(`--pre-release`, `Publish as pre release`, false);
|
|
35
|
+
this.command.option(`--pre-release-identifier <identifier>`, `Identifier (needs to pre a pre release)`);
|
|
36
|
+
this.command.option(`--tag <tag>`, `Release tag(s) (separated by comma)`);
|
|
37
|
+
this.command.option(`--private`, `Package marked as private. Depending on the registry, visibility might not be changed after first publish.`);
|
|
38
|
+
this.command.option(`--readme <readme>`, `Release readme (markdown or path to markdown file)`);
|
|
39
|
+
this.command.option(`--no-keep-manifest`, `Don't default to previous release manifest values.`, false);
|
|
40
|
+
}
|
|
41
|
+
this.command.option(`-P, --sap-package <sap package>`, `SAP Package.`);
|
|
42
|
+
this.command.option(`-t, --timeout <seconds>`, `Transport release timeout (in seconds)`, `180`);
|
|
43
|
+
this.command.option(`-T, --target <target>`, `Transport release target.`);
|
|
44
|
+
this.command.option(`--no-lang-tr`, `Do not generate language (translation) transport.`, false);
|
|
45
|
+
this.command.option(`--no-cust-tr`, `Do not generate customizing transport.`, false);
|
|
46
|
+
this.command.option(`--cust <customizing>`, `Customizing transport(s) (separated by comma).`);
|
|
47
|
+
this.command.option(`--no-auto-deps`, `Do not look for dependencies.`, false);
|
|
48
|
+
this.command.option(`--authors <authors>`, `Release author(s) (separated by comma)`);
|
|
49
|
+
this.command.option(`--backwards-compatible`, `Backwards-compatible release (reserved for future use)`);
|
|
50
|
+
this.command.option(`--description <description>`, `Release description`);
|
|
51
|
+
this.command.option(`--git <git url>`, `Release git URL`);
|
|
52
|
+
this.command.option(`--keywords <keywords>`, `Release keyword(s) (separated by comma)`);
|
|
53
|
+
this.command.option(`--license <license>`, `Release license`);
|
|
54
|
+
this.command.option(`--website <website url>`, `Release website URL`);
|
|
55
|
+
this.command.option(`--dependencies <dependencies>`, `Release dependencies (JSON or path to JSON file)`);
|
|
56
|
+
this.command.option(`--sap-entries <sap entries>`, `Release SAP entries (JSON or path to JSON file)`);
|
|
57
|
+
this.command.option(`--post-activities <post activities>`, `Release post activities (JSON or path to JSON file)`);
|
|
58
|
+
this.command.option(`--no-prompts`, `No prompts (will force some decisions).`, false);
|
|
59
|
+
}
|
|
60
|
+
validateVersion(v) {
|
|
61
|
+
if ((0, semver_1.valid)(v)) {
|
|
62
|
+
return true;
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
return 'Invalid semantic versioning';
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
handler() {
|
|
69
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
70
|
+
var registry;
|
|
71
|
+
if (this.name === 'pack') {
|
|
72
|
+
if (!this.args.noPrompts) {
|
|
73
|
+
const pack = yield trm_commons_1.Inquirer.prompt([{
|
|
74
|
+
name: 'package',
|
|
75
|
+
type: 'input',
|
|
76
|
+
message: 'Package name',
|
|
77
|
+
default: this.args.package,
|
|
78
|
+
when: !this.args.package
|
|
79
|
+
}, {
|
|
80
|
+
name: 'version',
|
|
81
|
+
type: 'input',
|
|
82
|
+
message: 'Release version',
|
|
83
|
+
default: this.args.version,
|
|
84
|
+
when: !this.args.version,
|
|
85
|
+
validate: this.validateVersion
|
|
86
|
+
}]);
|
|
87
|
+
this.args.package = pack.package;
|
|
88
|
+
this.args.version = pack.version;
|
|
89
|
+
}
|
|
90
|
+
if (this.validateVersion(this.args.version) !== true) {
|
|
91
|
+
throw new Error(this.validateVersion(this.args.version));
|
|
92
|
+
}
|
|
93
|
+
registry = new trm_core_1.FileSystem(this.args.filename);
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
registry = this.getRegistry();
|
|
97
|
+
}
|
|
98
|
+
const packages = yield this.getSystemPackages();
|
|
99
|
+
const result = yield (0, trm_core_1.publish)({
|
|
100
|
+
contextData: {
|
|
101
|
+
logTemporaryFolder: (0, utils_1.getTempFolder)(),
|
|
102
|
+
systemPackages: packages,
|
|
103
|
+
noInquirer: this.args.noPrompts
|
|
104
|
+
},
|
|
105
|
+
packageData: {
|
|
106
|
+
registry,
|
|
107
|
+
name: this.args.package,
|
|
108
|
+
version: this.args.version,
|
|
109
|
+
devclass: this.args.sapPackage,
|
|
110
|
+
inc: this.args.increment,
|
|
111
|
+
preRelease: this.args.preRelease,
|
|
112
|
+
preReleaseIdentifier: this.args.preReleaseIdentifier,
|
|
113
|
+
tags: this.parseArrayArg('tag'),
|
|
114
|
+
manifest: {
|
|
115
|
+
authors: this.args.authors,
|
|
116
|
+
backwardsCompatible: this.args.backwardsCompatible,
|
|
117
|
+
description: this.args.description,
|
|
118
|
+
git: this.args.git,
|
|
119
|
+
keywords: this.args.keywords,
|
|
120
|
+
license: this.args.license,
|
|
121
|
+
website: this.args.website,
|
|
122
|
+
dependencies: this.parseJsonArg('dependencies'),
|
|
123
|
+
sapEntries: this.parseJsonArg('sapEntries'),
|
|
124
|
+
postActivities: this.parseJsonArg('postActivities')
|
|
125
|
+
},
|
|
126
|
+
},
|
|
127
|
+
publishData: {
|
|
128
|
+
private: this.args.private,
|
|
129
|
+
keepLatestReleaseManifestValues: !this.args.noKeepManifest,
|
|
130
|
+
noLanguageTransport: this.args.noLangTr,
|
|
131
|
+
noDependenciesDetection: this.args.noAutoDeps,
|
|
132
|
+
skipCustomizingTransports: this.args.noCustTr,
|
|
133
|
+
customizingTransports: this.args.cust,
|
|
134
|
+
readme: this.parseTextArg('readme')
|
|
135
|
+
},
|
|
136
|
+
systemData: {
|
|
137
|
+
releaseTimeout: this.parseNumberArg('timeout'),
|
|
138
|
+
transportTarget: this.args.target
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
trm_commons_1.Logger.success(`+ ${result.trmPackage.manifest.get().name} v${result.trmPackage.manifest.get().version}`);
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
exports.Publish = Publish;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.Registry = void 0;
|
|
13
|
+
const trm_core_1 = require("trm-core");
|
|
14
|
+
const AbstractCommand_1 = require("../AbstractCommand");
|
|
15
|
+
const trm_commons_1 = require("trm-commons");
|
|
16
|
+
const registryAlias_1 = require("../../registryAlias");
|
|
17
|
+
class Registry extends AbstractCommand_1.AbstractCommand {
|
|
18
|
+
init() {
|
|
19
|
+
this.registerOpts.requiresRegistry = true;
|
|
20
|
+
if (this.name.includes('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.name.includes('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
|
+
handler() {
|
|
31
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
32
|
+
const registryName = this.args.registryName.trim();
|
|
33
|
+
if (this.args.add && this.args.add.trim().toLowerCase() === 'add') {
|
|
34
|
+
var endpoint = this.args.endpoint;
|
|
35
|
+
if (registryName.toLowerCase() === trm_core_1.PUBLIC_RESERVED_KEYWORD) {
|
|
36
|
+
throw new Error(`Registry name "${trm_core_1.PUBLIC_RESERVED_KEYWORD}" is a reserved keyword.`);
|
|
37
|
+
}
|
|
38
|
+
if (registryName.toLowerCase() === trm_core_1.LOCAL_RESERVED_KEYWORD) {
|
|
39
|
+
throw new Error(`Registry name "${trm_core_1.LOCAL_RESERVED_KEYWORD}" is a reserved keyword.`);
|
|
40
|
+
}
|
|
41
|
+
const inq1 = yield trm_commons_1.Inquirer.prompt({
|
|
42
|
+
type: "input",
|
|
43
|
+
name: "endpoint",
|
|
44
|
+
message: "Registry endpoint",
|
|
45
|
+
default: endpoint,
|
|
46
|
+
when: !endpoint
|
|
47
|
+
});
|
|
48
|
+
endpoint = inq1.endpoint || endpoint;
|
|
49
|
+
const registry = registryAlias_1.RegistryAlias.create(registryName, endpoint);
|
|
50
|
+
var pingSuccess = true;
|
|
51
|
+
try {
|
|
52
|
+
const ping = yield registry.getRegistry().ping();
|
|
53
|
+
if (ping.messages) {
|
|
54
|
+
ping.messages.forEach(m => trm_commons_1.Logger.registryResponse(m));
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
catch (e) {
|
|
58
|
+
trm_commons_1.Logger.error(`Ping to registry "${registryName}" (${endpoint}) failed.`);
|
|
59
|
+
pingSuccess = false;
|
|
60
|
+
throw e;
|
|
61
|
+
}
|
|
62
|
+
finally {
|
|
63
|
+
if (pingSuccess) {
|
|
64
|
+
trm_commons_1.Logger.success(`Registry "${registryName}" added.`);
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
registryAlias_1.RegistryAlias.delete(registryName);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
else if (this.args.rm && this.args.rm.trim().toLowerCase() === 'rm') {
|
|
72
|
+
if (registryName.toLowerCase() === trm_core_1.PUBLIC_RESERVED_KEYWORD) {
|
|
73
|
+
throw new Error(`Registry "${trm_core_1.PUBLIC_RESERVED_KEYWORD}" is protected and cannot be deleted.`);
|
|
74
|
+
}
|
|
75
|
+
if (registryName.toLowerCase() === trm_core_1.LOCAL_RESERVED_KEYWORD) {
|
|
76
|
+
throw new Error(`Registry "${trm_core_1.LOCAL_RESERVED_KEYWORD}" is protected and cannot be deleted.`);
|
|
77
|
+
}
|
|
78
|
+
registryAlias_1.RegistryAlias.get(registryName);
|
|
79
|
+
registryAlias_1.RegistryAlias.delete(registryName);
|
|
80
|
+
trm_commons_1.Logger.success(`Registry "${registryName}" has been removed.`);
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
throw new Error(`Unknown command.`);
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
exports.Registry = Registry;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.Settings = void 0;
|
|
13
|
+
const trm_commons_1 = require("trm-commons");
|
|
14
|
+
const AbstractCommand_1 = require("../AbstractCommand");
|
|
15
|
+
const utils_1 = require("../../utils");
|
|
16
|
+
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
|
+
handler() {
|
|
24
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
25
|
+
const setArgument = this.args.set;
|
|
26
|
+
if (setArgument) {
|
|
27
|
+
const aSplit = setArgument.split('=');
|
|
28
|
+
if (aSplit.length !== 2) {
|
|
29
|
+
throw new Error(`Invalid 'set' argument, must be in format KEY=VALUE.`);
|
|
30
|
+
}
|
|
31
|
+
const key = aSplit[0];
|
|
32
|
+
const value = aSplit[1];
|
|
33
|
+
utils_1.GlobalContext.getInstance().setSetting(key, value);
|
|
34
|
+
}
|
|
35
|
+
const settingsData = utils_1.GlobalContext.getInstance().getSettings();
|
|
36
|
+
Object.keys(settingsData).forEach(k => {
|
|
37
|
+
trm_commons_1.Logger.log(`${k}: ${settingsData[k]}`);
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
exports.Settings = Settings;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.Unpublish = void 0;
|
|
13
|
+
const trm_commons_1 = require("trm-commons");
|
|
14
|
+
const AbstractCommand_1 = require("../AbstractCommand");
|
|
15
|
+
const semver_1 = require("semver");
|
|
16
|
+
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
|
+
handler() {
|
|
24
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
25
|
+
if (!(0, semver_1.valid)(this.args.version)) {
|
|
26
|
+
throw new Error(`Invalid version.`);
|
|
27
|
+
}
|
|
28
|
+
yield this.getRegistry().unpublish(this.args.package, this.args.version);
|
|
29
|
+
const sOutput = `- ${this.args.package} ${this.args.version}`;
|
|
30
|
+
trm_commons_1.Logger.success(sOutput);
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
exports.Unpublish = Unpublish;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { AbstractCommand } from "../AbstractCommand";
|
|
2
|
+
export declare class View extends AbstractCommand {
|
|
3
|
+
protected init(): void;
|
|
4
|
+
private printHeaderSection;
|
|
5
|
+
private printVersionSection;
|
|
6
|
+
private printManifestSection;
|
|
7
|
+
private printDependenciesSection;
|
|
8
|
+
protected handler(): Promise<void>;
|
|
9
|
+
}
|