@salesforce/sf-plugins-core 1.7.3 → 1.8.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,17 @@
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.8.0](https://github.com/salesforcecli/sf-plugins-core/compare/v1.7.2...v1.8.0) (2022-03-17)
6
+
7
+ ### Features
8
+
9
+ - confirms are timed ([9c89ee9](https://github.com/salesforcecli/sf-plugins-core/commit/9c89ee99901c7abefc11a811e8e4dda0c704ed1c))
10
+ - simplified confirm prompts ([ddf1364](https://github.com/salesforcecli/sf-plugins-core/commit/ddf1364a48fb384bd0ad66bc310a35abcef20d68))
6
11
 
7
12
  ### Bug Fixes
8
13
 
14
+ - better checking of hub ([8c92bfe](https://github.com/salesforcecli/sf-plugins-core/commit/8c92bfed8f0600ff03489abbb253b5b95c95128a))
15
+ - no unused, respects timeout ([c41c43e](https://github.com/salesforcecli/sf-plugins-core/commit/c41c43e5c480dc1dd914a86ec8c97a8af41369a1))
9
16
  - use OptionFlag interface so that exactlyOne can be used ([0e65453](https://github.com/salesforcecli/sf-plugins-core/commit/0e65453dacb68a90f4af2387e571edbd4077ba1b))
10
17
 
11
18
  ### [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
  */
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.8.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",