Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@oclif/plugin-warn-if-update-available

oclif3.1mMIT3.1.39TypeScript support: included

warns if there is a newer version of CLI released

oclif-plugin

readme

@oclif/plugin-warn-if-update-available

warns if there is a newer version of CLI released

Version Downloads/week License

What is this?

This plugin shows a warning message if a user is running an out of date CLI.

screenshot

How it works

This checks the version against the npm registry asynchronously in a forked process once every 60 days by default (see Configuration for how to configure this). It then saves a version file to the cache directory that will enable the warning. The upside of this method is that it won't block a user while they're using your CLI—the downside is that it will only display after running a command that fetches the new version.

Installation

Add the plugin to your project with yarn add @oclif/plugin-warn-if-update-available, then add it to the package.json of the oclif CLI:

{
  "name": "mycli",
  "version": "0.0.0",
  // ...
  "oclif": {
    "plugins": ["@oclif/plugin-help", "@oclif/plugin-warn-if-update-available"]
  }
}

Configuration

In package.json, set oclif['warn-if-update-available'] to an object with any of the following configuration properties:

  • timeoutInDays - Duration between update checks. Defaults to 60.
  • message - Customize update message.
  • registry - URL of registry. Defaults to following your .npmrc configuration
  • authorization - Authorization header value for registries that require auth. Defaults to following your .npmrc configuration
  • frequency - The frequency that the new version warning should be shown.
  • frequencyUnit - The unit of time that should be used to calculate the frequency (days, hours, minutes, seconds, milliseconds). Defaults to minutes.

Example configuration

{
  "oclif": {
    "plugins": ["@oclif/plugin-warn-if-update-available"],
    "warn-if-update-available": {
      "timeoutInDays": 7,
      "message": "<%= config.name %> update available from <%= chalk.greenBright(config.version) %> to <%= chalk.greenBright(latest) %>.",
      "registry": "https://my.example.com/module/registry",
      "authorization": "Basic <SOME READ ONLY AUTH TOKEN>"
    }
  }
}

Notification Frequency

Once a new version has been found, the default behavior is to notify the user on every command execution. You can modify this by setting the frequency and frequencyUnit options.

Examples

Once every 10 minutes.

{
  "oclif": {
    "warn-if-update-available": {
      "frequency": 10
    }
  }
}

Once every 6 hours.

{
  "oclif": {
    "warn-if-update-available": {
      "frequency": 6,
      "frequencyUnit": "hours"
    }
  }
}

Once a day.

{
  "oclif": {
    "warn-if-update-available": {
      "frequency": 1,
      "frequencyUnit": "days"
    }
  }
}

Once every 30 seconds.

{
  "oclif": {
    "warn-if-update-available": {
      "frequency": 30,
      "frequencyUnit": "seconds"
    }
  }
}

Environment Variables

  • <CLI>_SKIP_NEW_VERSION_CHECK: Skip this version check
  • <CLI>_FORCE_VERSION_CACHE_UPDATE: Force the version cache to update
  • <CLI>_NEW_VERSION_CHECK_FREQ: environment variable override for frequency setting
  • <CLI>_NEW_VERSION_CHECK_FREQ_UNIT: environment variable override for frequencyUnit setting
  • <CLI>_NEW_VERSION_CHECK_TAG: distribution tag to check against (defaults to latest)

Contributing

See contributing guide

changelog

3.1.39 (2025-05-04)

