@inquirer/prompts 7.3.2 → 7.4.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/README.md +2 -14
- package/package.json +14 -14
package/README.md
CHANGED
|
@@ -192,7 +192,7 @@ const allowEmail = await confirm(
|
|
|
192
192
|
|
|
193
193
|
## Canceling prompt
|
|
194
194
|
|
|
195
|
-
This can
|
|
195
|
+
This can be done with either an `AbortController` or `AbortSignal`.
|
|
196
196
|
|
|
197
197
|
```js
|
|
198
198
|
// Example 1: using built-in AbortSignal utilities
|
|
@@ -202,7 +202,7 @@ const answer = await confirm({ ... }, { signal: AbortSignal.timeout(5000) });
|
|
|
202
202
|
```
|
|
203
203
|
|
|
204
204
|
```js
|
|
205
|
-
// Example
|
|
205
|
+
// Example 2: implementing custom cancellation with an AbortController
|
|
206
206
|
import { confirm } from '@inquirer/prompts';
|
|
207
207
|
|
|
208
208
|
const controller = new AbortController();
|
|
@@ -213,18 +213,6 @@ setTimeout(() => {
|
|
|
213
213
|
const answer = await confirm({ ... }, { signal: controller.signal });
|
|
214
214
|
```
|
|
215
215
|
|
|
216
|
-
Alternatively, all prompt functions are returning a cancelable promise. This special promise type has a `cancel` method that'll cancel and cleanup the prompt.
|
|
217
|
-
|
|
218
|
-
On calling `cancel`, the answer promise will become rejected.
|
|
219
|
-
|
|
220
|
-
```js
|
|
221
|
-
import { confirm } from '@inquirer/prompts';
|
|
222
|
-
|
|
223
|
-
const promise = confirm(...); // Warning: for this pattern to work, `await` cannot be used.
|
|
224
|
-
|
|
225
|
-
promise.cancel();
|
|
226
|
-
```
|
|
227
|
-
|
|
228
216
|
# Recipes
|
|
229
217
|
|
|
230
218
|
## Handling `ctrl+c` gracefully
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inquirer/prompts",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.4.0",
|
|
4
4
|
"description": "Inquirer prompts, combined in a single package",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"answer",
|
|
@@ -76,20 +76,20 @@
|
|
|
76
76
|
"tsc": "tshy"
|
|
77
77
|
},
|
|
78
78
|
"dependencies": {
|
|
79
|
-
"@inquirer/checkbox": "^4.1.
|
|
80
|
-
"@inquirer/confirm": "^5.1.
|
|
81
|
-
"@inquirer/editor": "^4.2.
|
|
82
|
-
"@inquirer/expand": "^4.0.
|
|
83
|
-
"@inquirer/input": "^4.1.
|
|
84
|
-
"@inquirer/number": "^3.0.
|
|
85
|
-
"@inquirer/password": "^4.0.
|
|
86
|
-
"@inquirer/rawlist": "^4.0.
|
|
87
|
-
"@inquirer/search": "^3.0.
|
|
88
|
-
"@inquirer/select": "^4.0
|
|
79
|
+
"@inquirer/checkbox": "^4.1.4",
|
|
80
|
+
"@inquirer/confirm": "^5.1.8",
|
|
81
|
+
"@inquirer/editor": "^4.2.9",
|
|
82
|
+
"@inquirer/expand": "^4.0.11",
|
|
83
|
+
"@inquirer/input": "^4.1.8",
|
|
84
|
+
"@inquirer/number": "^3.0.11",
|
|
85
|
+
"@inquirer/password": "^4.0.11",
|
|
86
|
+
"@inquirer/rawlist": "^4.0.11",
|
|
87
|
+
"@inquirer/search": "^3.0.11",
|
|
88
|
+
"@inquirer/select": "^4.1.0"
|
|
89
89
|
},
|
|
90
90
|
"devDependencies": {
|
|
91
|
-
"@arethetypeswrong/cli": "^0.17.
|
|
92
|
-
"@inquirer/type": "^3.0.
|
|
91
|
+
"@arethetypeswrong/cli": "^0.17.4",
|
|
92
|
+
"@inquirer/type": "^3.0.5",
|
|
93
93
|
"@repo/tsconfig": "workspace:*",
|
|
94
94
|
"tshy": "^3.0.2"
|
|
95
95
|
},
|
|
@@ -113,5 +113,5 @@
|
|
|
113
113
|
"optional": true
|
|
114
114
|
}
|
|
115
115
|
},
|
|
116
|
-
"gitHead": "
|
|
116
|
+
"gitHead": "83508f90ca65d26abc1408e4209e4f8fc73e43fe"
|
|
117
117
|
}
|