check-version-upgraded
v1.0.8
Published
Checks that a package has been updated compared to a remote registry.
Downloads
23
Readme
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