From 6f870fd1a61f3b883e80d15982e9aba55b80a1b5 Mon Sep 17 00:00:00 2001 From: Ahmad Nassri Date: Fri, 18 Oct 2024 09:59:37 -0400 Subject: [PATCH] feat(cli): add flag to disable update notifications (#1740) --- .changeset/little-badgers-occur.md | 5 +++++ README.md | 4 ++++ packages/cli/src/utils/update-version-notifier.ts | 5 ++++- 3 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 .changeset/little-badgers-occur.md diff --git a/.changeset/little-badgers-occur.md b/.changeset/little-badgers-occur.md new file mode 100644 index 0000000000..398b5bdaab --- /dev/null +++ b/.changeset/little-badgers-occur.md @@ -0,0 +1,5 @@ +--- +"@redocly/cli": patch +--- + +Added the `REDOCLY_SUPPRESS_UPDATE_NOTICE` environment variable so that users can skip version updates. diff --git a/README.md b/README.md index ed4ce86cbf..28f062471c 100644 --- a/README.md +++ b/README.md @@ -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/). diff --git a/packages/cli/src/utils/update-version-notifier.ts b/packages/cli/src/utils/update-version-notifier.ts index ce8ce9c69d..5beead6664 100644 --- a/packages/cli/src/utils/update-version-notifier.ts +++ b/packages/cli/src/utils/update-version-notifier.ts @@ -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) {