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.
npm install -g check-version-upgraded
- package.json file path
- Optional registry to check. The default is npmjs
npx check-version-upgraded ./my-module/package.json https://registry.npmjs.org
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.
import { checkVersionUpgraded } from "check-version-upgraded";
(async () => {
const upgraded = await checkVersionUpgraded("./package.json");
console.log(upgraded);
})();
The checkVersionUpgraded
returns a Promise<boolean>
indicating if the local package is upgraded.
npm install
npm run build
npm run watch
- 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