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

feat: timer indicator for spinner #230

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

mdjastrzebski
Copy link

@mdjastrzebski mdjastrzebski commented Jan 27, 2025

Summary

Adds spinner option for showing timer instead of animated dots at the end ... .

spinner() // defaults to dots for compatibility
spinner({ indicator: `dots` }) // explicitly set dots
spinner({ indicator: `timer` }) // enable timer indicator

Manually adding timer (or any other custom progress indicator) results in too verbose logging on CI, as each partial update results in new spinner message.

Visualization

CleanShot.2025-01-27.at.16.47.37.mp4

Testing

Run pnpm spinner-timer in examples/basic. Also check spinner and spinner-ci to ensure that default behavior is not broken.

Discussion points

  1. This could alternatively be implemented as a more general progress indicator where user would provide the indicator callback to run and which would be ignored by the CI.
  2. Should ... loading dots be kept when timer is running? Currently they have a different cadence, which creates a weird effect. If we were to keep them it would make sense to sync them to the timer, i.e. one do per second (or maybe 1/2 second)

Copy link

changeset-bot bot commented Jan 27, 2025

🦋 Changeset detected

Latest commit: 96106bd

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@clack/prompts Minor

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

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

Successfully merging this pull request may close these issues.

1 participant