Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"semver": "^7.8.1"
},
"devDependencies": {
"@oclif/plugin-command-snapshot": "^5.3.30",
"@oclif/plugin-command-snapshot": "^5.3.31",
"@salesforce/cli-plugins-testkit": "^5.3.62",
"@salesforce/dev-scripts": "^11.0.4",
"@salesforce/plugin-command-reference": "^3.1.120",
Expand Down
204 changes: 204 additions & 0 deletions schemas/doctor.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,204 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$ref": "#/definitions/SfDoctorDiagnosis",
"definitions": {
"SfDoctorDiagnosis": {
"type": "object",
"properties": {
"versionDetail": {
"type": "object",
"additionalProperties": false,
"properties": {
"pluginVersions": {
"type": "array",
"items": {
"type": "string"
}
},
"architecture": {
"type": "string"
},
"cliVersion": {
"type": "string"
},
"nodeVersion": {
"type": "string"
},
"osVersion": {
"type": "string"
},
"rootPath": {
"type": "string"
},
"shell": {
"type": "string"
}
},
"required": ["architecture", "cliVersion", "nodeVersion", "pluginVersions"]
},
"sfdxEnvVars": {
"type": "array",
"items": {
"$ref": "#/definitions/KeyValue%3Cstring%3E"
}
},
"sfEnvVars": {
"type": "array",
"items": {
"$ref": "#/definitions/KeyValue%3Cstring%3E"
}
},
"proxyEnvVars": {
"type": "array",
"items": {
"$ref": "#/definitions/KeyValue%3Cstring%3E"
}
},
"cliConfig": {
"type": "object",
"properties": {
"bin": {
"type": "string"
},
"nodeEngine": {
"type": "string"
},
"windows": {
"type": "boolean"
},
"userAgent": {
"type": "string"
},
"shell": {
"type": "string"
},
"channel": {
"type": "string"
}
},
"required": ["bin", "channel", "nodeEngine", "shell", "userAgent", "windows"]
},
"pluginSpecificData": {
"type": "object",
"additionalProperties": {
"type": "array",
"items": {
"$ref": "#/definitions/AnyJson"
}
}
},
"diagnosticResults": {
"type": "array",
"items": {
"$ref": "#/definitions/DiagnosticStatus"
}
},
"suggestions": {
"type": "array",
"items": {
"type": "string"
}
},
"commandName": {
"type": "string"
},
"commandExitCode": {
"type": ["string", "number"]
},
"logFilePaths": {
"type": "array",
"items": {
"type": "string"
}
}
},
"required": [
"versionDetail",
"sfdxEnvVars",
"sfEnvVars",
"proxyEnvVars",
"cliConfig",
"pluginSpecificData",
"diagnosticResults",
"suggestions",
"logFilePaths"
],
"additionalProperties": false
},
"KeyValue<string>": {
"type": "array",
"items": {
"type": "string"
},
"minItems": 2,
"maxItems": 2,
"description": "An alias for a tuple of type `[string, T]' for a given generic type `T`. `T` defaults to `unknown` if not otherwise defined."
},
"AnyJson": {
"anyOf": [
{
"$ref": "#/definitions/JsonPrimitive"
},
{
"$ref": "#/definitions/JsonCollection"
}
],
"description": "Any valid JSON value."
},
"JsonPrimitive": {
"type": ["null", "boolean", "number", "string"],
"description": "Any valid JSON primitive value."
},
"JsonCollection": {
"anyOf": [
{
"$ref": "#/definitions/JsonMap"
},
{
"$ref": "#/definitions/JsonArray"
}
],
"description": "Any valid JSON collection value."
},
"JsonMap": {
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/Optional%3CAnyJson%3E"
},
"properties": {},
"description": "Any JSON-compatible object."
},
"Optional<AnyJson>": {
"anyOf": [
{
"$ref": "#/definitions/AnyJson"
},
{
"not": {}
}
],
"description": "A union type for either the parameterized type `T` or `undefined` -- the opposite of {@link NonOptional } ."
},
"JsonArray": {
"type": "array",
"items": {
"$ref": "#/definitions/AnyJson"
},
"description": "Any JSON-compatible array."
},
"DiagnosticStatus": {
"type": "object",
"properties": {
"testName": {
"type": "string"
},
"status": {
"type": "string",
"enum": ["pass", "fail", "warn", "unknown"]
}
},
"required": ["testName", "status"],
"additionalProperties": false
}
}
}
26 changes: 26 additions & 0 deletions schemas/info-releasenotes-display.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$ref": "#/definitions/DisplayOutput",
"definitions": {
"DisplayOutput": {
"anyOf": [
{
"type": "object",
"properties": {
"body": {
"type": "string"
},
"url": {
"type": "string"
}
},
"required": ["body", "url"],
"additionalProperties": false
},
{
"not": {}
}
]
}
}
}
14 changes: 8 additions & 6 deletions src/commands/info/releasenotes/display.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const helpers = ['stable', 'stable-rc', 'latest', 'latest-rc', 'rc'];
// or any library that is using the messages framework can also be loaded this way.
const messages = Messages.loadMessages('@salesforce/plugin-info', 'display');

export default class Display extends SfCommand<DisplayOutput | undefined> {
export default class Display extends SfCommand<DisplayOutput> {
public static readonly summary = messages.getMessage('summary');
public static readonly description = messages.getMessage('description');

Expand All @@ -53,7 +53,7 @@ export default class Display extends SfCommand<DisplayOutput | undefined> {
loglevel,
};

public async run(): Promise<DisplayOutput | undefined> {
public async run(): Promise<DisplayOutput> {
const HIDE_NOTES = this.config.bin === 'sf' ? 'SF_HIDE_RELEASE_NOTES' : 'SFDX_HIDE_RELEASE_NOTES';
const HIDE_FOOTER = this.config.bin === 'sf' ? 'SF_HIDE_RELEASE_NOTES_FOOTER' : 'SFDX_HIDE_RELEASE_NOTES_FOOTER';

Expand Down Expand Up @@ -142,7 +142,9 @@ export default class Display extends SfCommand<DisplayOutput | undefined> {
}
}

export type DisplayOutput = {
body: string;
url: string;
};
export type DisplayOutput =
| {
body: string;
url: string;
}
| undefined;
14 changes: 9 additions & 5 deletions src/doctor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { join, dirname, basename } from 'node:path';
import { Messages, SfError } from '@salesforce/core';
import { Env, omit } from '@salesforce/kit';
import type { AnyJson, KeyValue } from '@salesforce/ts-types';
import Interfaces from '@oclif/core/interfaces';
import { Interfaces } from '@oclif/core';
import { Diagnostics, DiagnosticStatus } from './diagnostics.js';

export type SfDoctor = {
Expand All @@ -42,10 +42,14 @@ export type SfDoctor = {
};

// oclif has some properties marked as optional in the Interface, but they will be present after Load() is called
type CliConfig = Partial<Interfaces.Config> & { nodeEngine: string } & Pick<
Required<Interfaces.Config>,
'windows' | 'userAgent' | 'shell' | 'channel'
>;
type CliConfig = Record<string, unknown> & {
bin: string;
nodeEngine: string;
windows: boolean;
userAgent: string;
shell: string;
channel: string;
};

export type SfDoctorDiagnosis = {
versionDetail: Omit<Interfaces.VersionDetails, 'pluginVersions'> & { pluginVersions: string[] };
Expand Down
Loading
Loading