Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with prompt (clack) cancellation detect #251

Open
samuelstroschein opened this issue Oct 19, 2023 · 6 comments
Open

Issue with prompt (clack) cancellation detect #251

samuelstroschein opened this issue Oct 19, 2023 · 6 comments

Comments

@samuelstroschein
Copy link

samuelstroschein commented Oct 19, 2023

Environment

/

Reproduction

Describe the bug

Consola bundles the NPM package, leading to downstream bugs.

Proposal

Stop bundling consola.

If bundling is important, the consumer of consola can use a bundler. A consumer using a bundler means the complexity of consola is reduced, bugs that bundling consola introduces are removed, and consola becomes more useful.

Additional context

No response

Logs

No response

samuelstroschein added a commit to opral/monorepo that referenced this issue Oct 19, 2023
Fixing consola not exiting now ... unjs/consola#251
@pi0
Copy link
Member

pi0 commented Oct 19, 2023

Hi dear @samuelstroschein. Thanks for your suggestion. Consola, because of many ecosystem reasons, is zero dependency so it bundles all deps. But it shouldn't be an issue since we can release with new versions fixed deps and there is an automated CI that regularly updates dependencies.

Regarding Clack, as also mentioned in initial integration PR notes, we only inline/fork clack source code because it lacked ability to configure formatting options and inlining code in repo means sadly we miss important upstream fixes unless manually rebasing. Once this is possible, i would be more than happy to also use upstream clack.

@pi0 pi0 changed the title stop bundling consola to avoid bugs avoid inlining clack source Oct 19, 2023
@samuelstroschein
Copy link
Author

Hi @pi0,

Thanks for the response. The bundling/inlining seems to cause bugs, though; see #234 and natemoo-re/clack#83 (comment) specifically.

I don't have enough background to evaluate whether bundling is worth the ecosystem impact.

@pi0 pi0 changed the title avoid inlining clack source Issue with prompt (clack) cancellation detect Oct 25, 2023
@pi0
Copy link
Member

pi0 commented Oct 25, 2023

Thanks for clarification by linking issue. I have shared a suggestion for them there.

We can easily solve it earlier for consola btw as consola API is dedicated to itself .

@samuelstroschein
Copy link
Author

I got it working btw

https://github.com/inlang/monorepo/blob/02856c466a9198c1ccf9d277af3189bb18a42f3c/inlang/source-code/paraglide/paraglide-js/src/cli/commands/init.ts#L308-L314

@pi0
Copy link
Member

pi0 commented Oct 25, 2023

nice workaround!

@GerroDen
Copy link

Thanks for the workaround @samuelstroschein
I moved the solution into my options and ignore the clashing types.

export const logger = createConsola({
  async prompt(...params) {
    const response = await consola.prompt(...params);
    if (isSymbol(response) && response.toString() === "Symbol(clack:cancel)") {
      process.exit(10);
    }
    // types clash massivly. consider switching to clack directly
    return response as never;
  },
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants