Skip to content

Commit 22ae264

Browse files
committed
Feat(inquirer): Replace core prompts with the new @inquirer/prompts
1 parent 6ec598b commit 22ae264

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+531
-5372
lines changed
Binary file not shown.
Binary file not shown.
Binary file not shown.

packages/inquirer/README.md

Lines changed: 16 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -94,24 +94,25 @@ inquirer
9494
});
9595
```
9696

97-
If you're using Typescript, you'll also want to [add `@types/inquirer`](https://www.npmjs.com/package/@types/inquirer).
98-
9997
<a name="examples"></a>
10098

10199
### Examples (Run it and see it)
102100

103101
Check out the [`packages/inquirer/examples/`](https://github.com/SBoudrias/Inquirer.js/tree/master/packages/inquirer/examples) folder for code and interface examples.
104102

105103
```shell
106-
node packages/inquirer/examples/pizza.js
107-
node packages/inquirer/examples/checkbox.js
104+
yarn node packages/inquirer/examples/pizza.js
105+
yarn node packages/inquirer/examples/checkbox.js
108106
# etc...
109107
```
110108

111109
### Methods
112110

113111
<a name="methods"></a>
114112

113+
> [!WARNING]
114+
> Those interfaces are not necessary for modern Javascript, while still maintained, they're depreciated. We highly encourage you to adopt the more ergonomic and modern API with [@inquirer/prompts](https://www.npmjs.com/package/@inquirer/prompts). Both `inquirer` and `@inquirer/prompts` are usable at the same time, so you can progressively migrate.
115+
115116
#### `inquirer.prompt(questions, answers) -> promise`
116117

117118
Launch the prompt interface (inquiry session)
@@ -323,29 +324,6 @@ The `postfix` property is useful if you want to provide an extension.
323324

324325
`prompt()` requires that it is run in an interactive environment. (I.e. [One where `process.stdin.isTTY` is `true`](https://nodejs.org/docs/latest-v12.x/api/process.html#process_a_note_on_process_i_o)). If `prompt()` is invoked outside of such an environment, then `prompt()` will return a rejected promise with an error. For convenience, the error will have a `isTtyError` property to programmatically indicate the cause.
325326

326-
## User Interfaces and layouts
327-
328-
Along with the prompts, Inquirer offers some basic text UI.
329-
330-
#### Bottom Bar - `inquirer.ui.BottomBar`
331-
332-
This UI present a fixed text at the bottom of a free text zone. This is useful to keep a message to the bottom of the screen while outputting command outputs on the higher section.
333-
334-
```javascript
335-
const ui = new inquirer.ui.BottomBar();
336-
337-
// pipe a Stream to the log zone
338-
outputStream.pipe(ui.log);
339-
340-
// Or simply write output
341-
ui.log.write('something just happened.');
342-
ui.log.write('Almost over, standby!');
343-
344-
// During processing, update the bottom bar content to display a loader
345-
// or output a progress bar, etc
346-
ui.updateBottomBar('new bottom bar content');
347-
```
348-
349327
<a name="reactive"></a>
350328

351329
## Reactive interface
@@ -422,7 +400,7 @@ Please refer to the [GitHub releases section for the changelog](https://github.c
422400
<a name="contributing"></a>
423401

424402
**Unit test**
425-
Please add a unit test for every new feature or bug fix. `npm test` to run the test suite.
403+
Please add a unit test for every new feature or bug fix. `yarn test` to run the test suite.
426404

427405
**Documentation**
428406
Add documentation for every API change. Feel free to send typo fixes and better docs!
@@ -443,6 +421,16 @@ Licensed under the MIT license.
443421

444422
<a name="plugins"></a>
445423

424+
You can build custom prompts, or use open sourced ones. See [`@inquirer/core` documentation for building custom prompts](https://github.com/SBoudrias/Inquirer.js/tree/master/packages/core).
425+
426+
You can either call the custom prompts directly, or you can register them:
427+
428+
```js
429+
import CustomPrompt from '$$$/custom-prompt';
430+
431+
inquirer.registerPrompt('custom', CustomPrompt);
432+
```
433+
446434
### Prompts
447435

448436
[**autocomplete**](https://github.com/mokkabonna/inquirer-autocomplete-prompt)<br>

packages/inquirer/examples/bottom-bar.mts

Lines changed: 0 additions & 20 deletions
This file was deleted.

packages/inquirer/examples/checkbox.mts renamed to packages/inquirer/examples/checkbox.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Checkbox list examples
33
*/
44

5-
import inquirer from '../src/index.mjs';
5+
import inquirer from '../dist/esm/index.mjs';
66

77
inquirer
88
.prompt([

packages/inquirer/examples/editor.mts renamed to packages/inquirer/examples/editor.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Editor prompt example
33
*/
44

5-
import inquirer from '../src/index.mjs';
5+
import inquirer from '../dist/esm/index.mjs';
66

77
const questions = [
88
{

packages/inquirer/examples/expand.mts renamed to packages/inquirer/examples/expand.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Expand list examples
33
*/
44

5-
import inquirer from '../src/index.mjs';
5+
import inquirer from '../dist/esm/index.mjs';
66

77
inquirer
88
.prompt([

packages/inquirer/examples/filter-validate-progress.mts renamed to packages/inquirer/examples/filter-validate-progress.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Filter and validate progress example
33
*/
44

5-
import inquirer from '../src/index.mjs';
5+
import inquirer from '../dist/esm/index.mjs';
66

77
const questions = [
88
{

packages/inquirer/examples/hierarchical.mts renamed to packages/inquirer/examples/hierarchical.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Heirarchical conversation example
33
*/
44

5-
import inquirer from '../src/index.mjs';
5+
import inquirer from '../dist/esm/index.mjs';
66

77
const directionsPrompt = {
88
type: 'list',

0 commit comments

Comments
 (0)