Skip to content

Prompts Background

Prompts Background is a minimalistic wrapper around Node.jsโ€™ readline module, tho it can be used anywhere (like in the browser) by matching readlineโ€™s createInterface output.


I was previously using an external library for this in my CLI tools, but I just needed a simpler implementation and I wanted to try the native solution provided by Node.js. For now it only has a question util on it, but the idea is to add other stuff as I need.


I built this library using TypeScript, with configurations from my shared configs. I made it ESM only as soon as Node started supporting ESM modules, and I made it tree-shakeable by using named exports.

I reworked original implementation so it can also work in the browser. Originally it was only meant to be used in the CLI, but now it could even be used with the browser prompt function, or anything like that.


Now is only used by create-package, I havenโ€™t found much more use for it yet, other than optimizing the size of my libraries and learning about CLI prompts.