@inquirer/demo 0.9.1 → 0.9.3
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/loader.mjs +2 -2
- package/index.mjs +33 -12
- package/package.json +5 -4
package/demos/loader.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import * as url from 'node:url';
|
|
|
2
2
|
import { createPrompt, useKeypress, usePrefix, isEnterKey } from '@inquirer/core';
|
|
3
3
|
|
|
4
4
|
const loader = createPrompt((config, done) => {
|
|
5
|
-
const prefix = usePrefix({
|
|
5
|
+
const prefix = usePrefix({ status: 'loading' });
|
|
6
6
|
|
|
7
7
|
useKeypress((key) => {
|
|
8
8
|
if (isEnterKey(key)) {
|
|
@@ -14,7 +14,7 @@ const loader = createPrompt((config, done) => {
|
|
|
14
14
|
});
|
|
15
15
|
|
|
16
16
|
const demo = async () => {
|
|
17
|
-
await loader();
|
|
17
|
+
await loader({}, { clearPromptOnDone: true });
|
|
18
18
|
};
|
|
19
19
|
|
|
20
20
|
if (import.meta.url.startsWith('file:')) {
|
package/index.mjs
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
import { select } from '@inquirer/prompts';
|
|
4
|
+
import colors from 'yoctocolors-cjs';
|
|
5
|
+
import figures from '@inquirer/figures';
|
|
4
6
|
import checkboxDemo from './demos/checkbox.mjs';
|
|
5
7
|
import confirmDemo from './demos/confirm.mjs';
|
|
6
8
|
import editorDemo from './demos/editor.mjs';
|
|
@@ -46,17 +48,27 @@ async function askNextDemo() {
|
|
|
46
48
|
{ name: 'Advanced demos', value: 'advanced' },
|
|
47
49
|
{ name: "Exit (I'm done)", value: 'exit' },
|
|
48
50
|
],
|
|
51
|
+
theme: {
|
|
52
|
+
prefix: {
|
|
53
|
+
done: colors.magenta(figures.play),
|
|
54
|
+
},
|
|
55
|
+
},
|
|
49
56
|
});
|
|
50
57
|
|
|
51
58
|
if (selectedDemo === 'advanced') {
|
|
52
|
-
selectedDemo = await select(
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
59
|
+
selectedDemo = await select(
|
|
60
|
+
{
|
|
61
|
+
message: 'Which demo do you want to run?',
|
|
62
|
+
choices: [
|
|
63
|
+
{ name: 'Default value after timeout', value: 'timeout' },
|
|
64
|
+
{ name: 'Loader', value: 'loader' },
|
|
65
|
+
{ name: 'Go back', value: 'back' },
|
|
66
|
+
],
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
clearPromptOnDone: true,
|
|
70
|
+
},
|
|
71
|
+
);
|
|
60
72
|
}
|
|
61
73
|
|
|
62
74
|
if (selectedDemo === 'back') {
|
|
@@ -67,9 +79,18 @@ async function askNextDemo() {
|
|
|
67
79
|
}
|
|
68
80
|
|
|
69
81
|
(async () => {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
82
|
+
try {
|
|
83
|
+
let nextDemo = await askNextDemo();
|
|
84
|
+
while (nextDemo !== 'exit') {
|
|
85
|
+
await demos[nextDemo]();
|
|
86
|
+
nextDemo = await askNextDemo();
|
|
87
|
+
}
|
|
88
|
+
} catch (error) {
|
|
89
|
+
if (error.name === 'ExitPromptError') {
|
|
90
|
+
// noop; silence this error
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
throw error;
|
|
74
95
|
}
|
|
75
96
|
})();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inquirer/demo",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.3",
|
|
4
4
|
"engines": {
|
|
5
5
|
"node": ">=18"
|
|
6
6
|
},
|
|
@@ -61,13 +61,14 @@
|
|
|
61
61
|
"license": "MIT",
|
|
62
62
|
"homepage": "https://github.com/SBoudrias/Inquirer.js",
|
|
63
63
|
"dependencies": {
|
|
64
|
-
"@inquirer/core": "^9.1
|
|
65
|
-
"@inquirer/
|
|
64
|
+
"@inquirer/core": "^9.2.1",
|
|
65
|
+
"@inquirer/figures": "^1.0.6",
|
|
66
|
+
"@inquirer/prompts": "^6.0.1",
|
|
66
67
|
"yoctocolors-cjs": "^2.1.2"
|
|
67
68
|
},
|
|
68
69
|
"publishConfig": {
|
|
69
70
|
"access": "public"
|
|
70
71
|
},
|
|
71
72
|
"sideEffects": false,
|
|
72
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "9e29035c2efc78f44aed3c7732aee46ab1d64ca2"
|
|
73
74
|
}
|