@oclif/plugin-version 1.0.4 → 1.1.2

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 CHANGED
@@ -2,6 +2,35 @@
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.2](https://github.com/oclif/plugin-version/compare/v1.1.1...v1.1.2) (2022-08-18)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * bump some versions ([c2d19d6](https://github.com/oclif/plugin-version/commit/c2d19d68bbb755fd844efff3ab9edb1469cd222b))
11
+ * export the Version command and the VersionDetail interface. Enhance the verbose details to include the shell and root path. ([fcf6aaf](https://github.com/oclif/plugin-version/commit/fcf6aafdfb7336e982d246753a0f2f72c5383629))
12
+ * relax the unit test expecations ([a6c913b](https://github.com/oclif/plugin-version/commit/a6c913b523962b95d1b9fc121be2f2d1a575c55f))
13
+
14
+ ### [1.1.1](https://github.com/oclif/plugin-version/compare/v1.1.0...v1.1.1) (2022-06-27)
15
+
16
+
17
+ ### Bug Fixes
18
+
19
+ * add --json flag ([47d7105](https://github.com/oclif/plugin-version/commit/47d7105a4bd36f8bed8d4772485c4f5eef0fdacd))
20
+ * suggestions on how to improve PR [#70](https://github.com/oclif/plugin-version/issues/70) ([4023f70](https://github.com/oclif/plugin-version/commit/4023f708204ca940b905cf98e43c0fce72a97307))
21
+
22
+ ## [1.1.0](https://github.com/oclif/plugin-version/compare/v1.0.4...v1.1.0) (2022-06-13)
23
+
24
+
25
+ ### Features
26
+
27
+ * allow getting more info from version command ([b47a1fd](https://github.com/oclif/plugin-version/commit/b47a1fd83cc09f179e1594e94291051a043caaa8))
28
+
29
+
30
+ ### Bug Fixes
31
+
32
+ * unit tests & lint ([a7037af](https://github.com/oclif/plugin-version/commit/a7037af4220d06f0f1ff63e09d837e2fe06568e5))
33
+
5
34
  ### [1.0.4](https://github.com/oclif/plugin-version/compare/v1.0.3...v1.0.4) (2022-01-06)
6
35
 
7
36
 
@@ -1,4 +1,18 @@
1
1
  import { Command } from '@oclif/core';
2
+ export interface VersionDetail {
3
+ cliVersion: string;
4
+ architecture: string;
5
+ nodeVersion: string;
6
+ pluginVersions?: string[];
7
+ osVersion?: string;
8
+ shell?: string;
9
+ rootPath?: string;
10
+ }
2
11
  export default class Version extends Command {
3
- run(): Promise<void>;
12
+ static enableJsonFlag: boolean;
13
+ static flags: {
14
+ verbose: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
15
+ };
16
+ run(): Promise<VersionDetail>;
17
+ private getFriendlyName;
4
18
  }
@@ -1,9 +1,65 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const core_1 = require("@oclif/core");
4
+ const node_os_1 = require("node:os");
4
5
  class Version extends core_1.Command {
5
6
  async run() {
6
- process.stdout.write(this.config.userAgent + '\n');
7
+ const { flags } = await this.parse(Version);
8
+ const [cliVersion, architecture, nodeVersion] = this.config.userAgent.split(' ');
9
+ const versionDetail = { cliVersion, architecture, nodeVersion };
10
+ let output = `${this.config.userAgent}`;
11
+ if (flags.verbose) {
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
+ }
18
+ const osVersion = `${(0, node_os_1.type)()} ${(0, node_os_1.release)()}`;
19
+ versionDetail.pluginVersions = pluginVersions;
20
+ versionDetail.osVersion = osVersion;
21
+ versionDetail.shell = this.config.shell;
22
+ versionDetail.rootPath = this.config.root;
23
+ output = ` CLI Version:
24
+ \t${cliVersion}
25
+
26
+ Architecture:
27
+ \t${architecture}
28
+
29
+ Node Version:
30
+ \t${nodeVersion}
31
+
32
+ Plugin Version:
33
+ \t${pluginVersions.join(`${node_os_1.EOL}\t`)}
34
+
35
+ OS and Version:
36
+ \t${osVersion}
37
+
38
+ Shell:
39
+ \t${versionDetail.shell}
40
+
41
+ Root Path:
42
+ \t${versionDetail.rootPath}
43
+ `;
44
+ }
45
+ this.log(output);
46
+ return versionDetail;
47
+ }
48
+ getFriendlyName(name) {
49
+ const scope = this.config.pjson.oclif.scope;
50
+ if (!scope)
51
+ return name;
52
+ const match = name.match(`@${scope}/plugin-(.+)`);
53
+ if (!match)
54
+ return name;
55
+ return match[1];
7
56
  }
8
57
  }
9
58
  exports.default = Version;
59
+ Version.enableJsonFlag = true;
60
+ Version.flags = {
61
+ verbose: core_1.Flags.boolean({
62
+ summary: 'Show additional information about the CLI.',
63
+ description: 'Additionally shows the architecture, node version, operating system, and versions of plugins that the CLI is using.',
64
+ }),
65
+ };
package/lib/index.d.ts CHANGED
@@ -1,2 +1 @@
1
- declare const _default: {};
2
- export default _default;
1
+ export { VersionDetail, default as VersionCommand } from './commands/version';
package/lib/index.js CHANGED
@@ -1,3 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = {};
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 +1 @@
1
- {"version":"1.0.4","commands":{"version":{"id":"version","strict":true,"pluginName":"@oclif/plugin-version","pluginAlias":"@oclif/plugin-version","pluginType":"core","aliases":[],"flags":{},"args":[]}}}
1
+ {"version":"1.1.2","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
@@ -1,29 +1,30 @@
1
1
  {
2
2
  "name": "@oclif/plugin-version",
3
3
  "description": "A command that shows the CLI version",
4
- "version": "1.0.4",
4
+ "version": "1.1.2",
5
5
  "author": "Salesforce",
6
6
  "bugs": "https://github.com/oclif/plugin-version/issues",
7
7
  "dependencies": {
8
- "@oclif/core": "^1.1.1"
8
+ "@oclif/core": "^1.14.1"
9
9
  },
10
10
  "devDependencies": {
11
11
  "@commitlint/config-conventional": "^12.1.4",
12
- "@oclif/plugin-help": "5.1.10",
13
- "@oclif/test": "^2.0.3",
14
- "@types/chai": "^4.3.0",
12
+ "@oclif/plugin-help": "5.1.12",
13
+ "@oclif/test": "^2.1.1",
14
+ "@types/chai": "^4.3.1",
15
15
  "@types/mocha": "^8.0.0",
16
- "@types/node": "^14.0.26",
17
- "chai": "^4.2.0",
16
+ "@types/node": "^14.18.23",
17
+ "chai": "^4.3.6",
18
18
  "commitlint": "^12.1.4",
19
19
  "eslint": "^7.3.1",
20
20
  "eslint-config-oclif": "^4",
21
21
  "eslint-config-oclif-typescript": "^1.0.2",
22
22
  "husky": "6",
23
23
  "mocha": "^8.2.1",
24
- "oclif": "2.1.0",
25
- "ts-node": "^10.4.0",
26
- "typescript": "4.5.2"
24
+ "oclif": "2.7.0",
25
+ "shx": "^0.3.4",
26
+ "ts-node": "^10.9.1",
27
+ "typescript": "4.6.3"
27
28
  },
28
29
  "engines": {
29
30
  "node": ">=12.0.0"
@@ -46,9 +47,9 @@
46
47
  },
47
48
  "repository": "oclif/plugin-version",
48
49
  "scripts": {
49
- "build": "rm -rf lib && tsc",
50
+ "build": "shx rm -rf lib && tsc",
50
51
  "commitlint": "commitlint",
51
- "clean": "rm -f oclif.manifest.json",
52
+ "clean": "shx rm -f oclif.manifest.json",
52
53
  "lint": "eslint . --ext .ts --config .eslintrc",
53
54
  "pretest": "yarn build",
54
55
  "test": "mocha --forbid-only \"test/**/*.test.ts\"",