@inquirer/demo 0.1.1 → 0.2.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/demos/editor.mjs +21 -10
- package/package.json +3 -3
package/demos/editor.mjs
CHANGED
|
@@ -2,17 +2,28 @@ import * as url from 'node:url';
|
|
|
2
2
|
import { editor } from '@inquirer/prompts';
|
|
3
3
|
|
|
4
4
|
const demo = async () => {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
console.log(
|
|
6
|
+
'Answer:',
|
|
7
|
+
await editor({
|
|
8
|
+
message: 'Please write a short bio of at least 3 lines.',
|
|
9
|
+
validate(text) {
|
|
10
|
+
if (text.trim().split('\n').length < 3) {
|
|
11
|
+
return 'Must be at least 3 lines.';
|
|
12
|
+
}
|
|
11
13
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
return true;
|
|
15
|
+
},
|
|
16
|
+
})
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
console.log(
|
|
20
|
+
'Answer:',
|
|
21
|
+
await editor({
|
|
22
|
+
message: 'Automatically opened editor',
|
|
23
|
+
default: '# This prompt was automatically opened. You can write anything:\n\n',
|
|
24
|
+
waitForUseInput: false,
|
|
25
|
+
})
|
|
26
|
+
);
|
|
16
27
|
};
|
|
17
28
|
|
|
18
29
|
if (import.meta.url.startsWith('file:')) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inquirer/demo",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"engines": {
|
|
5
5
|
"node": ">=14.18.0"
|
|
6
6
|
},
|
|
@@ -61,11 +61,11 @@
|
|
|
61
61
|
"license": "MIT",
|
|
62
62
|
"homepage": "https://github.com/SBoudrias/Inquirer.js",
|
|
63
63
|
"dependencies": {
|
|
64
|
-
"@inquirer/prompts": "^2.
|
|
64
|
+
"@inquirer/prompts": "^2.1.0",
|
|
65
65
|
"chalk": "^4.1.2"
|
|
66
66
|
},
|
|
67
67
|
"publishConfig": {
|
|
68
68
|
"access": "public"
|
|
69
69
|
},
|
|
70
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "d48ecde923e5875de631f7b50f67cfaf00384947"
|
|
71
71
|
}
|