@salesforce/sf-plugins-core 1.12.1 → 1.13.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 +23 -0
- package/lib/sfCommand.d.ts +5 -3
- package/lib/sfCommand.js +20 -9
- package/lib/ux/progress.d.ts +1 -1
- package/lib/ux/progress.js +17 -20
- package/messages/messages.md +2 -2
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,29 @@
|
|
|
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.13.0](https://github.com/salesforcecli/sf-plugins-core/compare/v1.12.3...v1.13.0) (2022-06-09)
|
|
6
|
+
|
|
7
|
+
### Features
|
|
8
|
+
|
|
9
|
+
- catch method supports base and SfError ([2b9a038](https://github.com/salesforcecli/sf-plugins-core/commit/2b9a038713c77e1230e21f5cc6f8ae2a6aaab5be))
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
- error can't be spread ([30930b7](https://github.com/salesforcecli/sf-plugins-core/commit/30930b74ff5e6b59116228d547362a284ad98388))
|
|
14
|
+
|
|
15
|
+
### [1.12.3](https://github.com/salesforcecli/sf-plugins-core/compare/v1.12.2...v1.12.3) (2022-05-04)
|
|
16
|
+
|
|
17
|
+
### Bug Fixes
|
|
18
|
+
|
|
19
|
+
- prevent multiple starts of progress bar ([8ec788c](https://github.com/salesforcecli/sf-plugins-core/commit/8ec788cfda452d2c227631fde64e01786f6f6a49))
|
|
20
|
+
- stop using once ([970fb80](https://github.com/salesforcecli/sf-plugins-core/commit/970fb808ad14a8d8bce0daabd78854c4a046e621))
|
|
21
|
+
|
|
22
|
+
### [1.12.2](https://github.com/salesforcecli/sf-plugins-core/compare/v1.12.1...v1.12.2) (2022-05-03)
|
|
23
|
+
|
|
24
|
+
### Bug Fixes
|
|
25
|
+
|
|
26
|
+
- update error message ([182cfa3](https://github.com/salesforcecli/sf-plugins-core/commit/182cfa30beb4e7fe052a0453d141e19ba7129647))
|
|
27
|
+
|
|
5
28
|
### [1.12.1](https://github.com/salesforcecli/sf-plugins-core/compare/v1.12.0...v1.12.1) (2022-04-20)
|
|
6
29
|
|
|
7
30
|
### Bug Fixes
|
package/lib/sfCommand.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CliUx, Command, Config, HelpSection, Interfaces } from '@oclif/core';
|
|
2
|
-
import { SfProject, StructuredMessage } from '@salesforce/core';
|
|
2
|
+
import { SfProject, StructuredMessage, SfError } from '@salesforce/core';
|
|
3
3
|
import { AnyJson } from '@salesforce/ts-types';
|
|
4
4
|
import * as chalk from 'chalk';
|
|
5
5
|
import { Progress, Prompter, Spinner, Ux } from './ux';
|
|
@@ -114,9 +114,9 @@ export declare abstract class SfCommand<T> extends Command {
|
|
|
114
114
|
/**
|
|
115
115
|
* Wrap the command error into the standardized JSON structure.
|
|
116
116
|
*/
|
|
117
|
-
protected toErrorJson(error: Error): SfCommand.Error;
|
|
117
|
+
protected toErrorJson(error: SfCommand.Error): SfCommand.Error;
|
|
118
118
|
protected assignProject(): Promise<SfProject>;
|
|
119
|
-
protected catch(error: SfCommand.Error): Promise<SfCommand.Error>;
|
|
119
|
+
protected catch(error: Error | SfError | SfCommand.Error): Promise<SfCommand.Error>;
|
|
120
120
|
/**
|
|
121
121
|
* Format errors and actions for human consumption. Adds 'Error (<ErrorCode>):',
|
|
122
122
|
* When there are actions, we add 'Try this:' in blue
|
|
@@ -153,6 +153,8 @@ export declare namespace SfCommand {
|
|
|
153
153
|
actions?: string[];
|
|
154
154
|
code?: unknown;
|
|
155
155
|
exitCode?: number;
|
|
156
|
+
data?: unknown;
|
|
157
|
+
context?: string;
|
|
156
158
|
}
|
|
157
159
|
}
|
|
158
160
|
//# sourceMappingURL=sfCommand.d.ts.map
|
package/lib/sfCommand.js
CHANGED
|
@@ -178,12 +178,8 @@ class SfCommand extends core_1.Command {
|
|
|
178
178
|
* Wrap the command error into the standardized JSON structure.
|
|
179
179
|
*/
|
|
180
180
|
toErrorJson(error) {
|
|
181
|
-
var _a;
|
|
182
181
|
return {
|
|
183
|
-
|
|
184
|
-
stack: error.stack,
|
|
185
|
-
name: error.name,
|
|
186
|
-
message: error.message,
|
|
182
|
+
...error,
|
|
187
183
|
warnings: this.warnings,
|
|
188
184
|
};
|
|
189
185
|
}
|
|
@@ -200,15 +196,30 @@ class SfCommand extends core_1.Command {
|
|
|
200
196
|
}
|
|
201
197
|
async catch(error) {
|
|
202
198
|
var _a, _b;
|
|
203
|
-
|
|
199
|
+
// transform an unknown error into one that conforms to the interface
|
|
200
|
+
const codeFromError = error instanceof core_2.SfError ? error.exitCode : 1;
|
|
201
|
+
(_a = process.exitCode) !== null && _a !== void 0 ? _a : (process.exitCode = codeFromError);
|
|
202
|
+
const sfErrorProperties = error instanceof core_2.SfError
|
|
203
|
+
? { data: error.data, actions: error.actions, code: codeFromError, context: error.context }
|
|
204
|
+
: {};
|
|
205
|
+
const sfCommandError = {
|
|
206
|
+
...sfErrorProperties,
|
|
207
|
+
...{
|
|
208
|
+
message: error.message,
|
|
209
|
+
name: (_b = error.name) !== null && _b !== void 0 ? _b : 'Error',
|
|
210
|
+
status: process.exitCode,
|
|
211
|
+
stack: error.stack,
|
|
212
|
+
exitCode: process.exitCode,
|
|
213
|
+
},
|
|
214
|
+
};
|
|
204
215
|
if (this.jsonEnabled()) {
|
|
205
|
-
core_1.CliUx.ux.styledJSON(this.toErrorJson(
|
|
216
|
+
core_1.CliUx.ux.styledJSON(this.toErrorJson(sfCommandError));
|
|
206
217
|
}
|
|
207
218
|
else {
|
|
208
219
|
// eslint-disable-next-line no-console
|
|
209
|
-
console.error(this.formatError(
|
|
220
|
+
console.error(this.formatError(sfCommandError));
|
|
210
221
|
}
|
|
211
|
-
return
|
|
222
|
+
return sfCommandError;
|
|
212
223
|
}
|
|
213
224
|
/**
|
|
214
225
|
* Format errors and actions for human consumption. Adds 'Error (<ErrorCode>):',
|
package/lib/ux/progress.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ export declare class Progress extends UxBase {
|
|
|
6
6
|
private static DEFAULT_OPTIONS;
|
|
7
7
|
private bar;
|
|
8
8
|
private total;
|
|
9
|
+
private started;
|
|
9
10
|
constructor(outputEnabled: boolean);
|
|
10
11
|
/**
|
|
11
12
|
* Set the total number of expected components.
|
|
@@ -27,7 +28,6 @@ export declare class Progress extends UxBase {
|
|
|
27
28
|
* Stop the progress bar.
|
|
28
29
|
*/
|
|
29
30
|
stop(): void;
|
|
30
|
-
private _start;
|
|
31
31
|
}
|
|
32
32
|
export declare namespace Progress {
|
|
33
33
|
type Bar = {
|
package/lib/ux/progress.js
CHANGED
|
@@ -9,7 +9,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
9
9
|
exports.Progress = void 0;
|
|
10
10
|
const util = require("util");
|
|
11
11
|
const core_1 = require("@oclif/core");
|
|
12
|
-
const kit_1 = require("@salesforce/kit");
|
|
13
12
|
const _1 = require(".");
|
|
14
13
|
/**
|
|
15
14
|
* Class for display a progress bar to the console. Will automatically be suppressed if the --json flag is present.
|
|
@@ -17,6 +16,7 @@ const _1 = require(".");
|
|
|
17
16
|
class Progress extends _1.UxBase {
|
|
18
17
|
constructor(outputEnabled) {
|
|
19
18
|
super(outputEnabled);
|
|
19
|
+
this.started = false;
|
|
20
20
|
}
|
|
21
21
|
/**
|
|
22
22
|
* Set the total number of expected components.
|
|
@@ -30,17 +30,23 @@ class Progress extends _1.UxBase {
|
|
|
30
30
|
* Start the progress bar.
|
|
31
31
|
*/
|
|
32
32
|
start(total, payload = {}, options = Progress.DEFAULT_OPTIONS) {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
this.
|
|
36
|
-
format: opts.format,
|
|
37
|
-
barCompleteChar: opts.barCompleteChar,
|
|
38
|
-
barIncompleteChar: opts.barIncompleteChar,
|
|
39
|
-
linewrap: opts.linewrap,
|
|
40
|
-
});
|
|
41
|
-
this.bar.setTotal(total);
|
|
33
|
+
if (this.started)
|
|
34
|
+
return;
|
|
35
|
+
this.started = true;
|
|
42
36
|
this.maybeNoop(() => {
|
|
43
|
-
|
|
37
|
+
const opts = Object.assign(Progress.DEFAULT_OPTIONS, options);
|
|
38
|
+
opts.format = util.format(opts.format, opts.title);
|
|
39
|
+
this.bar = core_1.CliUx.ux.progress({
|
|
40
|
+
format: opts.format,
|
|
41
|
+
barCompleteChar: opts.barCompleteChar,
|
|
42
|
+
barIncompleteChar: opts.barIncompleteChar,
|
|
43
|
+
linewrap: opts.linewrap,
|
|
44
|
+
});
|
|
45
|
+
this.bar.setTotal(total);
|
|
46
|
+
this.bar.start(total);
|
|
47
|
+
if (Object.keys(payload).length) {
|
|
48
|
+
this.bar.update(0, payload);
|
|
49
|
+
}
|
|
44
50
|
});
|
|
45
51
|
}
|
|
46
52
|
/**
|
|
@@ -66,15 +72,6 @@ class Progress extends _1.UxBase {
|
|
|
66
72
|
if (this.bar)
|
|
67
73
|
this.bar.stop();
|
|
68
74
|
}
|
|
69
|
-
_start(total, payload = {}) {
|
|
70
|
-
const start = (0, kit_1.once)((bar, t, p = {}) => {
|
|
71
|
-
bar.start(t);
|
|
72
|
-
if (Object.keys(p).length) {
|
|
73
|
-
bar.update(0, p);
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
start(this.bar, total, payload);
|
|
77
|
-
}
|
|
78
75
|
}
|
|
79
76
|
exports.Progress = Progress;
|
|
80
77
|
Progress.DEFAULT_OPTIONS = {
|
package/messages/messages.md
CHANGED
|
@@ -24,7 +24,7 @@ The id must begin with %s.
|
|
|
24
24
|
|
|
25
25
|
# errors.NoDefaultEnv
|
|
26
26
|
|
|
27
|
-
No default environment found. Use -
|
|
27
|
+
No default environment found. Use -o or --target-org to specify an environment.
|
|
28
28
|
|
|
29
29
|
# errors.NoDefaultDevHub
|
|
30
30
|
|
|
@@ -40,7 +40,7 @@ Override the api version used for api requests made by this command
|
|
|
40
40
|
|
|
41
41
|
# flags.apiVersion.overrideWarning
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
org-api-version configuration overridden at %s
|
|
44
44
|
|
|
45
45
|
# flags.apiVersion.warning.deprecated
|
|
46
46
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/sf-plugins-core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.13.0",
|
|
4
4
|
"description": "Utils for writing deploy and retrieve plugins",
|
|
5
5
|
"main": "lib/exported",
|
|
6
6
|
"types": "lib/exported.d.ts",
|
|
@@ -32,9 +32,9 @@
|
|
|
32
32
|
"/messages"
|
|
33
33
|
],
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@oclif/core": "^1.
|
|
36
|
-
"@salesforce/core": "^3.
|
|
37
|
-
"@salesforce/kit": "^1.5.
|
|
35
|
+
"@oclif/core": "^1.9.0",
|
|
36
|
+
"@salesforce/core": "^3.19.2",
|
|
37
|
+
"@salesforce/kit": "^1.5.41",
|
|
38
38
|
"@salesforce/ts-types": "^1.5.20",
|
|
39
39
|
"chalk": "^4",
|
|
40
40
|
"inquirer": "^8.2.0"
|