@oclif/plugin-commands 4.0.15 → 4.0.17
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/README.md +2 -2
- package/lib/commands/commands.js +8 -9
- package/oclif.manifest.json +1 -1
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -21,7 +21,7 @@ $ npm install -g @oclif/plugin-commands
|
|
|
21
21
|
$ oclif-example COMMAND
|
|
22
22
|
running command...
|
|
23
23
|
$ oclif-example (--version)
|
|
24
|
-
@oclif/plugin-commands/4.0.
|
|
24
|
+
@oclif/plugin-commands/4.0.17 linux-x64 node-v20.17.0
|
|
25
25
|
$ oclif-example --help [COMMAND]
|
|
26
26
|
USAGE
|
|
27
27
|
$ oclif-example COMMAND
|
|
@@ -61,7 +61,7 @@ DESCRIPTION
|
|
|
61
61
|
List all oclif-example commands.
|
|
62
62
|
```
|
|
63
63
|
|
|
64
|
-
_See code: [src/commands/commands.ts](https://github.com/oclif/plugin-commands/blob/v4.0.
|
|
64
|
+
_See code: [src/commands/commands.ts](https://github.com/oclif/plugin-commands/blob/v4.0.17/src/commands/commands.ts)_
|
|
65
65
|
<!-- commandsstop -->
|
|
66
66
|
|
|
67
67
|
# Contributing
|
package/lib/commands/commands.js
CHANGED
|
@@ -31,6 +31,12 @@ function determineHeaders(columns, extended) {
|
|
|
31
31
|
}
|
|
32
32
|
return [columnConfigs.id, columnConfigs.summary];
|
|
33
33
|
}
|
|
34
|
+
// In order to collect static properties up the inheritance chain, we need to recursively access the prototypes until there's nothing left
|
|
35
|
+
function mergePrototype(result, command) {
|
|
36
|
+
const proto = Object.getPrototypeOf(command);
|
|
37
|
+
const filteredProto = _.pickBy(proto, (v) => v !== undefined);
|
|
38
|
+
return Object.keys(proto).length > 0 ? mergePrototype({ ...filteredProto, ...result }, proto) : result;
|
|
39
|
+
}
|
|
34
40
|
export default class Commands extends Command {
|
|
35
41
|
static description = 'List all <%= config.bin %> commands.';
|
|
36
42
|
static enableJsonFlag = true;
|
|
@@ -114,16 +120,9 @@ export default class Commands extends Command {
|
|
|
114
120
|
}
|
|
115
121
|
catch (error) {
|
|
116
122
|
this.debug(error);
|
|
123
|
+
return cmd;
|
|
117
124
|
}
|
|
118
|
-
const obj = { ...
|
|
119
|
-
// Load all properties on all extending classes.
|
|
120
|
-
while (commandClass !== undefined) {
|
|
121
|
-
commandClass = Object.getPrototypeOf(commandClass) ?? undefined;
|
|
122
|
-
// ES2022 will return all unset static properties on the prototype as undefined. This is different from ES2021
|
|
123
|
-
// which only returns the static properties that are set by defaults. In order to prevent
|
|
124
|
-
// Object.assign from overwriting the properties on the object, we need to filter out the undefined values.
|
|
125
|
-
Object.assign(obj, _.pickBy(commandClass, (v) => v !== undefined));
|
|
126
|
-
}
|
|
125
|
+
const obj = { ...mergePrototype(commandClass, commandClass), ...cmd };
|
|
127
126
|
// The plugin property on the loaded class contains a LOT of information including all the commands again. Remove it.
|
|
128
127
|
delete obj.plugin;
|
|
129
128
|
// If Command classes have circular references, don't break the commands command.
|
package/oclif.manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oclif/plugin-commands",
|
|
3
3
|
"description": "plugin to show the list of all the commands",
|
|
4
|
-
"version": "4.0.
|
|
4
|
+
"version": "4.0.17",
|
|
5
5
|
"author": "Salesforce",
|
|
6
6
|
"bugs": "https://github.com/oclif/plugin-commands/issues",
|
|
7
7
|
"dependencies": {
|
|
@@ -16,26 +16,26 @@
|
|
|
16
16
|
"@oclif/prettier-config": "^0.2.1",
|
|
17
17
|
"@oclif/test": "^4.0.9",
|
|
18
18
|
"@types/chai": "^4.3.17",
|
|
19
|
-
"@types/lodash": "^4.17.
|
|
19
|
+
"@types/lodash": "^4.17.9",
|
|
20
20
|
"@types/mocha": "^10.0.7",
|
|
21
21
|
"@types/node": "^18",
|
|
22
22
|
"@types/sinon": "^17.0.3",
|
|
23
23
|
"chai": "^4.5.0",
|
|
24
24
|
"commitlint": "^19",
|
|
25
|
-
"eslint": "^8.57.
|
|
25
|
+
"eslint": "^8.57.1",
|
|
26
26
|
"eslint-config-oclif": "^5.2.1",
|
|
27
27
|
"eslint-config-oclif-typescript": "^3.1.10",
|
|
28
28
|
"eslint-config-prettier": "^9.1.0",
|
|
29
|
-
"husky": "^9.1.
|
|
29
|
+
"husky": "^9.1.6",
|
|
30
30
|
"lint-staged": "^15",
|
|
31
31
|
"mocha": "^10.7.3",
|
|
32
32
|
"nyc": "^15.1.0",
|
|
33
|
-
"oclif": "^4.14.
|
|
33
|
+
"oclif": "^4.14.35",
|
|
34
34
|
"prettier": "^3.3.3",
|
|
35
35
|
"shx": "^0.3.3",
|
|
36
|
-
"sinon": "^18.0.
|
|
36
|
+
"sinon": "^18.0.1",
|
|
37
37
|
"ts-node": "^10.9.2",
|
|
38
|
-
"typescript": "^5.
|
|
38
|
+
"typescript": "^5.6.2"
|
|
39
39
|
},
|
|
40
40
|
"engines": {
|
|
41
41
|
"node": ">=18.0.0"
|