6

Say Allo' to the new Inquirer (release of the rewrite) · SBoudrias/Inquirer.js ·...

 1 year ago
source link: https://github.com/SBoudrias/Inquirer.js/discussions/1214
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Say Allo' to the new Inquirer (release of the rewrite) · SBoudrias/Inquirer.js · Discussion #1214 · GitHub

Hi all,

First of all, I want to say thanks for your support those last 10 years! It's amazing to see Inquirer still getting so much usage (7.6M users!) and so many downloads (~30M per week!)

5 years ago in 2018, I started to work on this complete rewrite of the Inquirer codebase. Many reasons made this rewrite take so long. First of all, I reoriented my career towards engineering leadership after moving to China in 2017. I did find myself with less energy for open source after work. Secondly, a rewrite of such a large library is plainly scary! The thought of breaking backward compatibility and pushing users through a migration hell just wasn't appealing. I think finally today I've reached a good position where I'm confident to advertise this work as the new official Inquirer.

Allo' allo' to @inquirer/prompts!

The new Inquirer

The rewrite had 3 major goals:

  1. Reduce the package size / faster load time. CLI programs are user facing, and just as on the web, load time and performance matters.
  2. Provide a good API to create custom prompts; and an API to test them.
  3. Embrace Typescript

@inquirer/prompts (~12kb) is a ease-of-use package combining all core prompts:

All prompts are also available as standalone packages if you want to minimize your package size further. As a comparison basis, the inquirer package is ~242kb.

Backward compatibility

The new @inquirer/prompts package isn't backward compatible with the inquirer package. I've been punting a long time rewriting the inquirer package itself. JavaScript & Node came a long way since the days of Node 0.8! At that time, writing JS code and managing state was much harder. So inquirer came with built-in flow management. In 2023, there's in my opinion little need to expose state/flow management utilities. Promises are built-in, we get to enjoy async/await, we have good loops utilities, streams are streamlined, and the readline module just work scream.

The inquirer package is still part of the monorepo, and I'll be keeping it up to date and under maintenance mode. Maybe one day it'll be rewritten. For now, new usage of Inquirer can start fresh with a leaner package.

Contributing

Do you want to help? Here's a few ways:

  1. All the documentation has been rewritten. Proof reading or your help covering oversights, or adding more recipes/examples is highly welcomed!
  2. You can create new community prompts and advertising them here.
  3. Help with the development! Some core features commonly asked are: support for theming, support for translation, etc. Kick off a discussion thread if you're searching a project to take on, we can discuss!

In conclusion

I hope you'll enjoy the new Inquirer interface. And I hope it'll empower you to create custom prompts and interfaces for you own CLI programs.

The quality of Node based tooling is amazing, I hope we can continue making this dev environment the absolute best in class!


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK