check-version-upgraded

1.0.8 • Public • Published

Overview

A lightweight utility that checks whether or not a local package.json file has a higher version number than what is published to a package registry. This will prevent publishing failures that may happen later in your CI/CD pipelines.

Run

Install

npm install -g check-version-upgraded

Run

CLI

Parameters

  • package.json file path
  • Optional registry to check. The default is npmjs

Example

npx check-version-upgraded ./my-module/package.json https://registry.npmjs.org

Output

The tool will print a simple true is printed to the console standard out if the local package.json version number is greater than what is published to the registry. If the local version is less than or equal to the published version, a false is printed to the standard error stream.

Programmatic

Example

import { checkVersionUpgraded } from "check-version-upgraded";
(async () => {
  const upgraded = await checkVersionUpgraded("./package.json");
  console.log(upgraded);
})();

Output

The checkVersionUpgraded returns a Promise<boolean> indicating if the local package is upgraded.

Develop

Install Dev Dependencies

npm install

Compile

npm run build

Watch

npm run watch

Wishlist

  • Add custom result handlers instead of always returning a simple boolean or printing to the console
  • Add unit tests
  • Use awaits instead of promise chains

Readme

Keywords

none

Package Sidebar

Install

npm i check-version-upgraded

Weekly Downloads

11

Version

1.0.8

License

MIT

Unpacked Size

11.6 kB

Total Files

4

Last publish

Collaborators

  • albinopython