warn user if a new CLI version is available
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.circleci fix: remove greenkeeper-lockfile Sep 14, 2018
.github chore: add CODEOWNERS May 4, 2018
assets fix: added screenshot Mar 24, 2018
bin init Mar 24, 2018
src chore: updated deps Sep 14, 2018
test wip Mar 24, 2018
.editorconfig init Mar 24, 2018
.eslintignore init Mar 24, 2018
.eslintrc init Mar 24, 2018
.gitattributes init Mar 24, 2018
.gitignore init Mar 24, 2018
CHANGELOG.md chore(release): 1.5.4 [skip ci] Oct 13, 2018
LICENSE init Mar 24, 2018
README.md fix: remove greenkeeper badge Oct 13, 2018
appveyor.yml init Mar 24, 2018
package.json chore(release): 1.5.4 [skip ci] Oct 13, 2018
tsconfig.json init Mar 24, 2018
tslint.json init Mar 24, 2018
yarn.lock fix: remove greenkeeper badge Oct 13, 2018

README.md

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

warns if there is a newer version of CLI released

Version CircleCI Appveyor CI Codecov 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, at most once per 7 days. 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.
  • registry - URL of registry. Defaults to the public npm registry: https://registry.npmjs.org
  • authorization - Authorization header value for registries that require auth.

Example configuration

{
  "oclif": {
    "plugins": [
      "@oclif/plugin-warn-if-update-available"
    ],
    "warn-if-update-available": {
      "timeoutInDays": 7,
      "registry": "https://my.example.com/module/registry",
      "authorization": "Basic <SOME READ ONLY AUTH TOKEN>"
    }
  }
}