@inquirer/confirm 0.0.20-alpha.0 → 0.0.23-alpha.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/package.json CHANGED
@@ -1,10 +1,13 @@
1
1
  {
2
2
  "name": "@inquirer/confirm",
3
3
  "type": "module",
4
- "version": "0.0.20-alpha.0",
4
+ "version": "0.0.23-alpha.0",
5
5
  "description": "Inquirer confirm prompt",
6
6
  "main": "dist/index.js",
7
7
  "typings": "dist/index.d.ts",
8
+ "files": [
9
+ "dist/"
10
+ ],
8
11
  "repository": "SBoudrias/Inquirer.js",
9
12
  "keywords": [
10
13
  "cli",
@@ -19,8 +22,8 @@
19
22
  "license": "MIT",
20
23
  "homepage": "https://github.com/SBoudrias/Inquirer.js/blob/master/packages/confirm/README.md",
21
24
  "dependencies": {
22
- "@inquirer/core": "^0.0.21-alpha.0",
23
- "@inquirer/input": "^0.0.21-alpha.0",
25
+ "@inquirer/core": "^0.0.24-alpha.0",
26
+ "@inquirer/input": "^0.0.24-alpha.0",
24
27
  "chalk": "^5.0.1"
25
28
  },
26
29
  "scripts": {
@@ -29,5 +32,5 @@
29
32
  "publishConfig": {
30
33
  "access": "public"
31
34
  },
32
- "gitHead": "cd0d1465327c0e98a89c937a80b7c473b6d00f74"
35
+ "gitHead": "0e054fd0b58bf56e94088136dfd36b74246a5187"
33
36
  }
package/demo.ts DELETED
@@ -1,18 +0,0 @@
1
- import confirm from './src/index.js';
2
-
3
- (async () => {
4
- console.log(
5
- 'Answer:',
6
- await confirm({
7
- message: 'Confirm?',
8
- })
9
- );
10
-
11
- console.log(
12
- 'Answer:',
13
- await confirm({
14
- message: 'Confirm with default to no?',
15
- default: false,
16
- })
17
- );
18
- })();
package/src/index.ts DELETED
@@ -1,38 +0,0 @@
1
- import chalk from 'chalk';
2
- import {
3
- createPrompt,
4
- useState,
5
- useKeypress,
6
- isEnterKey,
7
- usePrefix,
8
- } from '@inquirer/core';
9
-
10
- export default createPrompt<boolean, { message: string; default?: boolean }>(
11
- (config, done) => {
12
- const [status, setStatus] = useState('pending');
13
- const [value, setValue] = useState('');
14
- const prefix = usePrefix();
15
-
16
- useKeypress((key, rl) => {
17
- if (isEnterKey(key)) {
18
- const answer = value ? /^y(es)?/i.test(value) : config.default !== false;
19
- setValue(answer ? 'yes' : 'no');
20
- setStatus('done');
21
- done(answer);
22
- } else {
23
- setValue(rl.line);
24
- }
25
- });
26
-
27
- let formattedValue = value;
28
- let defaultValue = '';
29
- if (status === 'done') {
30
- formattedValue = chalk.cyan(value);
31
- } else {
32
- defaultValue = chalk.dim(config.default === false ? ' (y/N)' : ' (Y/n)');
33
- }
34
-
35
- const message = chalk.bold(config.message);
36
- return `${prefix} ${message}${defaultValue} ${formattedValue}`;
37
- }
38
- );
package/tsconfig.json DELETED
@@ -1,7 +0,0 @@
1
- {
2
- "extends": "../../tsconfig.json",
3
- "compilerOptions": {
4
- "outDir": "./dist"
5
- },
6
- "include": ["./src"]
7
- }