@oclif/core 2.5.2 → 2.6.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,5 +1,5 @@
1
1
  import { Options, Plugin as IPlugin } from '../interfaces/plugin';
2
- import { Config as IConfig, ArchTypes, PlatformTypes, LoadOptions } from '../interfaces/config';
2
+ import { Config as IConfig, ArchTypes, PlatformTypes, LoadOptions, VersionDetails } from '../interfaces/config';
3
3
  import { Hook, Hooks, PJSON, Topic } from '../interfaces';
4
4
  import * as Plugin from './plugin';
5
5
  import { Command } from '../command';
@@ -89,6 +89,7 @@ export declare class Config implements IConfig {
89
89
  get commands(): Command.Loadable[];
90
90
  get commandIDs(): string[];
91
91
  get topics(): Topic[];
92
+ get versionDetails(): VersionDetails;
92
93
  s3Key(type: keyof PJSON.S3.Templates, ext?: '.tar.gz' | '.tar.xz' | IConfig.s3Key.Options, options?: IConfig.s3Key.Options): string;
93
94
  s3Url(key: string): string;
94
95
  protected dir(category: 'cache' | 'data' | 'config'): string;
@@ -416,6 +416,18 @@ class Config {
416
416
  get topics() {
417
417
  return [...this._topics.values()];
418
418
  }
419
+ get versionDetails() {
420
+ const [cliVersion, architecture, nodeVersion] = this.userAgent.split(' ');
421
+ return {
422
+ cliVersion,
423
+ architecture,
424
+ nodeVersion,
425
+ pluginVersions: Object.fromEntries(this.plugins.map(p => [p.name, { version: p.version, type: p.type, root: p.root }])),
426
+ osVersion: `${os.type()} ${os.release()}`,
427
+ shell: this.shell,
428
+ rootPath: this.root,
429
+ };
430
+ }
419
431
  s3Key(type, ext, options = {}) {
420
432
  if (typeof ext === 'object')
421
433
  options = ext;
@@ -6,6 +6,19 @@ import { Command } from '../command';
6
6
  export type LoadOptions = Options | string | Config | undefined;
7
7
  export type PlatformTypes = 'darwin' | 'linux' | 'win32' | 'aix' | 'freebsd' | 'openbsd' | 'sunos' | 'wsl';
8
8
  export type ArchTypes = 'arm' | 'arm64' | 'mips' | 'mipsel' | 'ppc' | 'ppc64' | 's390' | 's390x' | 'x32' | 'x64' | 'x86';
9
+ export type VersionDetails = {
10
+ cliVersion: string;
11
+ architecture: string;
12
+ nodeVersion: string;
13
+ pluginVersions?: Record<string, {
14
+ version: string;
15
+ type: string;
16
+ root: string;
17
+ }>;
18
+ osVersion?: string;
19
+ shell?: string;
20
+ rootPath?: string;
21
+ };
9
22
  export interface Config {
10
23
  name: string;
11
24
  version: string;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@oclif/core",
3
3
  "description": "base library for oclif CLIs",
4
- "version": "2.5.2",
4
+ "version": "2.6.0",
5
5
  "author": "Salesforce",
6
6
  "bugs": "https://github.com/oclif/core/issues",
7
7
  "dependencies": {