How to use semver-compare - 10 common examples

To help you get started, we’ve selected a few semver-compare examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Flexget / webui / src / core / layout / SideNav / Version.tsx View on Github external
const Version: React.FC = ({ className }) => {
  const { loading, version } = useContainer(VersionContainer);
  if (loading || !version) {
    // showProgress
    return null;
  }

  const { flexgetVersion, apiVersion, latestVersion } = version;

  return (
    <div>
      Version Info
      
        {`Flexget: ${flexgetVersion} `}
        {semver(latestVersion, flexgetVersion) !== 1 &amp;&amp; (
          
            
          
        )}
      
      {`API: ${apiVersion}`}
    </div>
  );
};
github trezor / trezor.js / lib / transport / http.js View on Github external
return installers.latestVersionAsync({bridgeUrl: bridgeVersionUrl}).then(version =&gt; {
                const isOutdated = semvercmp(transport.version, version) &lt; 0;
                transport.isOutdated = isOutdated;
                return transport;
            }, () =&gt; {
                // latest.txt CORS error shouldn't bring trezor.js down :/
github zeit / hyper / app / update-checker.js View on Github external
.then(({ version, note }) => {
        if (this.lastKnown !== version) {
          this.lastKnown = version;

          if (1 === compare(version, currentVersion)) {
            console.log('update found');
            this.callback(version, note);
          } else {
            console.log('no update. latest:', version);
          }
        }
        done();
      })
      .catch((err) => {
github rlesniak / tind3r.com / src / components / Static / Outdated.js View on Github external
checkVersion(version => {
      if (version && cmp(version, '0.2.0') !== -1) {
        browserHistory.push('/home')
      }
    })
  }
github halohalospecial / atom-elmjutsu / lib / main.js View on Github external
})
    );
    this.subscriptions.add(
      atom.commands.add('atom-workspace', {
        'elmjutsu:hide-usages-panel': () =&gt;
          this.findAndRenameUsages.hideCommand(),
        'elmjutsu:toggle-sidekick': () =&gt; this.sidekick.toggleCommand(),
      })
    );

    const linterPackage = atom.packages.getLoadedPackage('linter');
    if (
      !linterPackage ||
      !linterPackage.metadata ||
      !linterPackage.metadata.version ||
      cmp(linterPackage.metadata.version, '2.3.0') &lt; 0
    ) {
      this.usingLinterV1 = true;
    } else {
      this.usingLinterV1 = false;
    }
  },
github polkadot-js / client / packages / client / src / clientId.ts View on Github external
export async function getNpmStatus (): Promise {
  const verNpm = await getNpmVersion();

  if (verNpm === 'unknown') {
    return null;
  }

  switch (semcmp(pkgJson.version, verNpm)) {
    case 0:
      return 'up to date';

    case 1:
      return `newer, ${verNpm} published`;

    default:
      return `outdated, ${verNpm} available`;
  }
}
github trezor / trezor.js / src / device.js View on Github external
atLeast(version: string): boolean {
        return semvercmp(this.getVersion(), version) >= 0;
    }
github sanity-io / sanity / packages / @sanity / cli / src / actions / versions / findSanityModuleVersions.js View on Github external
return packages.map(mod => {
    mod.needsUpdate =
      target === 'latest'
        ? semverCompare(mod.version, mod.latest) === -1
        : mod.version !== mod.latest
    return mod
  })
}
github rlesniak / tind3r.com / src / components / App / index.js View on Github external
checkVersion(version => {
          if (!version || cmp(version, '0.2.0') === -1) {
            browserHistory.push('/update')
          } else {
            successCallback()
          }
        })
      }
github rvpanoz / luna / renderer-process / content / Main.js View on Github external
needsUpdate() {
    let pkg = this.state.activepkg,
      diff = 0;
    let latest = pkg['dist-tags'].latest;
    let installed = pkg.version;

    diff = Semver(latest, installed);
    return diff;
  }
  render() {

semver-compare

compare two semver version strings, returning -1, 0, or 1

MIT
Latest version published 10 years ago

Package Health Score

65 / 100
Full package analysis

Popular semver-compare functions