@salesforce/plugin-info 2.0.1 → 2.1.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.
- package/CHANGELOG.md +16 -0
- package/README.md +1 -1
- package/lib/commands/doctor.d.ts +19 -0
- package/lib/commands/doctor.js +132 -0
- package/lib/commands/doctor.js.map +1 -0
- package/lib/commands/info/releasenotes/display.js +1 -2
- package/lib/commands/info/releasenotes/display.js.map +1 -1
- package/lib/constants.js +1 -2
- package/lib/constants.js.map +1 -1
- package/lib/diagnostics.d.ts +39 -0
- package/lib/diagnostics.js +106 -0
- package/lib/diagnostics.js.map +1 -0
- package/lib/doctor.d.ts +98 -0
- package/lib/doctor.js +143 -0
- package/lib/doctor.js.map +1 -0
- package/lib/index.d.ts +2 -2
- package/lib/index.js +6 -1
- package/lib/index.js.map +1 -1
- package/messages/diagnostics.md +16 -0
- package/messages/doctor.js +32 -0
- package/oclif.manifest.json +1 -1
- package/package.json +22 -27
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,22 @@
|
|
|
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
|
+
## [2.1.0](https://github.com/salesforcecli/plugin-info/compare/v2.0.1...v2.1.0) (2022-09-14)
|
|
6
|
+
|
|
7
|
+
### Features
|
|
8
|
+
|
|
9
|
+
- add initial doctor command ([d482d03](https://github.com/salesforcecli/plugin-info/commit/d482d032f7f31d89028327f24dabcbd090490491))
|
|
10
|
+
- initial doctor command ([4b16424](https://github.com/salesforcecli/plugin-info/commit/4b1642417ec41415173f863d95e268c9277d7ccb))
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
- add message when no plugin has diagnostic tests ([975a509](https://github.com/salesforcecli/plugin-info/commit/975a509dead671d29967924599dd9c32060591fb))
|
|
15
|
+
- doctor command updates ([5c5c444](https://github.com/salesforcecli/plugin-info/commit/5c5c444bfeddd825473c85fc7d162ebc84b333e0))
|
|
16
|
+
- edit doctor --help ([02a7cae](https://github.com/salesforcecli/plugin-info/commit/02a7caee5c98c9876553de3c1dcace0bdd305c9c))
|
|
17
|
+
- edit doctor messages ([c3bdd08](https://github.com/salesforcecli/plugin-info/commit/c3bdd08651c25b143726fa751afc306da1756935))
|
|
18
|
+
- remove newissue flag ([353bee1](https://github.com/salesforcecli/plugin-info/commit/353bee10445be615d6a3c99b1aabb5251143df31))
|
|
19
|
+
- update yarn.lock after merge ([dc86014](https://github.com/salesforcecli/plugin-info/commit/dc86014e28c776b6ce950521f468e1bccd2229c0))
|
|
20
|
+
|
|
5
21
|
### [2.0.1](https://github.com/salesforcecli/plugin-info/compare/v2.0.0...v2.0.1) (2022-05-24)
|
|
6
22
|
|
|
7
23
|
### Bug Fixes
|
package/README.md
CHANGED
|
@@ -108,6 +108,6 @@ EXAMPLES
|
|
|
108
108
|
$ sfdx info:releasenotes:display --version latest
|
|
109
109
|
```
|
|
110
110
|
|
|
111
|
-
_See code: [src/commands/info/releasenotes/display.ts](https://github.com/salesforcecli/plugin-info/blob/v2.0.
|
|
111
|
+
_See code: [src/commands/info/releasenotes/display.ts](https://github.com/salesforcecli/plugin-info/blob/v2.0.1/src/commands/info/releasenotes/display.ts)_
|
|
112
112
|
|
|
113
113
|
<!-- commandsstop -->
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { flags, SfdxCommand } from '@salesforce/command';
|
|
2
|
+
import { SfDoctorDiagnosis } from '../doctor';
|
|
3
|
+
export default class Doctor extends SfdxCommand {
|
|
4
|
+
static description: string;
|
|
5
|
+
static examples: string[];
|
|
6
|
+
static hidden: boolean;
|
|
7
|
+
protected static flagsConfig: {
|
|
8
|
+
command: flags.Discriminated<flags.String>;
|
|
9
|
+
plugin: flags.Discriminated<flags.String>;
|
|
10
|
+
outputdir: flags.Discriminated<flags.String>;
|
|
11
|
+
};
|
|
12
|
+
private tasks;
|
|
13
|
+
private doctor;
|
|
14
|
+
private outputDir;
|
|
15
|
+
private filesWrittenMsgs;
|
|
16
|
+
run(): Promise<SfDoctorDiagnosis>;
|
|
17
|
+
private parseCommand;
|
|
18
|
+
private setupCommandExecution;
|
|
19
|
+
}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2022, salesforce.com, inc.
|
|
4
|
+
* All rights reserved.
|
|
5
|
+
* Licensed under the BSD 3-Clause license.
|
|
6
|
+
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
const os = require("os");
|
|
10
|
+
const path = require("path");
|
|
11
|
+
const child_process_1 = require("child_process");
|
|
12
|
+
const command_1 = require("@salesforce/command");
|
|
13
|
+
const core_1 = require("@salesforce/core");
|
|
14
|
+
const doctor_1 = require("../doctor");
|
|
15
|
+
core_1.Messages.importMessagesDirectory(__dirname);
|
|
16
|
+
const messages = core_1.Messages.loadMessages('@salesforce/plugin-info', 'doctor');
|
|
17
|
+
class Doctor extends command_1.SfdxCommand {
|
|
18
|
+
constructor() {
|
|
19
|
+
super(...arguments);
|
|
20
|
+
// Array of promises that are various doctor tasks to perform
|
|
21
|
+
// such as running a command and running diagnostics.
|
|
22
|
+
this.tasks = [];
|
|
23
|
+
this.filesWrittenMsgs = [];
|
|
24
|
+
}
|
|
25
|
+
async run() {
|
|
26
|
+
this.doctor = doctor_1.Doctor.getInstance();
|
|
27
|
+
const lifecycle = core_1.Lifecycle.getInstance();
|
|
28
|
+
const pluginFlag = this.flags.plugin;
|
|
29
|
+
const commandFlag = this.flags.command;
|
|
30
|
+
const outputdirFlag = this.flags.outputdir;
|
|
31
|
+
this.outputDir = path.resolve(outputdirFlag ?? process.cwd());
|
|
32
|
+
// eslint-disable-next-line @typescript-eslint/require-await
|
|
33
|
+
lifecycle.on('Doctor:diagnostic', async (data) => {
|
|
34
|
+
this.ux.log(`${data.status} - ${data.testName}`);
|
|
35
|
+
this.doctor.addDiagnosticStatus(data);
|
|
36
|
+
});
|
|
37
|
+
if (commandFlag) {
|
|
38
|
+
this.setupCommandExecution(commandFlag);
|
|
39
|
+
}
|
|
40
|
+
if (pluginFlag) {
|
|
41
|
+
// verify the plugin flag matches an installed plugin
|
|
42
|
+
if (!this.config.plugins.some((p) => p.name === pluginFlag)) {
|
|
43
|
+
throw new core_1.SfError(messages.getMessage('pluginNotInstalledError', [pluginFlag]), 'UnknownPluginError');
|
|
44
|
+
}
|
|
45
|
+
this.ux.styledHeader(`Running diagnostics for plugin: ${pluginFlag}`);
|
|
46
|
+
const listeners = lifecycle.getListeners(`sf-doctor-${pluginFlag}`);
|
|
47
|
+
if (listeners.length) {
|
|
48
|
+
// run the diagnostics for a specific plugin
|
|
49
|
+
this.tasks.push(lifecycle.emit(`sf-doctor-${pluginFlag}`, this.doctor));
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
this.ux.log("Plugin doesn't have diagnostic tests to run.");
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
this.ux.styledHeader('Running all diagnostics');
|
|
57
|
+
// run all diagnostics
|
|
58
|
+
this.tasks.push(lifecycle.emit('sf-doctor', this.doctor));
|
|
59
|
+
/* eslint-disable @typescript-eslint/ban-ts-comment,@typescript-eslint/no-unsafe-assignment */
|
|
60
|
+
// @ts-ignore Seems like a TypeScript bug. Compiler thinks doctor.diagnose() returns `void`.
|
|
61
|
+
this.tasks = [...this.tasks, ...this.doctor.diagnose()];
|
|
62
|
+
/* eslint-enable @typescript-eslint/ban-ts-comment,@typescript-eslint/no-unsafe-assignment */
|
|
63
|
+
}
|
|
64
|
+
await Promise.all(this.tasks);
|
|
65
|
+
const diagnosis = this.doctor.getDiagnosis();
|
|
66
|
+
const diagnosisLocation = this.doctor.writeFileSync(path.join(this.outputDir, 'diagnosis.json'), JSON.stringify(diagnosis, null, 2));
|
|
67
|
+
this.filesWrittenMsgs.push(`Wrote doctor diagnosis to: ${diagnosisLocation}`);
|
|
68
|
+
this.ux.log();
|
|
69
|
+
this.filesWrittenMsgs.forEach((msg) => this.ux.log(msg));
|
|
70
|
+
this.ux.log();
|
|
71
|
+
this.ux.styledHeader('Suggestions');
|
|
72
|
+
diagnosis.suggestions.forEach((s) => this.ux.log(` * ${s}`));
|
|
73
|
+
return diagnosis;
|
|
74
|
+
}
|
|
75
|
+
// Takes the command flag and:
|
|
76
|
+
// 1. ensures it begins with `${config.bin}`; typically "sfdx" or "sf"
|
|
77
|
+
// 2. ensures the `--dev-debug` flag is set
|
|
78
|
+
parseCommand(command) {
|
|
79
|
+
let fullCmd = command.trim();
|
|
80
|
+
if (!fullCmd.startsWith(`${this.config.bin} `)) {
|
|
81
|
+
fullCmd = `${this.config.bin} ${fullCmd}`;
|
|
82
|
+
}
|
|
83
|
+
if (!command.includes('--dev-debug')) {
|
|
84
|
+
fullCmd += ' --dev-debug';
|
|
85
|
+
}
|
|
86
|
+
return fullCmd;
|
|
87
|
+
}
|
|
88
|
+
// Adds a promise to execute the provided command and all
|
|
89
|
+
// parameters in debug mode, writing stdout and stderr to files
|
|
90
|
+
// in the current or specified directory.
|
|
91
|
+
setupCommandExecution(command) {
|
|
92
|
+
const cmdString = this.parseCommand(command);
|
|
93
|
+
this.ux.styledHeader('Running command with debugging');
|
|
94
|
+
this.ux.log(`${cmdString}\n`);
|
|
95
|
+
this.doctor.addCommandName(cmdString);
|
|
96
|
+
const execPromise = new Promise((resolve) => {
|
|
97
|
+
const execOptions = {
|
|
98
|
+
env: Object.assign({}, process.env),
|
|
99
|
+
};
|
|
100
|
+
(0, child_process_1.exec)(cmdString, execOptions, (error, stdout, stderr) => {
|
|
101
|
+
const code = error?.code || 0;
|
|
102
|
+
const stdoutWithCode = `Command exit code: ${code}\n\n${stdout}`;
|
|
103
|
+
const stdoutLogLocation = this.doctor.writeFileSync(path.join(this.outputDir, 'command-stdout.log'), stdoutWithCode);
|
|
104
|
+
const debugLogLocation = this.doctor.writeFileSync(path.join(this.outputDir, 'command-debug.log'), stderr);
|
|
105
|
+
this.filesWrittenMsgs.push(`Wrote command stdout log to: ${stdoutLogLocation}`);
|
|
106
|
+
this.filesWrittenMsgs.push(`Wrote command debug log to: ${debugLogLocation}`);
|
|
107
|
+
resolve();
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
this.tasks.push(execPromise);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
exports.default = Doctor;
|
|
114
|
+
Doctor.description = messages.getMessage('commandDescription');
|
|
115
|
+
Doctor.examples = messages.getMessage('examples').split(os.EOL);
|
|
116
|
+
// Hide for now
|
|
117
|
+
Doctor.hidden = true;
|
|
118
|
+
Doctor.flagsConfig = {
|
|
119
|
+
command: command_1.flags.string({
|
|
120
|
+
char: 'c',
|
|
121
|
+
description: messages.getMessage('flags.command'),
|
|
122
|
+
}),
|
|
123
|
+
plugin: command_1.flags.string({
|
|
124
|
+
char: 'p',
|
|
125
|
+
description: messages.getMessage('flags.plugin'),
|
|
126
|
+
}),
|
|
127
|
+
outputdir: command_1.flags.directory({
|
|
128
|
+
char: 'o',
|
|
129
|
+
description: messages.getMessage('flags.outputdir'),
|
|
130
|
+
}),
|
|
131
|
+
};
|
|
132
|
+
//# sourceMappingURL=doctor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"doctor.js","sourceRoot":"","sources":["../../src/commands/doctor.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAEH,yBAAyB;AACzB,6BAA6B;AAC7B,iDAAqC;AACrC,iDAAyD;AACzD,2CAAgE;AAChE,sCAA4E;AAG5E,eAAQ,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;AAC5C,MAAM,QAAQ,GAAG,eAAQ,CAAC,YAAY,CAAC,yBAAyB,EAAE,QAAQ,CAAC,CAAC;AAE5E,MAAqB,MAAO,SAA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C;AAEX,kBAAW,GAAG;IAC7B,OAAO,EAAE,eAAK,CAAC,MAAM,CAAC;QACpB,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,QAAQ,CAAC,UAAU,CAAC,eAAe,CAAC;KAClD,CAAC;IACF,MAAM,EAAE,eAAK,CAAC,MAAM,CAAC;QACnB,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,QAAQ,CAAC,UAAU,CAAC,cAAc,CAAC;KACjD,CAAC;IACF,SAAS,EAAE,eAAK,CAAC,SAAS,CAAC;QACzB,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,QAAQ,CAAC,UAAU,CAAC,iBAAiB,CAAC;KACpD,CAAC;CACH,CAAC"}
|
|
@@ -27,7 +27,6 @@ const HIDE_FOOTER = 'SFDX_HIDE_RELEASE_NOTES_FOOTER';
|
|
|
27
27
|
const messages = core_1.Messages.loadMessages('@salesforce/plugin-info', 'display');
|
|
28
28
|
class Display extends command_1.SfdxCommand {
|
|
29
29
|
async run() {
|
|
30
|
-
var _a;
|
|
31
30
|
const env = new kit_1.Env();
|
|
32
31
|
const isHook = !!this.flags.hook;
|
|
33
32
|
if (env.getBoolean(HIDE_NOTES) && isHook) {
|
|
@@ -42,7 +41,7 @@ class Display extends command_1.SfdxCommand {
|
|
|
42
41
|
const installedVersion = this.config.pjson.version;
|
|
43
42
|
const infoConfig = await (0, getInfoConfig_1.getInfoConfig)(this.config.root);
|
|
44
43
|
const { distTagUrl, releaseNotesPath, releaseNotesFilename } = infoConfig.releasenotes;
|
|
45
|
-
let version =
|
|
44
|
+
let version = this.flags.version ?? installedVersion;
|
|
46
45
|
if (Display.helpers.includes(version)) {
|
|
47
46
|
version = await (0, getDistTagVersion_1.getDistTagVersion)(distTagUrl, version);
|
|
48
47
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"display.js","sourceRoot":"","sources":["../../../../src/commands/info/releasenotes/display.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAEH,4EAA4E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AC;oBAC1C,SAAS,EAAE,eAAe;oBAC1B,IAAI,EAAE,WAAW;oBACjB,SAAS,EAAE,IAAI;oBACf,YAAY,EAAE,OAAO;oBACrB,KAAK,EAAE,MAAM,CAAC,MAAM,CAClB;wBACE,IAAI;wBACJ,OAAO;wBACP,KAAK;qBACK,EACZ,GAAG,CACO;iBACb,CAAC,CAAC;gBAEH,OAAO;aACR;YAED,MAAM,GAAG,CAAC;SACX;IACH,CAAC;;AAvGH,0BAwGC;AAvGgB,eAAO,GAAG,CAAC,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAE,WAAW,EAAE,IAAI,CAAC,CAAC;AAEhE,mBAAW,GAAG,QAAQ,CAAC,UAAU,CAAC,oBAAoB,CAAC,CAAC;AAExD,eAAO,GAAG,CAAC,UAAU,CAAC,CAAC;AAEvB,gBAAQ,GAAG,QAAQ,CAAC,UAAU,CAAC,UAAU,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;AAEpF,mBAAW,GAAG;IAC7B,OAAO,EAAE,eAAK,CAAC,MAAM,CAAC;QACpB,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,QAAQ,CAAC,UAAU,CAAC,eAAe,CAAC;KAClD,CAAC;IACF,IAAI,EAAE,eAAK,CAAC,OAAO,CAAC;QAClB,MAAM,EAAE,IAAI;QACZ,WAAW,EAAE,QAAQ,CAAC,UAAU,CAAC,YAAY,CAAC;KAC/C,CAAC;CACH,CAAC"}
|
package/lib/constants.js
CHANGED
|
@@ -5,8 +5,7 @@
|
|
|
5
5
|
* Licensed under the BSD 3-Clause license.
|
|
6
6
|
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
7
7
|
*/
|
|
8
|
-
var _a;
|
|
9
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
9
|
exports.SFDX_RELEASE_NOTES_TIMEOUT = void 0;
|
|
11
|
-
exports.SFDX_RELEASE_NOTES_TIMEOUT = (
|
|
10
|
+
exports.SFDX_RELEASE_NOTES_TIMEOUT = (process.env.SFDX_RELEASE_NOTES_TIMEOUT ?? 3000);
|
|
12
11
|
//# sourceMappingURL=constants.js.map
|
package/lib/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";AAAA;;;;;GAKG
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,0BAA0B,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,0BAA0B,IAAI,IAAI,CAAW,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Config } from '@oclif/core';
|
|
2
|
+
import { SfDoctor } from './doctor';
|
|
3
|
+
export interface DiagnosticStatus {
|
|
4
|
+
testName: string;
|
|
5
|
+
status: 'pass' | 'fail' | 'warn' | 'unknown';
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Diagnostics are all the tests that ensure a known, clean CLI configuration
|
|
9
|
+
* and a way to run them asynchronously. Typically this is used only by the
|
|
10
|
+
* Doctor class.
|
|
11
|
+
*
|
|
12
|
+
* Create a new diagnostic test by adding a method to the `Diagnostics` class,
|
|
13
|
+
* appending "Check" to the name. Emit a "Doctor:diagnostic" event with a
|
|
14
|
+
* `DiagnosticStatus` payload so the CLI can report on the diagnostic result.
|
|
15
|
+
*/
|
|
16
|
+
export declare class Diagnostics {
|
|
17
|
+
private readonly doctor;
|
|
18
|
+
private config;
|
|
19
|
+
private diagnosis;
|
|
20
|
+
constructor(doctor: SfDoctor, config: Config);
|
|
21
|
+
/**
|
|
22
|
+
* Run all diagnostics using the data gathered by the doctor and add
|
|
23
|
+
* suggestions to the diagnosis.
|
|
24
|
+
*/
|
|
25
|
+
run(): Array<Promise<void>>;
|
|
26
|
+
/**
|
|
27
|
+
* Checks to see if the running version of the CLI is the latest.
|
|
28
|
+
*/
|
|
29
|
+
outdatedCliVersionCheck(): Promise<void>;
|
|
30
|
+
/**
|
|
31
|
+
* Checks if the salesforcedx plugin is installed and suggests
|
|
32
|
+
* to uninstall it if there.
|
|
33
|
+
*/
|
|
34
|
+
salesforceDxPluginCheck(): Promise<void>;
|
|
35
|
+
/**
|
|
36
|
+
* Checks and warns if any plugins are linked.
|
|
37
|
+
*/
|
|
38
|
+
linkedPluginCheck(): Promise<void>;
|
|
39
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2022, salesforce.com, inc.
|
|
4
|
+
* All rights reserved.
|
|
5
|
+
* Licensed under the BSD 3-Clause license.
|
|
6
|
+
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.Diagnostics = void 0;
|
|
10
|
+
const childProcess = require("child_process");
|
|
11
|
+
const core_1 = require("@salesforce/core");
|
|
12
|
+
core_1.Messages.importMessagesDirectory(__dirname);
|
|
13
|
+
const messages = core_1.Messages.loadMessages('@salesforce/plugin-info', 'diagnostics');
|
|
14
|
+
/**
|
|
15
|
+
* Diagnostics are all the tests that ensure a known, clean CLI configuration
|
|
16
|
+
* and a way to run them asynchronously. Typically this is used only by the
|
|
17
|
+
* Doctor class.
|
|
18
|
+
*
|
|
19
|
+
* Create a new diagnostic test by adding a method to the `Diagnostics` class,
|
|
20
|
+
* appending "Check" to the name. Emit a "Doctor:diagnostic" event with a
|
|
21
|
+
* `DiagnosticStatus` payload so the CLI can report on the diagnostic result.
|
|
22
|
+
*/
|
|
23
|
+
class Diagnostics {
|
|
24
|
+
constructor(doctor, config) {
|
|
25
|
+
this.doctor = doctor;
|
|
26
|
+
this.config = config;
|
|
27
|
+
this.diagnosis = doctor.getDiagnosis();
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Run all diagnostics using the data gathered by the doctor and add
|
|
31
|
+
* suggestions to the diagnosis.
|
|
32
|
+
*/
|
|
33
|
+
run() {
|
|
34
|
+
const keys = Reflect.ownKeys(Diagnostics.prototype);
|
|
35
|
+
return keys.filter((key) => key.endsWith('Check')).map((diagnostic) => this[diagnostic]());
|
|
36
|
+
}
|
|
37
|
+
// **********************************************************
|
|
38
|
+
// D I A G N O S T I C S
|
|
39
|
+
//
|
|
40
|
+
// NOTE: Diagnostic function names must end with "Check"
|
|
41
|
+
// or they will not be run with all diagnostics.
|
|
42
|
+
//
|
|
43
|
+
// **********************************************************
|
|
44
|
+
/**
|
|
45
|
+
* Checks to see if the running version of the CLI is the latest.
|
|
46
|
+
*/
|
|
47
|
+
async outdatedCliVersionCheck() {
|
|
48
|
+
const cliVersionArray = this.diagnosis.versionDetail.cliVersion.split('/');
|
|
49
|
+
const cliName = cliVersionArray[0];
|
|
50
|
+
const cliVersion = cliVersionArray[1];
|
|
51
|
+
return new Promise((resolve) => {
|
|
52
|
+
const testName = 'using latest or latest-rc CLI version';
|
|
53
|
+
let status = 'unknown';
|
|
54
|
+
childProcess.exec(`npm view ${cliName} dist-tags.latest`, {}, (error, stdout, stderr) => {
|
|
55
|
+
const code = error?.code ?? 0;
|
|
56
|
+
if (code === 0) {
|
|
57
|
+
const latest = stdout.trim();
|
|
58
|
+
if (cliVersion < latest) {
|
|
59
|
+
status = 'fail';
|
|
60
|
+
this.doctor.addSuggestion(messages.getMessage('updateCliVersion', [cliVersion, latest]));
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
status = 'pass';
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
this.doctor.addSuggestion(messages.getMessage('latestCliVersionError', [stderr]));
|
|
68
|
+
}
|
|
69
|
+
void core_1.Lifecycle.getInstance()
|
|
70
|
+
.emit('Doctor:diagnostic', { testName, status })
|
|
71
|
+
.then(() => resolve());
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Checks if the salesforcedx plugin is installed and suggests
|
|
77
|
+
* to uninstall it if there.
|
|
78
|
+
*/
|
|
79
|
+
async salesforceDxPluginCheck() {
|
|
80
|
+
const testName = 'salesforcedx plugin not installed';
|
|
81
|
+
let status = 'pass';
|
|
82
|
+
const plugins = this.diagnosis.versionDetail.pluginVersions;
|
|
83
|
+
if (plugins?.some((p) => p.split(' ')[0] === 'salesforcedx')) {
|
|
84
|
+
status = 'fail';
|
|
85
|
+
const bin = this.diagnosis.cliConfig.bin;
|
|
86
|
+
this.doctor.addSuggestion(messages.getMessage('salesforceDxPluginDetected', [bin]));
|
|
87
|
+
}
|
|
88
|
+
await core_1.Lifecycle.getInstance().emit('Doctor:diagnostic', { testName, status });
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Checks and warns if any plugins are linked.
|
|
92
|
+
*/
|
|
93
|
+
async linkedPluginCheck() {
|
|
94
|
+
const testName = 'no linked plugins';
|
|
95
|
+
let status = 'pass';
|
|
96
|
+
const plugins = this.config.plugins;
|
|
97
|
+
const linkedPlugins = plugins.filter((p) => p.name.includes('(link)'));
|
|
98
|
+
linkedPlugins.forEach((lp) => {
|
|
99
|
+
status = 'fail';
|
|
100
|
+
this.doctor.addSuggestion(messages.getMessage('linkedPluginWarning', [lp.name]));
|
|
101
|
+
});
|
|
102
|
+
await core_1.Lifecycle.getInstance().emit('Doctor:diagnostic', { testName, status });
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
exports.Diagnostics = Diagnostics;
|
|
106
|
+
//# sourceMappingURL=diagnostics.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diagnostics.js","sourceRoot":"","sources":["../src/diagnostics.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,8CAA8C;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S,CAAC,GAAG,CAAC;YACzC,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,QAAQ,CAAC,UAAU,CAAC,4BAA4B,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;SACrF;QACD,MAAM,gBAAS,CAAC,WAAW,EAAE,CAAC,IAAI,CAAC,mBAAmB,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC;IAChF,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,iBAAiB;QAC5B,MAAM,QAAQ,GAAG,mBAAmB,CAAC;QACrC,IAAI,MAAM,GAA+B,MAAM,CAAC;QAEhD,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC;QACpC,MAAM,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC;QACvE,aAAa,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE;YAC3B,MAAM,GAAG,MAAM,CAAC;YAChB,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,QAAQ,CAAC,UAAU,CAAC,qBAAqB,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACnF,CAAC,CAAC,CAAC;QACH,MAAM,gBAAS,CAAC,WAAW,EAAE,CAAC,IAAI,CAAC,mBAAmB,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC;IAChF,CAAC;CACF;AAxFD,kCAwFC"}
|
package/lib/doctor.d.ts
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { AnyJson, KeyValue } from '@salesforce/ts-types';
|
|
2
|
+
import { Config } from '@oclif/core';
|
|
3
|
+
import { VersionDetail } from '@oclif/plugin-version';
|
|
4
|
+
import { DiagnosticStatus } from './diagnostics';
|
|
5
|
+
export interface SfDoctor {
|
|
6
|
+
addCommandName(commandName: string): void;
|
|
7
|
+
addSuggestion(suggestion: string): void;
|
|
8
|
+
addDiagnosticStatus(status: DiagnosticStatus): void;
|
|
9
|
+
addPluginData(pluginName: string, data: AnyJson): void;
|
|
10
|
+
diagnose(): void;
|
|
11
|
+
getDiagnosis(): SfDoctorDiagnosis;
|
|
12
|
+
writeFileSync(filePath: string, contents: string): string;
|
|
13
|
+
}
|
|
14
|
+
declare type CliConfig = Partial<Config> & {
|
|
15
|
+
nodeEngine: string;
|
|
16
|
+
};
|
|
17
|
+
export interface SfDoctorDiagnosis {
|
|
18
|
+
versionDetail: VersionDetail;
|
|
19
|
+
sfdxEnvVars: Array<KeyValue<string>>;
|
|
20
|
+
sfEnvVars: Array<KeyValue<string>>;
|
|
21
|
+
cliConfig: CliConfig;
|
|
22
|
+
pluginSpecificData: {
|
|
23
|
+
[pluginName: string]: AnyJson[];
|
|
24
|
+
};
|
|
25
|
+
diagnosticResults: DiagnosticStatus[];
|
|
26
|
+
suggestions: string[];
|
|
27
|
+
commandName?: string;
|
|
28
|
+
logFilePaths: string[];
|
|
29
|
+
}
|
|
30
|
+
export declare class Doctor implements SfDoctor {
|
|
31
|
+
private readonly config;
|
|
32
|
+
private static instance;
|
|
33
|
+
readonly id: number;
|
|
34
|
+
private diagnosis;
|
|
35
|
+
private constructor();
|
|
36
|
+
/**
|
|
37
|
+
* Returns a singleton instance of an SfDoctor.
|
|
38
|
+
*/
|
|
39
|
+
static getInstance(): SfDoctor;
|
|
40
|
+
/**
|
|
41
|
+
* Initializes a new instance of SfDoctor with CLI config data.
|
|
42
|
+
*
|
|
43
|
+
* @param config The oclif config for the CLI
|
|
44
|
+
* @param versionDetail The result of running a verbose version command
|
|
45
|
+
* @returns An instance of SfDoctor
|
|
46
|
+
*/
|
|
47
|
+
static init(config: Config, versionDetail: VersionDetail): SfDoctor;
|
|
48
|
+
/**
|
|
49
|
+
* Use the gathered data to discover potential problems by running all diagnostics.
|
|
50
|
+
*
|
|
51
|
+
* @returns An array of diagnostic promises.
|
|
52
|
+
*/
|
|
53
|
+
diagnose(): Array<Promise<void>>;
|
|
54
|
+
/**
|
|
55
|
+
* Add a suggestion in the form of:
|
|
56
|
+
* "Because of <this data point> we recommend to <suggestion>"
|
|
57
|
+
*
|
|
58
|
+
* @param suggestion A suggestion for the CLI user to try based on gathered data
|
|
59
|
+
*/
|
|
60
|
+
addSuggestion(suggestion: string): void;
|
|
61
|
+
/**
|
|
62
|
+
* Add a diagnostic test status.
|
|
63
|
+
*
|
|
64
|
+
* @param status a diagnostic test status
|
|
65
|
+
*/
|
|
66
|
+
addDiagnosticStatus(status: DiagnosticStatus): void;
|
|
67
|
+
/**
|
|
68
|
+
* Add diagnostic data that is specific to the passed plugin name.
|
|
69
|
+
*
|
|
70
|
+
* @param pluginName The name in the plugin's package.json
|
|
71
|
+
* @param data Any data to add to the doctor diagnosis that is specific
|
|
72
|
+
* to the plugin and a valid JSON value.
|
|
73
|
+
*/
|
|
74
|
+
addPluginData(pluginName: string, data: AnyJson): void;
|
|
75
|
+
/**
|
|
76
|
+
* Add a command name that the doctor will run to the diagnosis data for
|
|
77
|
+
* use by diagnostics.
|
|
78
|
+
*
|
|
79
|
+
* @param commandName The name of the command that the doctor will run. E.g., "force:org:list"
|
|
80
|
+
*/
|
|
81
|
+
addCommandName(commandName: string): void;
|
|
82
|
+
/**
|
|
83
|
+
* Returns all the data gathered, paths to doctor files, and recommendations.
|
|
84
|
+
*/
|
|
85
|
+
getDiagnosis(): SfDoctorDiagnosis;
|
|
86
|
+
/**
|
|
87
|
+
* Write a file with the provided path. The file name will be prepended
|
|
88
|
+
* with this doctor's id.
|
|
89
|
+
*
|
|
90
|
+
* E.g., `name = myContent.json` will write `1658350735579-myContent.json`
|
|
91
|
+
*
|
|
92
|
+
* @param filePath The path of the file to write.
|
|
93
|
+
* @param contents The string contents to write.
|
|
94
|
+
* @return The full path to the file.
|
|
95
|
+
*/
|
|
96
|
+
writeFileSync(filePath: string, contents: string): string;
|
|
97
|
+
}
|
|
98
|
+
export {};
|
package/lib/doctor.js
ADDED
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2022, salesforce.com, inc.
|
|
4
|
+
* All rights reserved.
|
|
5
|
+
* Licensed under the BSD 3-Clause license.
|
|
6
|
+
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.Doctor = void 0;
|
|
10
|
+
const fs = require("fs");
|
|
11
|
+
const path = require("path");
|
|
12
|
+
const core_1 = require("@salesforce/core");
|
|
13
|
+
const kit_1 = require("@salesforce/kit");
|
|
14
|
+
const diagnostics_1 = require("./diagnostics");
|
|
15
|
+
core_1.Messages.importMessagesDirectory(__dirname);
|
|
16
|
+
const messages = core_1.Messages.loadMessages('@salesforce/plugin-info', 'doctor');
|
|
17
|
+
const PINNED_SUGGESTIONS = [
|
|
18
|
+
messages.getMessage('pinnedSuggestions.checkGitHubIssues'),
|
|
19
|
+
messages.getMessage('pinnedSuggestions.checkSfdcStatus'),
|
|
20
|
+
];
|
|
21
|
+
class Doctor {
|
|
22
|
+
constructor(config, versionDetail) {
|
|
23
|
+
this.config = config;
|
|
24
|
+
this.id = Date.now();
|
|
25
|
+
const sfdxEnvVars = new kit_1.Env().entries().filter((e) => e[0].startsWith('SFDX_'));
|
|
26
|
+
const sfEnvVars = new kit_1.Env().entries().filter((e) => e[0].startsWith('SF_'));
|
|
27
|
+
const cliConfig = (0, kit_1.omit)(config, ['plugins', 'pjson', 'userPJSON', 'options']);
|
|
28
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
29
|
+
cliConfig.nodeEngine = config.pjson.engines.node;
|
|
30
|
+
this.diagnosis = {
|
|
31
|
+
versionDetail,
|
|
32
|
+
sfdxEnvVars,
|
|
33
|
+
sfEnvVars,
|
|
34
|
+
cliConfig,
|
|
35
|
+
pluginSpecificData: {},
|
|
36
|
+
diagnosticResults: [],
|
|
37
|
+
suggestions: [...PINNED_SUGGESTIONS],
|
|
38
|
+
logFilePaths: [],
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Returns a singleton instance of an SfDoctor.
|
|
43
|
+
*/
|
|
44
|
+
static getInstance() {
|
|
45
|
+
if (!Doctor.instance) {
|
|
46
|
+
throw new core_1.SfError(messages.getMessage('doctorNotInitializedError'), 'SfDoctorInitError');
|
|
47
|
+
}
|
|
48
|
+
return Doctor.instance;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Initializes a new instance of SfDoctor with CLI config data.
|
|
52
|
+
*
|
|
53
|
+
* @param config The oclif config for the CLI
|
|
54
|
+
* @param versionDetail The result of running a verbose version command
|
|
55
|
+
* @returns An instance of SfDoctor
|
|
56
|
+
*/
|
|
57
|
+
static init(config, versionDetail) {
|
|
58
|
+
if (Doctor.instance) {
|
|
59
|
+
throw new core_1.SfError(messages.getMessage('doctorAlreadyInitializedError'), 'SfDoctorInitError');
|
|
60
|
+
}
|
|
61
|
+
Doctor.instance = new this(config, versionDetail);
|
|
62
|
+
return Doctor.instance;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Use the gathered data to discover potential problems by running all diagnostics.
|
|
66
|
+
*
|
|
67
|
+
* @returns An array of diagnostic promises.
|
|
68
|
+
*/
|
|
69
|
+
diagnose() {
|
|
70
|
+
return new diagnostics_1.Diagnostics(this, this.config).run();
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Add a suggestion in the form of:
|
|
74
|
+
* "Because of <this data point> we recommend to <suggestion>"
|
|
75
|
+
*
|
|
76
|
+
* @param suggestion A suggestion for the CLI user to try based on gathered data
|
|
77
|
+
*/
|
|
78
|
+
addSuggestion(suggestion) {
|
|
79
|
+
this.diagnosis.suggestions.push(suggestion);
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Add a diagnostic test status.
|
|
83
|
+
*
|
|
84
|
+
* @param status a diagnostic test status
|
|
85
|
+
*/
|
|
86
|
+
addDiagnosticStatus(status) {
|
|
87
|
+
this.diagnosis.diagnosticResults.push(status);
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Add diagnostic data that is specific to the passed plugin name.
|
|
91
|
+
*
|
|
92
|
+
* @param pluginName The name in the plugin's package.json
|
|
93
|
+
* @param data Any data to add to the doctor diagnosis that is specific
|
|
94
|
+
* to the plugin and a valid JSON value.
|
|
95
|
+
*/
|
|
96
|
+
addPluginData(pluginName, data) {
|
|
97
|
+
const pluginEntry = this.diagnosis.pluginSpecificData[pluginName];
|
|
98
|
+
if (pluginEntry) {
|
|
99
|
+
pluginEntry.push(data);
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
this.diagnosis.pluginSpecificData[pluginName] = [data];
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Add a command name that the doctor will run to the diagnosis data for
|
|
107
|
+
* use by diagnostics.
|
|
108
|
+
*
|
|
109
|
+
* @param commandName The name of the command that the doctor will run. E.g., "force:org:list"
|
|
110
|
+
*/
|
|
111
|
+
addCommandName(commandName) {
|
|
112
|
+
this.diagnosis.commandName = commandName;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Returns all the data gathered, paths to doctor files, and recommendations.
|
|
116
|
+
*/
|
|
117
|
+
getDiagnosis() {
|
|
118
|
+
return { ...this.diagnosis };
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Write a file with the provided path. The file name will be prepended
|
|
122
|
+
* with this doctor's id.
|
|
123
|
+
*
|
|
124
|
+
* E.g., `name = myContent.json` will write `1658350735579-myContent.json`
|
|
125
|
+
*
|
|
126
|
+
* @param filePath The path of the file to write.
|
|
127
|
+
* @param contents The string contents to write.
|
|
128
|
+
* @return The full path to the file.
|
|
129
|
+
*/
|
|
130
|
+
writeFileSync(filePath, contents) {
|
|
131
|
+
const dir = path.dirname(filePath);
|
|
132
|
+
const fileName = `${this.id}-${path.basename(filePath)}`;
|
|
133
|
+
if (!fs.existsSync(dir)) {
|
|
134
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
135
|
+
}
|
|
136
|
+
const fullPath = path.join(dir, fileName);
|
|
137
|
+
this.diagnosis.logFilePaths.push(fullPath);
|
|
138
|
+
fs.writeFileSync(fullPath, contents);
|
|
139
|
+
return fullPath;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
exports.Doctor = Doctor;
|
|
143
|
+
//# sourceMappingURL=doctor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"doctor.js","sourceRoot":"","sources":["../src/doctor.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,yBAAyB;AACzB,6BAA6B;AAC7B,2CAAqD;AACrD,yCAA4C;AAI5C,+CAA8D;AA0B9D,eAAQ,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;AAC5C,MAAM,QAAQ,GAAG,eAAQ,CAAC,YAAY,CAAC,yBAAyB,EAAE,QAAQ,CAAC,CAAC;AAE5E,MAAM,kBAAkB,GAAG;IACzB,QAAQ,CAAC,UAAU,CAAC,qCAAqC,CAAC;IAC1D,QAAQ,CAAC,UAAU,CAAC,mCAAmC,CAAC;CACzD,CAAC;AAEF,MAAa,MAAM;IASjB,YAAqC,MAAc,EAAE,aAA4B;QAA5C,WAAM,GAAN,MAAM,CAAQ;QACjD,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QACrB,MAAM,WAAW,GAAG,IAAI,SAAG,EAAE,CAAC,OAAO,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC;QAChF,MAAM,SAAS,GAAG,IAAI,SAAG,EAAE,CAAC,OAAO,EAAE,CAAC,MAAM,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,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC3C,EAAE,CAAC,aAAa,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;QACrC,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF;AAzID,wBAyIC"}
|
package/lib/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
1
|
+
export { Doctor, SfDoctor, SfDoctorDiagnosis } from './doctor';
|
|
2
|
+
export { Diagnostics, DiagnosticStatus } from './diagnostics';
|
package/lib/index.js
CHANGED
|
@@ -5,5 +5,10 @@
|
|
|
5
5
|
* Licensed under the BSD 3-Clause license.
|
|
6
6
|
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
7
7
|
*/
|
|
8
|
-
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.Diagnostics = exports.Doctor = void 0;
|
|
10
|
+
var doctor_1 = require("./doctor");
|
|
11
|
+
Object.defineProperty(exports, "Doctor", { enumerable: true, get: function () { return doctor_1.Doctor; } });
|
|
12
|
+
var diagnostics_1 = require("./diagnostics");
|
|
13
|
+
Object.defineProperty(exports, "Diagnostics", { enumerable: true, get: function () { return diagnostics_1.Diagnostics; } });
|
|
9
14
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,mCAA+D;AAAtD,gGAAA,MAAM,OAAA;AACf,6CAA8D;AAArD,0GAAA,WAAW,OAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# updateCliVersion
|
|
2
|
+
|
|
3
|
+
Update your CLI version from: %s to the latest version: %s.
|
|
4
|
+
|
|
5
|
+
# latestCliVersionError
|
|
6
|
+
|
|
7
|
+
Couldn't determine latest CLI version due to:
|
|
8
|
+
%s
|
|
9
|
+
|
|
10
|
+
# salesforceDxPluginDetected
|
|
11
|
+
|
|
12
|
+
The salesforcedx plugin is deprecated. Uninstall it by running: `%s plugins:uninstall salesforcedx`.
|
|
13
|
+
|
|
14
|
+
# linkedPluginWarning
|
|
15
|
+
|
|
16
|
+
Warning: the [%s] plugin is linked.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
commandDescription: `Gather CLI configuration data and run diagnostic tests to discover and report potential problems in your environment.
|
|
3
|
+
|
|
4
|
+
When you run the doctor command without parameters, it first displays a diagnostic overview of your environment. It then writes a detailed diagnosis to a JSON file in the current directory. Use the --outputdir to specify a different directory. To run diagnostic tests on a specific plugin, use the --plugin parameter. If the plugin isn't listening to the doctor, then you get a warning.
|
|
5
|
+
|
|
6
|
+
Use the --command parameter to run a specific command in debug mode; the doctor writes both stdout and stderr to *.log files that you can provide to Salesforce Customer Support or attach to a GitHub issue.
|
|
7
|
+
|
|
8
|
+
Plugin providers can also implement their own doctor diagnostic tests by listening to the "sf-doctor" event and running plugin specific tests that are then included in the doctor diagnostics log.
|
|
9
|
+
`,
|
|
10
|
+
flags: {
|
|
11
|
+
command: 'command to run in debug mode ; results are written to a log file',
|
|
12
|
+
newissue: 'create a new GitHub issue and attach all diagnostic results',
|
|
13
|
+
plugin: 'specific plugin on which to run diagnostics ',
|
|
14
|
+
outputdir: 'directory to save all created files rather than the current working directory',
|
|
15
|
+
},
|
|
16
|
+
examples: [
|
|
17
|
+
`Run CLI doctor diagnostics:
|
|
18
|
+
$ <%= config.bin %> doctor
|
|
19
|
+
Run CLI doctor diagnostics and the specified command, and write the debug output to a file:
|
|
20
|
+
$ <%= config.bin %> doctor --command "force:org:list --all"
|
|
21
|
+
Run CLI doctor diagnostics for a specific plugin:
|
|
22
|
+
$ <%= config.bin %> doctor --plugin @salesforce/plugin-source`,
|
|
23
|
+
],
|
|
24
|
+
pinnedSuggestions: {
|
|
25
|
+
checkGitHubIssues: 'Check https://github.com/forcedotcom/cli/issues for CLI issues posted by the community.',
|
|
26
|
+
checkSfdcStatus: 'Check http://status.salesforce.com for general Salesforce availability and performance.',
|
|
27
|
+
},
|
|
28
|
+
doctorNotInitializedError: 'Must first initialize a new SfDoctor.',
|
|
29
|
+
doctorAlreadyInitializedError: 'SfDoctor has already been initialized.',
|
|
30
|
+
pluginNotInstalledError:
|
|
31
|
+
'Specified plugin [%s] isn\'t installed. Install it, correct the name, or choose another plugin.',
|
|
32
|
+
};
|
package/oclif.manifest.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"2.0
|
|
1
|
+
{"version":"2.1.0","commands":{"doctor":{"id":"doctor","description":"Gather CLI configuration data and run diagnostic tests to discover and report potential problems in your environment.\n\nWhen you run the doctor command without parameters, it first displays a diagnostic overview of your environment. It then writes a detailed diagnosis to a JSON file in the current directory. Use the --outputdir to specify a different directory. To run diagnostic tests on a specific plugin, use the --plugin parameter. If the plugin isn't listening to the doctor, then you get a warning.\n\nUse the --command parameter to run a specific command in debug mode; the doctor writes both stdout and stderr to *.log files that you can provide to Salesforce Customer Support or attach to a GitHub issue.\n\nPlugin providers can also implement their own doctor diagnostic tests by listening to the \"sf-doctor\" event and running plugin specific tests that are then included in the doctor diagnostics log.\n","usage":"<%= command.id %> [-c <string>] [-p <string>] [-o <directory>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]","pluginName":"@salesforce/plugin-info","pluginType":"core","hidden":true,"aliases":[],"examples":["Run CLI doctor diagnostics:"," $ <%= config.bin %> doctor","Run CLI doctor diagnostics and the specified command, and write the debug output to a file:"," $ <%= config.bin %> doctor --command \"force:org:list --all\"","Run CLI doctor diagnostics for a specific plugin:"," $ <%= config.bin %> doctor --plugin @salesforce/plugin-source"],"flags":{"json":{"name":"json","type":"boolean","description":"format output as json","allowNo":false},"loglevel":{"name":"loglevel","type":"option","description":"logging level for this command invocation","required":false,"helpValue":"(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)","options":["trace","debug","info","warn","error","fatal","TRACE","DEBUG","INFO","WARN","ERROR","FATAL"],"default":"warn"},"command":{"name":"command","type":"option","char":"c","description":"command to run in debug mode ; results are written to a log file"},"plugin":{"name":"plugin","type":"option","char":"p","description":"specific plugin on which to run diagnostics "},"outputdir":{"name":"outputdir","type":"option","char":"o","description":"directory to save all created files rather than the current working directory"}},"args":[]},"info:releasenotes:display":{"id":"info:releasenotes:display","description":"Display Salesforce CLI release notes on the command line.","usage":"<%= command.id %> [-v <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]","pluginName":"@salesforce/plugin-info","pluginType":"core","aliases":["whatsnew"],"examples":["Display release notes for the currently installed CLI version:","$ <%= config.bin %> <%= command.id %>","Display release notes for CLI version 7.120.0:","$ <%= config.bin %> <%= command.id %> --version 7.120.0","Display release notes for the CLI version that corresponds to a tag (stable, stable-rc, latest, latest-rc, rc):","$ <%= config.bin %> <%= command.id %> --version latest"," "],"flags":{"json":{"name":"json","type":"boolean","description":"format output as json","allowNo":false},"loglevel":{"name":"loglevel","type":"option","description":"logging level for this command invocation","required":false,"helpValue":"(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)","options":["trace","debug","info","warn","error","fatal","TRACE","DEBUG","INFO","WARN","ERROR","FATAL"],"default":"warn"},"version":{"name":"version","type":"option","char":"v","description":"CLI version or tag for which to display release notes."},"hook":{"name":"hook","type":"boolean","description":"This hidden parameter is used in post install or update hooks.","hidden":true,"allowNo":false}},"args":[]}}}
|
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/plugin-info",
|
|
3
3
|
"description": "Plugin for accessing cli info from the command line",
|
|
4
|
-
"version": "2.0
|
|
4
|
+
"version": "2.1.0",
|
|
5
5
|
"author": "Salesforce",
|
|
6
6
|
"bugs": "https://github.com/forcedotcom/cli/issues",
|
|
7
7
|
"main": "lib/index.js",
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@oclif/core": "^1.
|
|
10
|
-
"@salesforce/command": "^5.
|
|
11
|
-
"@salesforce/core": "^3.
|
|
12
|
-
"@salesforce/kit": "^1.
|
|
9
|
+
"@oclif/core": "^1.16.0",
|
|
10
|
+
"@salesforce/command": "^5.2.6",
|
|
11
|
+
"@salesforce/core": "^3.26.3",
|
|
12
|
+
"@salesforce/kit": "^1.6.0",
|
|
13
13
|
"got": "^11.8.2",
|
|
14
14
|
"marked": "^4.0.1",
|
|
15
15
|
"marked-terminal": "^4.2.0",
|
|
@@ -21,9 +21,10 @@
|
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@oclif/dev-cli": "^1",
|
|
23
23
|
"@oclif/plugin-command-snapshot": "^3",
|
|
24
|
-
"@
|
|
25
|
-
"@salesforce/
|
|
26
|
-
"@salesforce/dev-
|
|
24
|
+
"@oclif/plugin-version": "1.1.2",
|
|
25
|
+
"@salesforce/cli-plugins-testkit": "^2.3.13",
|
|
26
|
+
"@salesforce/dev-config": "^3.1.0",
|
|
27
|
+
"@salesforce/dev-scripts": "^3.1.0",
|
|
27
28
|
"@salesforce/plugin-command-reference": "^1.3.17",
|
|
28
29
|
"@salesforce/prettier-config": "^0.0.2",
|
|
29
30
|
"@salesforce/ts-sinon": "1.3.21",
|
|
@@ -32,36 +33,30 @@
|
|
|
32
33
|
"@types/marked-terminal": "^3.1.3",
|
|
33
34
|
"@types/proxy-from-env": "^1.0.1",
|
|
34
35
|
"@types/semver": "^7.3.8",
|
|
35
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
36
|
-
"@typescript-eslint/parser": "^
|
|
36
|
+
"@typescript-eslint/eslint-plugin": "^5.33.0",
|
|
37
|
+
"@typescript-eslint/parser": "^5.33.0",
|
|
37
38
|
"chai": "^4.3.4",
|
|
38
|
-
"
|
|
39
|
-
"eslint": "^
|
|
40
|
-
"eslint-config-
|
|
41
|
-
"eslint-config-salesforce": "^0.1.6",
|
|
39
|
+
"eslint": "^8.21.0",
|
|
40
|
+
"eslint-config-prettier": "^8.5.0",
|
|
41
|
+
"eslint-config-salesforce": "^1.1.0",
|
|
42
42
|
"eslint-config-salesforce-license": "^0.1.6",
|
|
43
|
-
"eslint-config-salesforce-typescript": "^
|
|
43
|
+
"eslint-config-salesforce-typescript": "^1.1.1",
|
|
44
44
|
"eslint-plugin-header": "^3.1.1",
|
|
45
|
-
"eslint-plugin-import": "^2.
|
|
46
|
-
"eslint-plugin-jsdoc": "^
|
|
47
|
-
"eslint-plugin-prettier": "^3.4.1",
|
|
45
|
+
"eslint-plugin-import": "^2.26.0",
|
|
46
|
+
"eslint-plugin-jsdoc": "^39.3.6",
|
|
48
47
|
"husky": "^7.0.4",
|
|
49
|
-
"lint-staged": "^11.2.6",
|
|
50
48
|
"mocha": "^9.1.3",
|
|
51
49
|
"nyc": "^15.1.0",
|
|
52
|
-
"prettier": "^2.
|
|
50
|
+
"prettier": "^2.7.1",
|
|
53
51
|
"pretty-quick": "^3.1.0",
|
|
52
|
+
"sfdx-cli": "^7.160.0",
|
|
54
53
|
"shx": "0.3.4",
|
|
55
54
|
"sinon": "^11.1.1",
|
|
56
55
|
"sinon-chai": "^3.7.0",
|
|
57
56
|
"ts-node": "^10.4.0",
|
|
58
57
|
"typescript": "^4.5.2"
|
|
59
58
|
},
|
|
60
|
-
"config": {
|
|
61
|
-
"commitizen": {
|
|
62
|
-
"path": "cz-conventional-changelog"
|
|
63
|
-
}
|
|
64
|
-
},
|
|
59
|
+
"config": {},
|
|
65
60
|
"engines": {
|
|
66
61
|
"node": ">=14.0.0"
|
|
67
62
|
},
|
|
@@ -126,7 +121,7 @@
|
|
|
126
121
|
"access": "public"
|
|
127
122
|
},
|
|
128
123
|
"sfdx": {
|
|
129
|
-
"publicKeyUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-info/2.0.
|
|
130
|
-
"signatureUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-info/2.0.
|
|
124
|
+
"publicKeyUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-info/2.1.0.crt",
|
|
125
|
+
"signatureUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-info/2.1.0.sig"
|
|
131
126
|
}
|
|
132
127
|
}
|