-
Notifications
You must be signed in to change notification settings - Fork 352
feat(cooldown): support for cooldown predicate function #1563
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(cooldown): support for cooldown predicate function #1563
Conversation
raineorshine
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! This looks great.
| it('throws error for negative cooldown', () => { | ||
| expect( | ||
| ncu({ | ||
| packageFile: 'test/test-data/cooldown/package.json', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't seem right that the packageFile was removed. Can you explain?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@raineorshine Yes, this is intentional. I removed the test/test-data/cooldown/package.json file in an earlier PR but missed the references in these two tests. Since both are designed to fail during options type checking, NCU never reaches the code that loads or checks the package path. The issue only became visible when I temporarily broke the options checker during development. Keeping the packageFile option in these tests could be misleading, as the referenced file no longer exists.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see! Thanks for clarifying!
| it('throws error for negative cooldown', () => { | ||
| expect( | ||
| ncu({ | ||
| packageFile: 'test/test-data/cooldown/package.json', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see! Thanks for clarifying!
Description
This PR adds support for passing a predicate function to the cooldown option, providing more granular (per-package) control over cooldown behavior — for example, setting different cooldown durations or disabling cooldowns for specific packages (see example below).
Docs
You can also provide a custom function in your .ncurc.js file or when importing npm-check-updates as a module.
Resolves: #1562