Bug Fixes

  • deps: bump @oclif/core from 4.2.10 to 4.3.0 (#850) (2a8f6e8)

3.1.38 (2025-03-16)

Bug Fixes

  • deps: bump @oclif/core from 4.2.9 to 4.2.10 (#825) (4d257b4)

3.1.37 (2025-03-10)

Bug Fixes

  • deps: bump @oclif/core from 4.2.8 to 4.2.9 (#819) (3c99486)

3.1.36 (2025-03-09)

Bug Fixes

  • deps: bump ansis from 3.16.0 to 3.17.0 (#821) (2d66c35)

3.1.35 (2025-02-23)

Bug Fixes

  • deps: bump registry-auth-token from 5.0.3 to 5.1.0 (#809) (11fe194)

3.1.34 (2025-02-23)

Bug Fixes

  • deps: bump @oclif/core from 4.2.6 to 4.2.8 (#811) (b994183)

3.1.33 (2025-02-09)

Bug Fixes

  • deps: bump @oclif/core from 4.2.4 to 4.2.6 (#800) (83d93e9)

3.1.32 (2025-02-02)

Bug Fixes

  • deps: bump ansis from 3.9.0 to 3.10.0 (#793) (4608412)

3.1.31 (2025-01-19)

Bug Fixes

  • deps: bump @oclif/core from 4.2.2 to 4.2.3 (#783) (b5162ee)

3.1.30 (2025-01-12)

Bug Fixes

  • deps: bump @oclif/core from 4.2.0 to 4.2.2 (#778) (96816d9)

3.1.29 (2024-12-29)

Bug Fixes

  • deps: bump ansis from 3.4.0 to 3.5.2 (#768) (22bf914)

3.1.28 (2024-12-15)

Bug Fixes

  • deps: bump @oclif/core from 4.0.36 to 4.0.37 (#760) (3738e36)

3.1.27 (2024-12-15)

Bug Fixes

  • deps: bump ansis from 3.3.2 to 3.4.0 (#761) (a3ca174)

3.1.26 (2024-12-08)

Bug Fixes

  • deps: bump @oclif/core from 4.0.33 to 4.0.36 (#756) (fb27f76)

3.1.25 (2024-12-08)

Bug Fixes

  • deps: bump debug from 4.3.7 to 4.4.0 (#753) (956c02d)

3.1.24 (2024-12-01)

Bug Fixes

  • deps: bump registry-auth-token from 5.0.2 to 5.0.3 (#750) (8b049ec)

3.1.23 (2024-11-17)

Bug Fixes

  • deps: bump @oclif/core from 4.0.31 to 4.0.32 (#737) (cb27360)

3.1.22 (2024-11-17)

Bug Fixes

  • deps: bump cross-spawn from 7.0.3 to 7.0.5 (#739) (cf7bd9f)

3.1.21 (2024-11-03)

Bug Fixes

  • deps: bump @oclif/core from 4.0.30 to 4.0.31 (#733) (11b7a43)

3.1.20 (2024-10-20)

Bug Fixes

  • deps: bump @oclif/core from 4.0.28 to 4.0.29 (#724) (d65eb01)

3.1.19 (2024-10-13)

Bug Fixes

  • deps: bump @oclif/core from 4.0.27 to 4.0.28 (#718) (8b0bef7)

3.1.18 (2024-09-29)

Bug Fixes

  • deps: bump @oclif/core from 4.0.22 to 4.0.23 (#709) (a502814)

3.1.17 (2024-09-22)

Bug Fixes

  • deps: bump @oclif/core from 4.0.21 to 4.0.22 (#705) (e5d47dd)

3.1.16 (2024-09-13)

Bug Fixes

  • deps: bump path-to-regexp from 6.2.2 to 6.3.0 (#696) (7322702)

3.1.15 (2024-09-08)

Bug Fixes

  • deps: bump @oclif/core from 4.0.19 to 4.0.21 (#693) (bf1088c)

3.1.14 (2024-09-05)

Bug Fixes

  • follow the user's npmrc config by default (#689) (94be8f5)

3.1.13 (2024-08-25)

Bug Fixes

  • deps: bump @oclif/core from 4.0.17 to 4.0.19 (#681) (d011331)

3.1.12 (2024-08-25)

Bug Fixes

  • deps: bump micromatch from 4.0.7 to 4.0.8 (#684) (133a619)

3.1.11 (2024-07-28)

Bug Fixes

  • deps: bump @oclif/core from 4.0.12 to 4.0.17 (#664) (6e91577)

3.1.10 (2024-07-23)

Bug Fixes

3.1.9 (2024-07-14)

Bug Fixes

  • deps: bump @oclif/core from 4.0.8 to 4.0.12 (#647) (61185f7)

3.1.8 (2024-07-07)

Bug Fixes

  • deps: bump @oclif/core from 4.0.7 to 4.0.8 (#641) (74546bf)

3.1.7 (2024-06-30)

Bug Fixes

  • deps: bump @oclif/core from 4.0.6 to 4.0.7 (#635) (51de1c7)

3.1.6 (2024-06-16)

Bug Fixes

  • deps: bump @oclif/core from 4.0.3 to 4.0.6 (#628) (258f406)

3.1.5 (2024-06-09)

Bug Fixes

  • deps: bump @oclif/core from 4.0.0 to 4.0.3 (#621) (08bedf3)

3.1.4 (2024-06-04)

Bug Fixes

3.1.3 (2024-06-03)

Bug Fixes

3.1.2 (2024-06-03)

Bug Fixes

3.1.1 (2024-06-02)

Bug Fixes

  • deps: bump debug from 4.3.4 to 4.3.5 (#614) (6ca288b)

3.1.0 (2024-05-31)

Features

3.0.19 (2024-05-12)

Bug Fixes

  • deps: bump @oclif/core from 3.26.5 to 3.26.6 (#604) (5f520d6)

3.0.18 (2024-05-10)

Bug Fixes

3.0.17 (2024-05-08)

Bug Fixes

  • use lodash instead of lodash.template (d63276f)

3.0.16 (2024-04-24)

Bug Fixes

  • default npm registry to config.npmRegistry (#588) (749f1ba)

3.0.15 (2024-03-24)

Bug Fixes

  • deps: bump @oclif/core from 3.25.2 to 3.26.0 (#564) (a5d80d0)

3.0.14 (2024-03-10)

Bug Fixes

  • deps: bump @oclif/core from 3.21.0 to 3.23.0 (#547) (c0b3705)

3.0.13 (2024-03-06)

Bug Fixes

  • publish npm-shrinkwrap.json (59a550d)

3.0.12 (2024-02-21)

Bug Fixes

3.0.11 (2024-02-18)

Bug Fixes

  • deps: bump @oclif/core from 3.19.1 to 3.19.2 (#528) (f65814f)

3.0.10 (2024-02-04)

Bug Fixes

  • deps: bump @oclif/core from 3.18.1 to 3.18.2 (#516) (b67f35a)

3.0.9 (2024-01-07)

Bug Fixes

  • deps: bump @oclif/core from 3.15.1 to 3.16.0 (#495) (c9fe7fa)

3.0.8 (2023-12-24)

Bug Fixes

  • deps: bump @oclif/core from 3.15.0 to 3.15.1 (#489) (56e08f9)

3.0.7 (2023-12-17)

Bug Fixes

  • deps: bump @oclif/core from 3.14.1 to 3.15.0 (#482) (e5edd00)

3.0.6 (2023-12-10)

Bug Fixes

  • deps: bump @oclif/core from 3.13.1 to 3.14.1 (#476) (bb599d3)

3.0.5 (2023-12-03)

Bug Fixes

  • deps: bump @oclif/core from 3.12.0 to 3.13.1 (#470) (5bf21c6)

3.0.4 (2023-11-26)

Bug Fixes

  • deps: bump @oclif/core from 3.11.0 to 3.12.0 (#465) (da673ee)

3.0.3 (2023-11-19)

Bug Fixes

  • deps: bump @oclif/core from 3.3.1 to 3.11.0 (#458) (c4f1eed)

3.0.2 (2023-10-18)

Bug Fixes

  • deps: bump semver from 5.7.1 to 5.7.2 (#439) (8db9a58)

3.0.1 (2023-10-17)

Bug Fixes

2.1.1 (2023-09-28)

Bug Fixes

  • deps: bump get-func-name from 2.0.0 to 2.0.2 (2008321)

2.1.0 (2023-09-05)

Features

  • dependency reduction and deferred/smaller imports (#413) (1676696)

2.0.50 (2023-09-03)

Bug Fixes

  • deps: bump @oclif/core from 2.11.10 to 2.15.0 (c85d978)

2.0.49 (2023-08-27)

Bug Fixes

  • deps: bump @oclif/core from 2.11.8 to 2.11.10 (3149200)

2.0.48 (2023-08-13)

Bug Fixes

  • deps: bump @oclif/core from 2.11.7 to 2.11.8 (d201be1)

2.0.47 (2023-08-13)

Bug Fixes

  • deps: bump ansi-regex from 3.0.0 to 3.0.1 (8ed09e6)

2.0.46 (2023-07-30)

Bug Fixes

  • deps: bump @oclif/core from 2.9.4 to 2.11.1 (d522372)

2.0.45 (2023-07-23)

Bug Fixes

  • deps: bump @oclif/core from 2.9.3 to 2.9.4 (dcebadd)

2.0.44 (2023-07-19)

Bug Fixes

  • deps: bump word-wrap from 1.2.3 to 1.2.4 (5c7e6a4)

2.0.43 (2023-07-16)

Bug Fixes

  • deps: bump @oclif/core from 2.8.11 to 2.9.3 (baf1455)

2.0.42 (2023-07-09)

Bug Fixes

  • deps: bump semver from 7.5.3 to 7.5.4 (c6b8b28)

2.0.41 (2023-07-02)

Bug Fixes

  • deps: bump @oclif/core from 2.8.7 to 2.8.11 (723eeb6)

2.0.40 (2023-06-25)

Bug Fixes

  • deps: bump semver from 7.5.2 to 7.5.3 (9397160)

2.0.39 (2023-06-18)

Bug Fixes

  • deps: bump semver from 7.5.1 to 7.5.2 (33acc41)

2.0.38 (2023-06-18)

Bug Fixes

  • deps: bump @oclif/core from 2.8.5 to 2.8.7 (c057579)

2.0.37 (2023-05-14)

Bug Fixes

  • deps: bump semver and @types/semver (426f01f)

2.0.36 (2023-04-23)

Bug Fixes

  • deps: bump semver from 7.4.0 to 7.5.0 (52d0f85)

2.0.35 (2023-04-16)

Bug Fixes

  • deps: bump semver from 7.3.8 to 7.4.0 (ed4016a)

2.0.34 (2023-04-16)

Bug Fixes

  • deps: bump @oclif/core from 2.8.0 to 2.8.2 (a89d243)

2.0.33 (2023-03-26)

Bug Fixes

  • deps: bump @oclif/core from 2.6.4 to 2.7.1 (ff50387)

2.0.32 (2023-03-19)

Bug Fixes

  • deps: bump @oclif/core from 2.6.2 to 2.6.4 (b2eeeb9)

2.0.31 (2023-03-12)

Bug Fixes

  • deps: bump @oclif/core from 2.4.0 to 2.6.2 (d334ce8)

2.0.30 (2023-03-05)

Bug Fixes

  • deps: bump @oclif/core from 2.3.1 to 2.4.0 (0b0d40d)

2.0.29 (2023-02-28)

Bug Fixes

  • add check for FORCE_VERSION_CACHE_UPDATE env variable (#357) (ace4bcd)

2.0.28 (2023-02-19)

Bug Fixes

  • deps: bump @oclif/core from 2.1.2 to 2.1.7 (fb2e4dd)

2.0.27 (2023-02-12)

Bug Fixes

  • deps: bump @oclif/core from 2.0.8 to 2.1.2 (8418b7b)

2.0.26 (2023-02-05)

Bug Fixes

  • deps: bump @oclif/core from 2.0.7 to 2.0.8 (3cff551)

2.0.25 (2023-02-05)

Bug Fixes

  • deps: bump http-cache-semantics from 4.1.0 to 4.1.1 (dd76647)

2.0.24 (2023-01-29)

Bug Fixes

  • deps: bump @oclif/core from 2.0.3 to 2.0.7 (3340a13)

2.0.23 (2023-01-24)

Bug Fixes

  • deps: bump minimist from 1.2.5 to 1.2.7 (0b0e601)

2.0.22 (2023-01-24)

Bug Fixes

  • deps: bump glob-parent from 5.1.1 to 5.1.2 (90e2904)

2.0.21 (2023-01-23)

Bug Fixes

2.0.20 (2023-01-22)

Bug Fixes

  • deps: bump @oclif/core from 1.24.0 to 1.25.0 (2e4855d)

2.0.19 (2023-01-15)

Bug Fixes

  • deps: bump @oclif/core from 1.23.1 to 1.24.0 (c8f3356)

2.0.18 (2023-01-01)

Bug Fixes

  • deps: bump @oclif/core from 1.22.0 to 1.23.1 (b05ab39)

2.0.17 (2022-12-18)

Bug Fixes

  • deps: bump @oclif/core from 1.21.0 to 1.22.0 (f34c473)

2.0.16 (2022-12-11)

Bug Fixes

  • deps: bump @oclif/core from 1.20.4 to 1.21.0 (c17db0a)

2.0.15 (2022-12-04)

Bug Fixes

  • deps: bump decode-uri-component from 0.2.0 to 0.2.2 (f668e86)

2.0.14 (2022-11-13)

Bug Fixes

  • deps: bump @oclif/core from 1.20.3 to 1.20.4 (10fff9a)

2.0.13 (2022-11-06)

Bug Fixes

  • deps: bump @oclif/core from 1.20.0 to 1.20.3 (56c514e)

2.0.12 (2022-10-30)

Bug Fixes

  • deps: bump async from 2.6.3 to 2.6.4 (3536f48)

2.0.11 (2022-10-30)

Bug Fixes

  • deps: bump @oclif/core from 1.19.1 to 1.20.0 (f1a4173)

2.0.10 (2022-10-23)

Bug Fixes

  • deps: bump @oclif/core from 1.18.0 to 1.19.1 (388b410)

2.0.9 (2022-10-16)

Bug Fixes

  • deps: bump @oclif/core from 1.16.5 to 1.18.0 (0e252b2)

2.0.8 (2022-10-09)

Bug Fixes

  • deps: bump semver from 7.3.7 to 7.3.8 (02ec356)

2.0.7 (2022-10-09)

Bug Fixes

  • deps: bump @oclif/core from 1.16.4 to 1.16.5 (1a81356)

2.0.6 (2022-09-27)

Bug Fixes

  • deps: bump moment from 2.29.2 to 2.29.4 (51c59d5)

2.0.5 (2022-09-27)

Bug Fixes

  • deps: bump @oclif/core from 1.1.1 to 1.16.4 (b8808ca)

2.0.4 (2022-01-06)

Bug Fixes

2.0.3 (2021-12-17)

2.0.2 (2021-12-07)

Bug Fixes

2.0.1 (2021-12-01)

Bug Fixes

2.0.0 (2021-09-29)

Features

1.7.0 (2019-02-20)

1.6.0 (2019-02-20)

Features

  • allow update message to be customized (#19) (77efd5a)

1.5.4 (2018-10-13)

Bug Fixes

  • remove greenkeeper badge (f030bc1)

1.5.3 (2018-09-14)

Bug Fixes

  • remove greenkeeper-lockfile (e95cd6c)

1.5.2 (2018-08-28)

Bug Fixes

  • hide warning if updating (6be6cd8)

1.5.1 (2018-08-22)

Bug Fixes

  • rename oclif manifest to not be a dotfile (84f870f)

1.5.0 (2018-08-21)

Features

1.4.0 (2018-08-17)

Features

1.3.9 (2018-05-10)

Bug Fixes

1.3.8 (2018-05-03)

Bug Fixes

1.3.7 (2018-05-01)

Bug Fixes

1.3.6 (2018-04-25)

Bug Fixes

1.3.5 (2018-04-24)

Bug Fixes

  • prevent multiple updates (cc872ea)

1.3.4 (2018-04-24)

Bug Fixes

1.3.3 (2018-04-20)

Bug Fixes

1.3.2 (2018-04-20)

Bug Fixes

  • always pull new version when current changes (f4e5f93)

1.3.1 (2018-04-18)

Bug Fixes

1.3.0 (2018-04-08)

Features

  • increase timeout to weekly and add timeoutInDays configuration (7c1bdbf)

1.2.5 (2018-04-08)

Bug Fixes

1.2.4 (2018-04-07)

Bug Fixes

1.2.3 (2018-03-25)

Bug Fixes

1.2.2 (2018-03-24)

Bug Fixes

1.2.1 (2018-03-24)

Bug Fixes

  • create directory if it does not exist (1de44da)
  • testing release (1345627)

1.2.0 (2018-03-24)

Bug Fixes

Features

1.1.0 (2018-03-24)

Features

  • show project name in update message (b490600)

1.0.2 (2018-03-24)

Bug Fixes

1.0.1 (2018-03-24)

Bug Fixes

1.0.0 (2018-03-24)

Bug Fixes