Skip to content

feat: add cooldown format and improved visibility for skipped updates#1711

Open
onemen wants to merge 2 commits intoraineorshine:mainfrom
onemen:pr/skipped-by-cooldown
Open

feat: add cooldown format and improved visibility for skipped updates#1711
onemen wants to merge 2 commits intoraineorshine:mainfrom
onemen:pr/skipped-by-cooldown

Conversation

@onemen
Copy link
Copy Markdown
Contributor

@onemen onemen commented May 3, 2026

closes #1690

Technical Refactor: npm.ts & Cooldown Visibility

I have performed a major refactor of npm.ts to support the new --format cooldown option while improving overall performance and code maintainability.

Key Changes:

  • findTargetAndFallback: Introduced a single-pass reducer that filters and resolves both the target upgrade version and a cooldown fallback simultaneously. By iterating through available versions only once, it avoids multiple loops for filtering and sorting, making the detection of "cooldown-safe" versions significantly more efficient.
  • toVersionResult: This new utility standardizes how raw resolution data is formatted into a VersionResult object. It wraps the target version with its publish time and, if a cooldown is active, attaches the fallback version and relevant metadata.
  • Uniform Implementation: With these two functions, the implementation across all target functions is now uniform, significantly reducing boilerplate and improving readability.

PR Highlights:

  • Enhanced Visibility: Added --format cooldown to display a dedicated "Skipped due to x-day cooldown" section in the terminal, listing version changes and release ages.
  • Comprehensive Testing: Added new test cases to cooldown.test.ts to verify the logic and the new formatting output.
  • Documentation:
    • Updated the --format options table in the README.md.
    • Added a detailed "Cooldown Formatting" section with usage examples to the README.md at the end of cooldown section.

@raineorshine,
Currently, this new format logic does not apply when options.json is used. Please let me know if you would like me to extend this support to the JSON output as well.

@onemen onemen force-pushed the pr/skipped-by-cooldown branch from 57ce238 to 2645ccf Compare May 3, 2026 21:30
- Implement `--format cooldown` to display packages skipped due to the `--cooldown` timer.
- Add a dedicated "Skipped due to x-day cooldown" section to the terminal output.
- Enhance visibility by listing current version, target version, and release age for skipped packages.
@onemen onemen force-pushed the pr/skipped-by-cooldown branch from 5368fe7 to ff2ec77 Compare May 4, 2026 07:46
@onemen
Copy link
Copy Markdown
Contributor Author

onemen commented May 4, 2026

@raineorshine

this PR is ready for review

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.

Improve visibility of cooldown‑filtered updates and enhance timestamp formatting

1 participant