diff --git a/README.md b/README.md index 1c2b82a78..ea3e35c88 100644 --- a/README.md +++ b/README.md @@ -22,12 +22,11 @@ A collection of common interactive command line user interfaces. 2. [User Interfaces and Layouts](#layouts) 1. [Reactive Interface](#reactive) 3. [Support](#support) -4. [Nodemon](#nodemon-support) -5. [Known issues](#issues) -6. [News](#news) -7. [Contributing](#contributing) -8. [License](#license) -9. [Plugins](#plugins) +4. [Known issues](#issues) +5. [News](#news) +6. [Contributing](#contributing) +7. [License](#license) +8. [Plugins](#plugins) ## Goal and Philosophy @@ -136,8 +135,7 @@ prompt(questions).then(/* ... */); A question object is a `hash` containing question related values: -- **type**: (String) Type of the prompt. Defaults: `input` - Possible values: `input`, `number`, `confirm`, - `list`, `rawlist`, `expand`, `checkbox`, `password`, `editor` +- **type**: (String) Type of the prompt. Defaults: `input` - Possible values: `input`, `number`, `confirm`, `list`, `rawlist`, `expand`, `checkbox`, `password`, `editor` - **name**: (String) The name to use when storing the answer in the answers hash. If the name contains periods, it will define a path in the answers hash. - **message**: (String|Function) The question to print. If defined as a function, the first parameter will be the current inquirer session answers. Defaults to the value of `name` (followed by a colon). - **default**: (String|Number|Boolean|Array|Function) Default value(s) to use if nothing is entered, or a function that returns the default value(s). If defined as a function, the first parameter will be the current inquirer session answers. @@ -387,30 +385,6 @@ look at issues found on other command line - feel free to report any! - gnome-terminal (Terminal GNOME) - konsole -## Nodemon Support - -When executing with [`Nodemon`](https://www.npmjs.com/package/nodemon), you'll need to set `stdin: false` in your config: - -```diff - { - "watch": [ - "dist/" - ], - "ext": "js, json", -+ "stdin": false, - "ignore": [ - "src/*/.spec.ts", - "typescript", - "node_modules" - ], - "events": { - "start": "cls || clear" - }, - "script": "dist/myApp.js", - "restartable": false - } -``` - ## Known issues diff --git a/packages/password/package.json b/packages/password/package.json index b6729587f..3d3c868e7 100644 --- a/packages/password/package.json +++ b/packages/password/package.json @@ -54,6 +54,7 @@ "homepage": "https://github.com/SBoudrias/Inquirer.js/blob/master/packages/password/README.md", "dependencies": { "@inquirer/input": "^0.0.27-alpha.0", + "@inquirer/type": "^0.0.3-alpha.0", "chalk": "^5.0.1" }, "scripts": { diff --git a/packages/password/src/index.ts b/packages/password/src/index.ts index e5d424fee..d618b9f9e 100644 --- a/packages/password/src/index.ts +++ b/packages/password/src/index.ts @@ -1,3 +1,4 @@ +import type { Prompt } from '@inquirer/type'; import input from '@inquirer/input'; import chalk from 'chalk'; @@ -5,7 +6,7 @@ type PasswordConfig = Parameters[0] & { mask?: boolean | string; }; -export default (config: PasswordConfig, stdio?: Parameters[1]) => { +const password: Prompt = (config, context) => { if (config.transformer) { throw new Error( 'Inquirer password prompt do not support custom transformer function. Use the input prompt instead.' @@ -28,6 +29,8 @@ export default (config: PasswordConfig, stdio?: Parameters[1]) => return ''; }, }, - stdio + context ); }; + +export default password; diff --git a/packages/type/src/index.ts b/packages/type/src/index.ts index ee925d964..1d54df345 100644 --- a/packages/type/src/index.ts +++ b/packages/type/src/index.ts @@ -1,4 +1,4 @@ -type Context = { +export type Context = { input?: NodeJS.ReadableStream; output?: NodeJS.WritableStream; clearPromptOnDone?: boolean;