@oclif/plugin-version 1.3.10 → 2.0.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/README.md +1 -3
- package/lib/commands/version.js +22 -28
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -5
- package/oclif.lock +6399 -0
- package/oclif.manifest.json +22 -14
- package/package.json +35 -28
package/README.md
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
@oclif/plugin-version
|
|
2
|
-
======================
|
|
1
|
+
# @oclif/plugin-version
|
|
3
2
|
|
|
4
3
|
An oclif command that shows the CLI version
|
|
5
4
|
|
|
6
5
|
[](https://npmjs.org/package/@oclif/plugin-version)
|
|
7
|
-
[](https://circleci.com/gh/oclif/plugin-version/tree/main)
|
|
8
6
|
[](https://npmjs.org/package/@oclif/plugin-version)
|
|
9
7
|
[](https://github.com/oclif/plugin-version/blob/main/package.json)
|
package/lib/commands/version.js
CHANGED
|
@@ -1,19 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { Command, Flags } from '@oclif/core';
|
|
2
|
+
import { EOL } from 'node:os';
|
|
3
|
+
export default class Version extends Command {
|
|
4
|
+
static enableJsonFlag = true;
|
|
5
|
+
static flags = {
|
|
6
|
+
verbose: Flags.boolean({
|
|
7
|
+
description: 'Additionally shows the architecture, node version, operating system, and versions of plugins that the CLI is using.',
|
|
8
|
+
summary: 'Show additional information about the CLI.',
|
|
9
|
+
}),
|
|
10
|
+
};
|
|
8
11
|
async run() {
|
|
9
|
-
var _a, _b;
|
|
10
12
|
const { flags } = await this.parse(Version);
|
|
11
|
-
const
|
|
12
|
-
const versionDetail =
|
|
13
|
+
const { pluginVersions, ...theRest } = this.config.versionDetails;
|
|
14
|
+
const versionDetail = { ...theRest };
|
|
13
15
|
let output = `${this.config.userAgent}`;
|
|
14
16
|
if (flags.verbose) {
|
|
15
|
-
versionDetail.pluginVersions = this.formatPlugins(pluginVersions
|
|
16
|
-
|
|
17
|
+
versionDetail.pluginVersions = this.formatPlugins(pluginVersions ?? {});
|
|
18
|
+
versionDetail.shell ??= 'unknown';
|
|
17
19
|
output = ` CLI Version:
|
|
18
20
|
\t${versionDetail.cliVersion}
|
|
19
21
|
|
|
@@ -24,7 +26,7 @@ class Version extends core_1.Command {
|
|
|
24
26
|
\t${versionDetail.nodeVersion}
|
|
25
27
|
|
|
26
28
|
Plugin Version:
|
|
27
|
-
\t${flags.verbose ? (
|
|
29
|
+
\t${flags.verbose ? (versionDetail.pluginVersions ?? []).join(EOL + '\t') : ''}
|
|
28
30
|
|
|
29
31
|
OS and Version:
|
|
30
32
|
\t${versionDetail.osVersion}
|
|
@@ -37,22 +39,22 @@ class Version extends core_1.Command {
|
|
|
37
39
|
`;
|
|
38
40
|
}
|
|
39
41
|
this.log(output);
|
|
40
|
-
return flags.verbose
|
|
41
|
-
versionDetail
|
|
42
|
-
{
|
|
43
|
-
cliVersion: versionDetail.cliVersion,
|
|
42
|
+
return flags.verbose
|
|
43
|
+
? versionDetail
|
|
44
|
+
: {
|
|
44
45
|
architecture: versionDetail.architecture,
|
|
46
|
+
cliVersion: versionDetail.cliVersion,
|
|
45
47
|
nodeVersion: versionDetail.nodeVersion,
|
|
46
48
|
};
|
|
47
49
|
}
|
|
48
50
|
formatPlugins(plugins) {
|
|
49
51
|
return Object.entries(plugins)
|
|
50
|
-
.map(([name, plugin]) => (
|
|
52
|
+
.map(([name, plugin]) => ({ name, ...plugin }))
|
|
51
53
|
.sort((a, b) => (a.name > b.name ? 1 : -1))
|
|
52
|
-
.map(plugin => `${this.getFriendlyName(plugin.name)} ${plugin.version} (${plugin.type}) ${plugin.type === 'link' ? plugin.root : ''}`.trim());
|
|
54
|
+
.map((plugin) => `${this.getFriendlyName(plugin.name)} ${plugin.version} (${plugin.type}) ${plugin.type === 'link' ? plugin.root : ''}`.trim());
|
|
53
55
|
}
|
|
54
56
|
getFriendlyName(name) {
|
|
55
|
-
const scope = this.config.pjson.oclif
|
|
57
|
+
const { scope } = this.config.pjson.oclif;
|
|
56
58
|
if (!scope)
|
|
57
59
|
return name;
|
|
58
60
|
const match = name.match(`@${scope}/plugin-(.+)`);
|
|
@@ -61,11 +63,3 @@ class Version extends core_1.Command {
|
|
|
61
63
|
return match[1];
|
|
62
64
|
}
|
|
63
65
|
}
|
|
64
|
-
exports.default = Version;
|
|
65
|
-
Version.enableJsonFlag = true;
|
|
66
|
-
Version.flags = {
|
|
67
|
-
verbose: core_1.Flags.boolean({
|
|
68
|
-
summary: 'Show additional information about the CLI.',
|
|
69
|
-
description: 'Additionally shows the architecture, node version, operating system, and versions of plugins that the CLI is using.',
|
|
70
|
-
}),
|
|
71
|
-
};
|
package/lib/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { run } from '@oclif/core';
|
package/lib/index.js
CHANGED
|
@@ -1,5 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.VersionCommand = void 0;
|
|
4
|
-
var version_1 = require("./commands/version");
|
|
5
|
-
Object.defineProperty(exports, "VersionCommand", { enumerable: true, get: function () { return version_1.default; } });
|
|
1
|
+
export { run } from '@oclif/core';
|