@oclif/plugin-version 1.3.9 → 1.3.11-qa.0

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.
@@ -1,19 +1,21 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- const core_1 = require("@oclif/core");
5
- // eslint-disable-next-line unicorn/prefer-node-protocol
6
- const os_1 = require("os");
7
- class Version extends core_1.Command {
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 _c = this.config.versionDetails, { pluginVersions } = _c, theRest = tslib_1.__rest(_c, ["pluginVersions"]);
12
- const versionDetail = Object.assign({}, theRest);
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 !== null && pluginVersions !== void 0 ? pluginVersions : {});
16
- (_a = versionDetail.shell) !== null && _a !== void 0 ? _a : (versionDetail.shell = 'unknown');
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 ? ((_b = versionDetail.pluginVersions) !== null && _b !== void 0 ? _b : []).join(os_1.EOL + '\t') : ''}
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]) => (Object.assign({ 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.scope;
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 { VersionDetail, default as VersionCommand } from './commands/version';
1
+ export { run } from '@oclif/core';
package/lib/index.js CHANGED
@@ -1,5 +1 @@
1
- "use strict";
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';