trm-client 7.0.3 → 7.1.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.
- package/changelog.txt +9 -0
- package/dist/command/AbstractCommand.d.ts +2 -1
- package/dist/command/AbstractCommand.js +20 -3
- package/dist/command/RegisterCommandOpts.d.ts +1 -0
- package/dist/command/implementations/Alias.js +5 -5
- package/dist/command/implementations/Deprecate.js +2 -0
- package/dist/command/implementations/DistTag.js +7 -7
- package/dist/command/implementations/Install.js +3 -1
- package/dist/command/implementations/Registry.js +4 -7
- package/dist/index.js +6 -6
- package/package.json +1 -1
package/changelog.txt
CHANGED
|
@@ -8,6 +8,15 @@ Legend
|
|
|
8
8
|
+ : added
|
|
9
9
|
- : removed
|
|
10
10
|
|
|
11
|
+
2025-11-10 v7.1.1
|
|
12
|
+
-------------------
|
|
13
|
+
+ success message on dist-tag and deprecate
|
|
14
|
+
- cli update check on update command
|
|
15
|
+
|
|
16
|
+
2025-11-10 v7.1.0
|
|
17
|
+
-------------------
|
|
18
|
+
* commands with subcommands
|
|
19
|
+
|
|
11
20
|
2025-11-10 v7.0.3
|
|
12
21
|
-------------------
|
|
13
22
|
* commands with 2+ arguments
|
|
@@ -6,6 +6,7 @@ import { Package } from "trm-registry-types";
|
|
|
6
6
|
export declare abstract class AbstractCommand {
|
|
7
7
|
protected readonly name: string;
|
|
8
8
|
protected readonly aliases?: string[];
|
|
9
|
+
protected readonly subcommand?: string;
|
|
9
10
|
protected command: Command;
|
|
10
11
|
protected registerOpts: RegisterCommandOpts;
|
|
11
12
|
protected args: any;
|
|
@@ -15,7 +16,7 @@ export declare abstract class AbstractCommand {
|
|
|
15
16
|
private registryAuthFailed;
|
|
16
17
|
private systemPackages;
|
|
17
18
|
private trmDependenciesCheck;
|
|
18
|
-
constructor(program: Command, name: string, aliases?: string[]);
|
|
19
|
+
constructor(program: Command, name: string, aliases?: string[], subcommand?: string);
|
|
19
20
|
getCliVersionStatus(): Promise<CliVersionStatus>;
|
|
20
21
|
getRegistry(): Core.AbstractRegistry;
|
|
21
22
|
hasRegistryAuthData(): boolean;
|
|
@@ -57,13 +57,28 @@ const chalk_1 = __importDefault(require("chalk"));
|
|
|
57
57
|
const prompts_1 = require("./prompts");
|
|
58
58
|
const fs_1 = require("fs");
|
|
59
59
|
class AbstractCommand {
|
|
60
|
-
constructor(program, name, aliases) {
|
|
60
|
+
constructor(program, name, aliases, subcommand) {
|
|
61
61
|
this.name = name;
|
|
62
62
|
this.aliases = aliases;
|
|
63
|
+
this.subcommand = subcommand;
|
|
63
64
|
this.registerOpts = {};
|
|
64
65
|
this.args = {};
|
|
65
66
|
this.registryAuthData = false;
|
|
66
|
-
|
|
67
|
+
const index = program.commands.findIndex(c => c.name() === this.name);
|
|
68
|
+
if (index >= 0) {
|
|
69
|
+
if (subcommand) {
|
|
70
|
+
this.command = program.commands[index];
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
throw new Error(`Command "${this.name}" declared multiple times without subcommand.`);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
this.command = program.command(this.name);
|
|
78
|
+
}
|
|
79
|
+
if (this.subcommand) {
|
|
80
|
+
this.command = this.command.command(this.subcommand);
|
|
81
|
+
}
|
|
67
82
|
if (aliases) {
|
|
68
83
|
this.command.aliases(aliases);
|
|
69
84
|
}
|
|
@@ -317,7 +332,9 @@ class AbstractCommand {
|
|
|
317
332
|
if (process.platform !== 'win32' && process.platform !== 'darwin') {
|
|
318
333
|
Commons.Logger.warning(`Running on untested OS "${process.platform}"! Some features aren't tested yet.`);
|
|
319
334
|
}
|
|
320
|
-
|
|
335
|
+
if (!this.registerOpts.noClientVersionCheck) {
|
|
336
|
+
yield this.getCliVersionStatus();
|
|
337
|
+
}
|
|
321
338
|
if (this.registerOpts.requiresRegistry) {
|
|
322
339
|
var registryAlias;
|
|
323
340
|
var registry;
|
|
@@ -17,16 +17,16 @@ const systemAlias_1 = require("../../systemAlias");
|
|
|
17
17
|
const utils_1 = require("../../utils");
|
|
18
18
|
class Alias extends AbstractCommand_1.AbstractCommand {
|
|
19
19
|
init() {
|
|
20
|
-
if (this.
|
|
20
|
+
if (this.subcommand === 'create') {
|
|
21
21
|
this.command.description(`Create a new system alias.`);
|
|
22
22
|
this.command.argument(`<alias>`, `Alias name.`);
|
|
23
23
|
}
|
|
24
|
-
else if (this.
|
|
24
|
+
else if (this.subcommand === 'delete') {
|
|
25
25
|
this.command.description(`Delete a system alias.`);
|
|
26
26
|
this.command.argument(`<alias>`, `Alias name.`);
|
|
27
27
|
}
|
|
28
28
|
else {
|
|
29
|
-
this.command.description(`
|
|
29
|
+
this.command.description(`Manage system aliases.`);
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
view(alias) {
|
|
@@ -87,10 +87,10 @@ class Alias extends AbstractCommand_1.AbstractCommand {
|
|
|
87
87
|
}
|
|
88
88
|
handler() {
|
|
89
89
|
return __awaiter(this, void 0, void 0, function* () {
|
|
90
|
-
if (this.
|
|
90
|
+
if (this.subcommand === 'create') {
|
|
91
91
|
yield (0, prompts_1.createAlias)(this.args.alias);
|
|
92
92
|
}
|
|
93
|
-
else if (this.
|
|
93
|
+
else if (this.subcommand === 'delete') {
|
|
94
94
|
yield (0, prompts_1.deleteAlias)(this.args.alias);
|
|
95
95
|
}
|
|
96
96
|
else {
|
|
@@ -10,6 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.Deprecate = void 0;
|
|
13
|
+
const trm_commons_1 = require("trm-commons");
|
|
13
14
|
const AbstractCommand_1 = require("../AbstractCommand");
|
|
14
15
|
class Deprecate extends AbstractCommand_1.AbstractCommand {
|
|
15
16
|
init() {
|
|
@@ -27,6 +28,7 @@ class Deprecate extends AbstractCommand_1.AbstractCommand {
|
|
|
27
28
|
yield this.getRegistry().deprecate(this.args.package, this.args.version, {
|
|
28
29
|
deprecate_note: this.args.note
|
|
29
30
|
});
|
|
31
|
+
trm_commons_1.Logger.success(`${this.args.package} v${this.args.version} has just been deprecated`);
|
|
30
32
|
});
|
|
31
33
|
}
|
|
32
34
|
}
|
|
@@ -10,17 +10,18 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.DistTag = void 0;
|
|
13
|
+
const trm_commons_1 = require("trm-commons");
|
|
13
14
|
const AbstractCommand_1 = require("../AbstractCommand");
|
|
14
15
|
class DistTag extends AbstractCommand_1.AbstractCommand {
|
|
15
16
|
init() {
|
|
16
17
|
this.registerOpts.requiresRegistry = true;
|
|
17
|
-
if (this.
|
|
18
|
+
if (this.subcommand === 'add') {
|
|
18
19
|
this.command.description(`Tag a release.`);
|
|
19
20
|
this.command.argument(`<package>`, `Name of the package.`);
|
|
20
21
|
this.command.argument(`<version>`, `Release version of the package.`);
|
|
21
22
|
this.command.argument(`<tag>`, `Tag to assign to release.`);
|
|
22
23
|
}
|
|
23
|
-
else if (this.
|
|
24
|
+
else if (this.subcommand === 'rm') {
|
|
24
25
|
this.command.description(`Remove tag from a release.`);
|
|
25
26
|
this.command.argument(`<package>`, `Name of the package.`);
|
|
26
27
|
this.command.argument(`<tag>`, `Tag to remove.`);
|
|
@@ -28,19 +29,18 @@ class DistTag extends AbstractCommand_1.AbstractCommand {
|
|
|
28
29
|
}
|
|
29
30
|
handler() {
|
|
30
31
|
return __awaiter(this, void 0, void 0, function* () {
|
|
31
|
-
if (this.
|
|
32
|
+
if (this.subcommand === 'add') {
|
|
32
33
|
yield this.getRegistry().addDistTag(this.args.package, {
|
|
33
34
|
version: this.args.version,
|
|
34
35
|
tag: this.args.tag
|
|
35
36
|
});
|
|
37
|
+
trm_commons_1.Logger.success(`${this.args.package} v${this.args.version} tagged "${this.args.tag}"`);
|
|
36
38
|
}
|
|
37
|
-
else if (this.
|
|
39
|
+
else if (this.subcommand === 'rm') {
|
|
38
40
|
yield this.getRegistry().rmDistTag(this.args.package, {
|
|
39
41
|
tag: this.args.tag
|
|
40
42
|
});
|
|
41
|
-
|
|
42
|
-
else {
|
|
43
|
-
throw new Error(`Unknown command.`);
|
|
43
|
+
trm_commons_1.Logger.success(`${this.args.package} removed tag "${this.args.tag}"`);
|
|
44
44
|
}
|
|
45
45
|
});
|
|
46
46
|
}
|
|
@@ -124,7 +124,9 @@ class Install extends AbstractCommand_1.AbstractCommand {
|
|
|
124
124
|
}
|
|
125
125
|
onArgs() {
|
|
126
126
|
if (this.name === 'update' && !this.args.package) {
|
|
127
|
-
this.registerOpts = {
|
|
127
|
+
this.registerOpts = {
|
|
128
|
+
noClientVersionCheck: true
|
|
129
|
+
};
|
|
128
130
|
}
|
|
129
131
|
}
|
|
130
132
|
onTrmDepVersionNotSatisfied(trmPackage) {
|
|
@@ -17,11 +17,11 @@ const registryAlias_1 = require("../../registryAlias");
|
|
|
17
17
|
class Registry extends AbstractCommand_1.AbstractCommand {
|
|
18
18
|
init() {
|
|
19
19
|
this.registerOpts.requiresRegistry = true;
|
|
20
|
-
if (this.
|
|
20
|
+
if (this.subcommand === 'add') {
|
|
21
21
|
this.command.description(`Add a new registry.`);
|
|
22
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
23
|
}
|
|
24
|
-
else if (this.
|
|
24
|
+
else if (this.subcommand === 'rm') {
|
|
25
25
|
this.command.description(`Remove a registry.`);
|
|
26
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
27
|
}
|
|
@@ -30,7 +30,7 @@ class Registry extends AbstractCommand_1.AbstractCommand {
|
|
|
30
30
|
handler() {
|
|
31
31
|
return __awaiter(this, void 0, void 0, function* () {
|
|
32
32
|
const registryName = this.args.registryName.trim();
|
|
33
|
-
if (this.
|
|
33
|
+
if (this.subcommand === 'add') {
|
|
34
34
|
var endpoint = this.args.endpoint;
|
|
35
35
|
if (registryName.toLowerCase() === trm_core_1.PUBLIC_RESERVED_KEYWORD) {
|
|
36
36
|
throw new Error(`Registry name "${trm_core_1.PUBLIC_RESERVED_KEYWORD}" is a reserved keyword.`);
|
|
@@ -68,7 +68,7 @@ class Registry extends AbstractCommand_1.AbstractCommand {
|
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
|
-
else if (this.
|
|
71
|
+
else if (this.subcommand === 'rm') {
|
|
72
72
|
if (registryName.toLowerCase() === trm_core_1.PUBLIC_RESERVED_KEYWORD) {
|
|
73
73
|
throw new Error(`Registry "${trm_core_1.PUBLIC_RESERVED_KEYWORD}" is protected and cannot be deleted.`);
|
|
74
74
|
}
|
|
@@ -79,9 +79,6 @@ class Registry extends AbstractCommand_1.AbstractCommand {
|
|
|
79
79
|
registryAlias_1.RegistryAlias.delete(registryName);
|
|
80
80
|
trm_commons_1.Logger.success(`Registry "${registryName}" has been removed.`);
|
|
81
81
|
}
|
|
82
|
-
else {
|
|
83
|
-
throw new Error(`Unknown command.`);
|
|
84
|
-
}
|
|
85
82
|
});
|
|
86
83
|
}
|
|
87
84
|
}
|
package/dist/index.js
CHANGED
|
@@ -23,17 +23,17 @@ Public registry at https://trmregistry.com/
|
|
|
23
23
|
.version((0, utils_1.getClientVersion)());
|
|
24
24
|
new implementations_1.Ping(program, 'ping').register();
|
|
25
25
|
new implementations_1.Info(program, 'info').register();
|
|
26
|
-
new implementations_1.Registry(program, 'registry add').register();
|
|
27
|
-
new implementations_1.Registry(program, 'registry rm').register();
|
|
26
|
+
new implementations_1.Registry(program, 'registry', null, 'add').register();
|
|
27
|
+
new implementations_1.Registry(program, 'registry', null, 'rm').register();
|
|
28
28
|
new implementations_1.Login(program, 'login').register();
|
|
29
29
|
new implementations_1.WhoAmI(program, 'whoami').register();
|
|
30
30
|
new implementations_1.Logout(program, 'logout').register();
|
|
31
|
-
new implementations_1.Alias(program, 'alias create').register();
|
|
32
|
-
new implementations_1.Alias(program, 'alias delete').register();
|
|
33
31
|
new implementations_1.Alias(program, 'alias').register();
|
|
32
|
+
new implementations_1.Alias(program, 'alias', null, 'create').register();
|
|
33
|
+
new implementations_1.Alias(program, 'alias', null, 'delete').register();
|
|
34
34
|
new implementations_1.Publish(program, 'publish').register();
|
|
35
|
-
new implementations_1.DistTag(program, 'dist-tag add').register();
|
|
36
|
-
new implementations_1.DistTag(program, 'dist-tag rm').register();
|
|
35
|
+
new implementations_1.DistTag(program, 'dist-tag', null, 'add').register();
|
|
36
|
+
new implementations_1.DistTag(program, 'dist-tag', null, 'rm').register();
|
|
37
37
|
new implementations_1.Publish(program, 'pack', ['export']).register();
|
|
38
38
|
new implementations_1.Lock(program, 'lock', ['lock-file']).register();
|
|
39
39
|
new implementations_1.Unpublish(program, 'unpublish').register();
|