fynjs API
    Preparing search index...

    Module check-pkg-new-version

    NPM version Build Status

    check-pkg-new-version

    Let a published CLI tell its users when a newer version of itself exists.

    It fetches the package's dist-tags from the registry, compares them against the version the user is running, and calls you back when there's something newer. Checks are throttled - the result is cached on disk, so a CLI can call this on every run without hitting the registry every time.

    This package is the batteries-included version: it reads the registry URL and auth token out of the user's .npmrc and does the HTTP itself. If you'd rather supply those yourself, use check-pkg-new-version-engine directly - this package re-exports everything from it.

    npm install check-pkg-new-version
    
    import { checkPkgNewVersion } from "check-pkg-new-version";

    await checkPkgNewVersion({
    pkg: { name: "my-cli", version: "1.2.3" },
    notifyNewVersion: ({ name, version, newVersion }) => {
    console.log(`${name} ${newVersion} is available (you have ${version})`);
    }
    });

    See the full API reference for every option, type, and runtime rule.

    option type description
    pkg { name, version } required - the package and the version currently running
    notifyNewVersion (data) => void called with { name, version, newVersion } when a newer version is found
    checkInterval number milliseconds to wait before checking the registry again
    saveMetaDir string where to cache check metadata; defaults to os.tmpdir()
    checkTag string dist-tag to compare against instead of latest
    npmConfig object npm config to use; read from the user's .npmrc when omitted
    fetchJSON (url, options) => Promise override the HTTP fetch
    checkIsNewer (pkg, distTags, tag) => CheckResult override the "is this newer" comparison

    Licensed under the Apache License, Version 2.0.

    CheckNewVersionOptions
    CheckResult
    NotifyData
    NpmConfig
    PkgInfo
    checkPkgNewVersion
    checkPkgNewVersionEngine