Refactor the API for stopping spinners & progress bars#405
Merged
43081j merged 3 commits intobombshell-dev:mainfrom Oct 22, 2025
Merged
Refactor the API for stopping spinners & progress bars#40543081j merged 3 commits intobombshell-dev:mainfrom
43081j merged 3 commits intobombshell-dev:mainfrom
Conversation
🦋 Changeset detectedLatest commit: 8762203 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
dreyfus92
approved these changes
Oct 21, 2025
Member
dreyfus92
left a comment
There was a problem hiding this comment.
this is very solid, thank you Chris, welcome to the clack gang! 🤘🏻
|
@example/basic • @example/changesets commit: |
Collaborator
|
looks good to me 👍 can you add a test or two for passing a non-empty message? |
Contributor
Author
Done! |
43081j
approved these changes
Oct 22, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
As discussed on Discord, this PR proposes a change to the API for stopping spinners and progress bars.
Currently these use a slightly awkward API using a positional argument to pass a numeric code to set whether the stop is successful or the result of an error or cancellation, e.g.
spinner.stop(undefined, 1).This PR proposes removing the error code form in favour of distinct
spinner.cancel()andspinner.error()methods.This is a breaking change for anyone using the code API currently.
Notes
This PR does not change any of the existing semantics around how “cancel” and “error” are represented and preserves the current behaviour where a “cancel” code shows a red square and an “error” code shows a yellow triangle.
This is different from the
.error()method of thelogutility, which shows a red square.An alternative refactor could be to rename to
.stopAndWarn()(current “error” behaviour) and.stopAndError()(current “cancel” behaviour), or something like that, which would align with howlog.warnandlog.errorlook.Or, another alternative would be to switch to an object argument like
.stop({ type: 'warn' }), which could also resolve the awkwardness of the current positional style and avoid multiple methods.Docs
This will require an update to https://bomb.sh/docs/clack/packages/prompts/#spinner