Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Built-in prompt support #169

@pi0

Description

@pi0

Having an easy way to support console input prompts was always missing.

I have been thinking for a while how we could add it to the consola core without adding to initial bundle load overhead and finally thinking we could have await consola.prompt(message, { type, ... }) that lazily imports the actual prompt utils from consola/prompt subpath.

For implementation, writing from scratch is probably reinventing the wheel while at least there are two awesome options prompts and clack. propts seems more feature rich and tested but it is not updated for a while and has 204kb bundle impact comparing to 38KB bundle impact of clack (core).

Trying clak, i really love the core/theme splited implementation. Only since theme is not customizable to be consistent with consola's styling, I'm thinking to copy @clak/prompts and add styling directly from consola, hoping at some point, we might have an upstream refactor to allow directly using @clak/propmts and be better in sync.

About API, i am thinking to introduce only on simple consola.prompt({ type, message }) util adding types progressively and mapping to the underlying engine.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions