@salesforce/sf-plugins-core 1.7.3 → 1.9.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 CHANGED
@@ -2,10 +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.7.3](https://github.com/salesforcecli/sf-plugins-core/compare/v1.7.2...v1.7.3) (2022-03-17)
5
+ ## [1.9.0](https://github.com/salesforcecli/sf-plugins-core/compare/v1.8.1...v1.9.0) (2022-03-24)
6
+
7
+ ### Features
8
+
9
+ - explain what a valid api version looks like ([4c5669a](https://github.com/salesforcecli/sf-plugins-core/commit/4c5669a969ef79eae1d4aec76f6cb20df92aae5e))
10
+
11
+ ### [1.8.1](https://github.com/salesforcecli/sf-plugins-core/compare/v1.8.0...v1.8.1) (2022-03-24)
12
+
13
+ ### Bug Fixes
14
+
15
+ - log errors to stderr ([9958d8e](https://github.com/salesforcecli/sf-plugins-core/commit/9958d8e49cf1fbe514026491d8d095651d1cb88b))
16
+
17
+ ## [1.8.0](https://github.com/salesforcecli/sf-plugins-core/compare/v1.7.2...v1.8.0) (2022-03-17)
18
+
19
+ ### Features
20
+
21
+ - confirms are timed ([9c89ee9](https://github.com/salesforcecli/sf-plugins-core/commit/9c89ee99901c7abefc11a811e8e4dda0c704ed1c))
22
+ - simplified confirm prompts ([ddf1364](https://github.com/salesforcecli/sf-plugins-core/commit/ddf1364a48fb384bd0ad66bc310a35abcef20d68))
6
23
 
7
24
  ### Bug Fixes
8
25
 
26
+ - better checking of hub ([8c92bfe](https://github.com/salesforcecli/sf-plugins-core/commit/8c92bfed8f0600ff03489abbb253b5b95c95128a))
27
+ - no unused, respects timeout ([c41c43e](https://github.com/salesforcecli/sf-plugins-core/commit/c41c43e5c480dc1dd914a86ec8c97a8af41369a1))
9
28
  - use OptionFlag interface so that exactlyOne can be used ([0e65453](https://github.com/salesforcecli/sf-plugins-core/commit/0e65453dacb68a90f4af2387e571edbd4077ba1b))
10
29
 
11
30
  ### [1.7.2](https://github.com/salesforcecli/sf-plugins-core/compare/v1.7.1...v1.7.2) (2022-03-15)
@@ -31,11 +31,10 @@ const getHubOrThrow = async (aliasOrUsername) => {
31
31
  }
32
32
  }
33
33
  const org = await core_2.Org.create({ aliasOrUsername });
34
- // check the synchronous, cached version and only use "determine" if we didn't get a positive result
35
- if (!org.isDevHubOrg() || !(await org.determineIfDevHubOrg())) {
36
- throw messages.createError('errors.NotADevHub', [aliasOrUsername]);
34
+ if (await org.determineIfDevHubOrg()) {
35
+ return org;
37
36
  }
38
- return org;
37
+ throw messages.createError('errors.NotADevHub', [aliasOrUsername]);
39
38
  };
40
39
  /**
41
40
  * An optional org specified by username or alias
@@ -80,6 +80,14 @@ 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
+ * Simplified prompt for single-question confirmation. Times out and throws after 10s
85
+ *
86
+ * @param message text to display. Do not include a question mark.
87
+ * @param ms milliseconds to wait for user input. Defaults to 10s.
88
+ * @return true if the user confirms, false if they do not.
89
+ */
90
+ confirm(message: string, ms?: number): Promise<boolean>;
83
91
  /**
84
92
  * Prompt user for information with a timeout (in milliseconds). See https://www.npmjs.com/package/inquirer for more.
85
93
  */
package/lib/sfCommand.js CHANGED
@@ -113,6 +113,23 @@ class SfCommand extends core_1.Command {
113
113
  async prompt(questions, initialAnswers) {
114
114
  return this.prompter.prompt(questions, initialAnswers);
115
115
  }
116
+ /**
117
+ * Simplified prompt for single-question confirmation. Times out and throws after 10s
118
+ *
119
+ * @param message text to display. Do not include a question mark.
120
+ * @param ms milliseconds to wait for user input. Defaults to 10s.
121
+ * @return true if the user confirms, false if they do not.
122
+ */
123
+ async confirm(message, ms = 10000) {
124
+ const { confirmed } = await this.timedPrompt([
125
+ {
126
+ name: 'confirmed',
127
+ message,
128
+ type: 'confirm',
129
+ },
130
+ ], ms);
131
+ return confirmed;
132
+ }
116
133
  /**
117
134
  * Prompt user for information with a timeout (in milliseconds). See https://www.npmjs.com/package/inquirer for more.
118
135
  */
@@ -166,10 +183,13 @@ class SfCommand extends core_1.Command {
166
183
  async catch(error) {
167
184
  var _a, _b;
168
185
  process.exitCode = (_b = (_a = process.exitCode) !== null && _a !== void 0 ? _a : error.exitCode) !== null && _b !== void 0 ? _b : 1;
169
- this.log(this.formatError(error));
170
186
  if (this.jsonEnabled()) {
171
187
  core_1.CliUx.ux.styledJSON(this.toErrorJson(error));
172
188
  }
189
+ else {
190
+ // eslint-disable-next-line no-console
191
+ console.error(this.formatError(error));
192
+ }
173
193
  return error;
174
194
  }
175
195
  /**
@@ -48,7 +48,7 @@ API versions up to %s are deprecated. See %s for more information.
48
48
 
49
49
  # errors.InvalidApiVersion
50
50
 
51
- %s is not a valid API version.
51
+ %s is not a valid API version. It should end in '.0' like '54.0'.
52
52
 
53
53
  # errors.RetiredApiVersion
54
54
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/sf-plugins-core",
3
- "version": "1.7.3",
3
+ "version": "1.9.0",
4
4
  "description": "Utils for writing deploy and retrieve plugins",
5
5
  "main": "lib/exported",
6
6
  "types": "lib/exported.d.ts",
@@ -32,7 +32,7 @@
32
32
  "/messages"
33
33
  ],
34
34
  "dependencies": {
35
- "@oclif/core": "^1.5.2",
35
+ "@oclif/core": "^1.6.0",
36
36
  "@salesforce/core": "^3.7.9",
37
37
  "@salesforce/kit": "^1.5.34",
38
38
  "@salesforce/ts-types": "^1.5.20",