@oclif/plugin-version 1.1.0 → 1.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.md +8 -0
- package/lib/commands/version.d.ts +11 -1
- package/lib/commands/version.js +36 -14
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [1.1.1](https://github.com/oclif/plugin-version/compare/v1.1.0...v1.1.1) (2022-06-27)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* add --json flag ([47d7105](https://github.com/oclif/plugin-version/commit/47d7105a4bd36f8bed8d4772485c4f5eef0fdacd))
|
|
11
|
+
* suggestions on how to improve PR [#70](https://github.com/oclif/plugin-version/issues/70) ([4023f70](https://github.com/oclif/plugin-version/commit/4023f708204ca940b905cf98e43c0fce72a97307))
|
|
12
|
+
|
|
5
13
|
## [1.1.0](https://github.com/oclif/plugin-version/compare/v1.0.4...v1.1.0) (2022-06-13)
|
|
6
14
|
|
|
7
15
|
|
|
@@ -1,7 +1,17 @@
|
|
|
1
1
|
import { Command } from '@oclif/core';
|
|
2
|
+
interface VersionDetail {
|
|
3
|
+
cliVersion: string;
|
|
4
|
+
architecture: string;
|
|
5
|
+
nodeVersion: string;
|
|
6
|
+
pluginVersions?: string[];
|
|
7
|
+
osVersion?: string;
|
|
8
|
+
}
|
|
2
9
|
export default class Version extends Command {
|
|
10
|
+
static enableJsonFlag: boolean;
|
|
3
11
|
static flags: {
|
|
4
12
|
verbose: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
5
13
|
};
|
|
6
|
-
run(): Promise<
|
|
14
|
+
run(): Promise<VersionDetail>;
|
|
15
|
+
private getFriendlyName;
|
|
7
16
|
}
|
|
17
|
+
export {};
|
package/lib/commands/version.js
CHANGED
|
@@ -5,28 +5,50 @@ const node_os_1 = require("node:os");
|
|
|
5
5
|
class Version extends core_1.Command {
|
|
6
6
|
async run() {
|
|
7
7
|
const { flags } = await this.parse(Version);
|
|
8
|
-
|
|
8
|
+
const [cliVersion, architecture, nodeVersion] = this.config.userAgent.split(' ');
|
|
9
|
+
const versionDetail = { cliVersion, architecture, nodeVersion };
|
|
10
|
+
let output = `${this.config.userAgent}`;
|
|
9
11
|
if (flags.verbose) {
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
for (const plugin of this.config.plugins) {
|
|
16
|
-
pluginVersions += `${node_os_1.EOL}\t${plugin.name}@${plugin.version} (${plugin.type})`;
|
|
12
|
+
const pluginVersions = [];
|
|
13
|
+
for (const plugin of this.config.plugins.sort((a, b) => a.name > b.name ? 1 : -1)) {
|
|
14
|
+
if (this.config.name !== plugin.name) {
|
|
15
|
+
pluginVersions.push(`${this.getFriendlyName(plugin.name)} ${plugin.version} (${plugin.type}) ${plugin.type === 'link' ? plugin.root : ''}`.trim());
|
|
16
|
+
}
|
|
17
17
|
}
|
|
18
18
|
const osVersion = `${(0, node_os_1.type)()} ${(0, node_os_1.release)()}`;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
${
|
|
23
|
-
|
|
19
|
+
versionDetail.pluginVersions = pluginVersions;
|
|
20
|
+
versionDetail.osVersion = osVersion;
|
|
21
|
+
output = ` CLI Version:
|
|
22
|
+
\t${cliVersion}
|
|
23
|
+
|
|
24
|
+
Architecture:
|
|
25
|
+
\t${architecture}
|
|
26
|
+
|
|
27
|
+
Node Version:
|
|
28
|
+
\t${nodeVersion}
|
|
29
|
+
|
|
30
|
+
Plugin Version:
|
|
31
|
+
\t${pluginVersions.join(`${node_os_1.EOL}\t`)}
|
|
32
|
+
|
|
33
|
+
OS and Version:
|
|
34
|
+
\t${osVersion}
|
|
24
35
|
`;
|
|
25
36
|
}
|
|
26
|
-
|
|
37
|
+
this.log(output);
|
|
38
|
+
return versionDetail;
|
|
39
|
+
}
|
|
40
|
+
getFriendlyName(name) {
|
|
41
|
+
const scope = this.config.pjson.oclif.scope;
|
|
42
|
+
if (!scope)
|
|
43
|
+
return name;
|
|
44
|
+
const match = name.match(`@${scope}/plugin-(.+)`);
|
|
45
|
+
if (!match)
|
|
46
|
+
return name;
|
|
47
|
+
return match[1];
|
|
27
48
|
}
|
|
28
49
|
}
|
|
29
50
|
exports.default = Version;
|
|
51
|
+
Version.enableJsonFlag = true;
|
|
30
52
|
Version.flags = {
|
|
31
53
|
verbose: core_1.Flags.boolean({
|
|
32
54
|
summary: 'Show additional information about the CLI.',
|
package/oclif.manifest.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"1.1.
|
|
1
|
+
{"version":"1.1.1","commands":{"version":{"id":"version","strict":true,"pluginName":"@oclif/plugin-version","pluginAlias":"@oclif/plugin-version","pluginType":"core","aliases":[],"flags":{"json":{"name":"json","type":"boolean","description":"Format output as json.","helpGroup":"GLOBAL","allowNo":false},"verbose":{"name":"verbose","type":"boolean","summary":"Show additional information about the CLI.","description":"Additionally shows the architecture, node version, operating system, and versions of plugins that the CLI is using.","allowNo":false}},"args":[],"enableJsonFlag":true,"_globalFlags":{"json":{"description":"Format output as json.","helpGroup":"GLOBAL","allowNo":false,"type":"boolean"}}}}}
|
package/package.json
CHANGED