@salesforce/sf-plugins-core 1.6.0 → 1.7.1

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 CHANGED
@@ -2,6 +2,25 @@
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.7.1](https://github.com/salesforcecli/sf-plugins-core/compare/v1.7.0...v1.7.1) (2022-03-11)
6
+
7
+ ### Bug Fixes
8
+
9
+ - add oclif enum to exports ([71ee6ac](https://github.com/salesforcecli/sf-plugins-core/commit/71ee6ac7942790ffc519512ade67330614ada51b))
10
+ - expose timed prompt in command class ([3b056c6](https://github.com/salesforcecli/sf-plugins-core/commit/3b056c668d3379ada6f85e2e5b5f6da76c1a3223))
11
+
12
+ ## [1.7.0](https://github.com/salesforcecli/sf-plugins-core/compare/v1.6.1...v1.7.0) (2022-03-11)
13
+
14
+ ### Features
15
+
16
+ - suppress progress bar output with env vars ([d2e8a84](https://github.com/salesforcecli/sf-plugins-core/commit/d2e8a849d7ca93b3dba538a26ce5f9ab7f858984))
17
+
18
+ ### [1.6.1](https://github.com/salesforcecli/sf-plugins-core/compare/v1.6.0...v1.6.1) (2022-03-09)
19
+
20
+ ### Bug Fixes
21
+
22
+ - erturn error - dont throw ([0ea70bc](https://github.com/salesforcecli/sf-plugins-core/commit/0ea70bc12cecd380a907323eba84ddb9d5a44e08))
23
+
5
24
  ## [1.6.0](https://github.com/salesforcecli/sf-plugins-core/compare/v1.5.3...v1.6.0) (2022-03-08)
6
25
 
7
26
  ### Features
package/lib/exported.d.ts CHANGED
@@ -11,6 +11,7 @@ export declare const Flags: {
11
11
  directory: (opts?: ({
12
12
  exists?: boolean | undefined;
13
13
  } & Partial<import("@oclif/core/lib/interfaces").OptionFlag<string>>) | undefined) => import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
14
+ enum: <T = string>(opts: import("@oclif/core/lib/interfaces").EnumFlagOptions<T>) => import("@oclif/core/lib/interfaces").OptionFlag<T>;
14
15
  file: (opts?: ({
15
16
  exists?: boolean | undefined;
16
17
  } & Partial<import("@oclif/core/lib/interfaces").OptionFlag<string>>) | undefined) => import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
package/lib/exported.js CHANGED
@@ -46,6 +46,7 @@ const duration_1 = require("./flags/duration");
46
46
  exports.Flags = {
47
47
  boolean: core_1.Flags.boolean,
48
48
  directory: core_1.Flags.directory,
49
+ enum: core_1.Flags.enum,
49
50
  file: core_1.Flags.file,
50
51
  integer: core_1.Flags.integer,
51
52
  string: core_1.Flags.string,
@@ -80,6 +80,10 @@ export declare abstract class SfCommand<T> extends Command {
80
80
  * }
81
81
  */
82
82
  prompt<R = Prompter.Answers>(questions: Prompter.Questions<R>, initialAnswers?: Partial<R>): Promise<R>;
83
+ /**
84
+ * Prompt user for information with a timeout (in milliseconds). See https://www.npmjs.com/package/inquirer for more.
85
+ */
86
+ timedPrompt<R = Prompter.Answers>(questions: Prompter.Questions<R>, ms?: number, initialAnswers?: Partial<R>): Promise<R>;
83
87
  _run<R>(): Promise<R | undefined>;
84
88
  /**
85
89
  * Wrap the command result into the standardized JSON structure.
package/lib/sfCommand.js CHANGED
@@ -28,7 +28,7 @@ class SfCommand extends core_1.Command {
28
28
  this.warnings = [];
29
29
  const outputEnabled = !this.jsonEnabled();
30
30
  this.spinner = new ux_1.Spinner(outputEnabled);
31
- this.progress = new ux_1.Progress(outputEnabled);
31
+ this.progress = new ux_1.Progress(outputEnabled && core_2.envVars.getBoolean(core_2.EnvironmentVariable.SF_USE_PROGRESS_BAR, true));
32
32
  this.ux = new ux_1.Ux(outputEnabled);
33
33
  this.prompter = new ux_1.Prompter();
34
34
  this.lifecycle = core_2.Lifecycle.getInstance();
@@ -113,6 +113,12 @@ class SfCommand extends core_1.Command {
113
113
  async prompt(questions, initialAnswers) {
114
114
  return this.prompter.prompt(questions, initialAnswers);
115
115
  }
116
+ /**
117
+ * Prompt user for information with a timeout (in milliseconds). See https://www.npmjs.com/package/inquirer for more.
118
+ */
119
+ async timedPrompt(questions, ms = 10000, initialAnswers) {
120
+ return this.prompter.timedPrompt(questions, 10000, initialAnswers);
121
+ }
116
122
  async _run() {
117
123
  if (this.statics.requiresProject) {
118
124
  this.project = await this.assignProject();
@@ -164,7 +170,7 @@ class SfCommand extends core_1.Command {
164
170
  if (this.jsonEnabled()) {
165
171
  core_1.CliUx.ux.styledJSON(this.toErrorJson(error));
166
172
  }
167
- throw error;
173
+ return error;
168
174
  }
169
175
  /**
170
176
  * Format errors and actions for human consumption. Adds 'Error:',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/sf-plugins-core",
3
- "version": "1.6.0",
3
+ "version": "1.7.1",
4
4
  "description": "Utils for writing deploy and retrieve plugins",
5
5
  "main": "lib/exported",
6
6
  "types": "lib/exported.d.ts",