Skip to content

Commit

Permalink
feat(cli): add flag to disable update notifications (#1740)
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmadnassri authored Oct 18, 2024
1 parent 5a493e7 commit 6f870fd
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/little-badgers-occur.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@redocly/cli": patch
---

Added the `REDOCLY_SUPPRESS_UPDATE_NOTICE` environment variable so that users can skip version updates.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@ If your OpenAPI description isn't everything you hoped it would be, enhance it w

This tool [collects data](./docs/usage-data.md) to help Redocly improve our products and services. You can opt out by setting the `REDOCLY_TELEMETRY` environment variable to `off`.

## Update notifications

Redocly CLI checks for updates on startup. You can disable this by setting the `REDOCLY_SUPPRESS_UPDATE_NOTICE` environment variable to `true`.

## More resources

[Read the detailed docs](https://redocly.com/docs/cli/).
Expand Down
5 changes: 4 additions & 1 deletion packages/cli/src/utils/update-version-notifier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ const SPACE_TO_BORDER = 4;

const INTERVAL_TO_CHECK = 1000 * 60 * 60 * 12;
const SHOULD_NOT_NOTIFY =
process.env.NODE_ENV === 'test' || process.env.CI || !!process.env.LAMBDA_TASK_ROOT;
process.env.NODE_ENV === 'test' ||
process.env.CI ||
!!process.env.LAMBDA_TASK_ROOT ||
process.env.REDOCLY_SUPPRESS_UPDATE_NOTICE === 'true';

export const notifyUpdateCliVersion = () => {
if (SHOULD_NOT_NOTIFY) {
Expand Down

1 comment on commit 6f870fd

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage report

St.
Category Percentage Covered / Total
🟡 Statements 78.57% 4991/6352
🟡 Branches 67.22% 2061/3066
🟡 Functions 72.98% 824/1129
🟡 Lines 78.86% 4709/5971

Test suite run success

809 tests passing in 121 suites.

Report generated by 🧪jest coverage report action from 6f870fd

Please sign in to comment.