Inquirer.js: [Refactor] Tasks tracker

Created on 23 Jun 2018  路  9Comments  路  Source: SBoudrias/Inquirer.js

This tickets will list tasks that need to be completed to wrap-up Inquirer's core refactor.

I would love to have your help and make this refactor a success! Please comment below and let me know if you want to take ownership of a task. You can also jump into the gitter chat room and ping me over there if you get stuck.

Basic prompt core re-implementation PR is over at #688 and the initial refactoring scope was discussed on #685.

Goals

  1. Faster and smaller package
  2. All prompt will work standalone
  3. Public facing backward compatible API (inquirer.prompt)

Note: With standalone prompt, this mean we'll be able to release those as soon as they're ready.

Tasks

Rewriting prompts

  • [x] input prompt

    • [x] default option support

    • [x] transformer option support

  • [ ] number prompt
  • [x] password prompt
  • [x] confirm prompt
  • [x] list prompt
  • [x] checkbox prompt
  • [x] expand prompt
  • [ ] editor prompt
  • [ ] rawlist prompt

Infra

  • [ ] Core

    • [x] Support prefix overwrite

    • [x] List pagination module

    • [x] Handle multiline options gracefully

    • [ ] Support for separators

    • [ ] Truncate non-highlighted options? (maybe as a configuration option?)

  • [ ] Performance

    • [ ] Setup automated performance regression check

    • [ ] Setup automated package size regression check

  • [ ] Support Node 6 (we want to use async/await)

    • [ ] Add typescript?

    • [ ] Add babel build step?

  • [ ] Rewrite documentation
  • [ ] Better behavior for edge cases

    • [ ] Non interactives terminals (#495)

    • [ ] Pipe support? e.g. yes | command-using-inquirer

Top level API

  • [ ] Re-implement inquirer package to use the new prompts API
  • [ ] Create a demo package we can easily use with npx

Do leave comments to if you think some tasks should be added to the refactor backlog!

Most helpful comment

+1 for TypeScript!

All 9 comments

I will 100% help get Inquirer setup with TypeScript. That will be a good task to start off with for me.

Depending on the timeline of this refactor, we may want to consider targeting Node 8 as a minimum. Node 6 will reach end-of-life next April: https://github.com/nodejs/Release Node 8 will allow us to use async/await natively.

Yeah, we'll see how much people contribute and how fast this move forward. But I'd like the refactor to be completed in a few months.

But anyway, by adding typescript, it'd be easy to support Node 6 no?

It'd be easy, but there are two issues: 1) Missing newer Node APIs and 2) The output to Node 6 is ES2016, so when new syntax is used, TypeScript has to do some pretty ugly transforms, which result in ugly stack traces.

But... those issues probably aren't big enough reasons not to support Node 6.

We can always support a minimum of Node 8 later by "flipping the switch" and doing a major release. TypeScript will then output ES2017.

+1 for TypeScript!

Should a way to write unit tests for apps build with Inquirer be aded in the refactoring? See #379 for a proposed API.

Not being able to test your code is a blocker for me and prevent me to use Inquirer (I had to switch to prompts that offer the inject method but there is many Inquirer features that I miss). The issue #379 is also the most thumbed up in the issue tracker, so I imagine I'm not the only one in that situation.

Even if a complex API like the one described in #379 is out of this refactoring scope, that would be great if at a minimum:

  • We had a simple function to inject answers in unit test. Inquirer would just skip prompting the user and would use each answer injected. It would still trigger the onEachAnswer, onError and onComplete callbacks.
  • We had access to function/state that would ultimately allow to develop a test module with the API described in #379.

+1 for TypeScript!

I've worked on a new API for the core prompt interface on this branch https://github.com/SBoudrias/Inquirer.js/tree/feature/replace-new-core-with-hooks-like-implementation

It works pretty much the same way as react hooks and so far has been quite extensible to fit the needs of the prompts I've reimplemented. I'd like to gather feedback on that API. See refactors of the input, password, confirm and select prompts.

@SBoudrias The link is broken.

Hey @frangio it's been merged to the master branch already.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jahvi picture jahvi  路  6Comments

aguerrieri picture aguerrieri  路  6Comments

Mrooze-zeng picture Mrooze-zeng  路  5Comments

fuechter picture fuechter  路  3Comments

lvjiaxuan picture lvjiaxuan  路  6Comments