This is a very minimal approach to update checking for globally installed packages.
Because it's so simple, the error surface is very tiny and your user's are guaranteed to receive the update message if there's a new version.
You can read more about the reasoning behind this project here.
Firstly, install the package with yarn...
yarn add update-check
npm install update-check
Next, initialize it.
If there's a new update available, the package will return the content of latest version's
const pkg = ;const checkForUpdate = ;let update = null;tryupdate = await ;catch errconsole;if updateconsole;
That's it! You're done.
If you want, you can also pass options to customize the package's behavior:
const pkg = ;const checkForUpdate = ;let update = null;tryupdate = await;catch errconsole;if updateconsole;
- Fork this repository to your own GitHub account and then clone it to your local device
- Link the package to the global module directory:
- Within the module you want to test your local development instance of the package, just link it:
npm link update-check. Instead of the default one from npm, node will now use your clone.