Skip to content

fix: show update notice on next run#12

Closed
ZeeshanAdilButt wants to merge 1 commit into
mainfrom
fix/update-notice
Closed

fix: show update notice on next run#12
ZeeshanAdilButt wants to merge 1 commit into
mainfrom
fix/update-notice

Conversation

@ZeeshanAdilButt

Copy link
Copy Markdown
Collaborator

Summary

  • The previous approach used Promise.race with a 500ms window after the command completed. For fast commands (help, version, status) the window often expired before the npm registry responded, so users never saw the update notice.
  • Switched to a write-on-check, show-on-next-run pattern used by npm, Homebrew, and others:
    • showPendingUpdateNotice() — reads a notice file at process start (before command output), prints the banner, deletes the file
    • scheduleUpdateCheck() — fires a background registry check with no await; if a newer version is found, writes the notice file for the next run
  • Notice now appears before command output (top of run) rather than appended at the bottom
  • Existing maybeNotifyUpdate export kept for backward compat with any direct imports

Test plan

  • npm test — all 204 tests pass
  • Run any fast command twice after an old version is in cache: notice appears on the second run
  • OLOSTEP_NO_UPDATE_CHECK=1 olostep version — no notice written or shown
  • olostep update — no notice written or shown

@ZeeshanAdilButt

Copy link
Copy Markdown
Collaborator Author

consolidating into single 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