npm-tool-version-check

1.2.0 • Public • Published

npm-tool-version-check

Publish a tool, but want to warn users when you publish a new version.

By default, the tool will require using interaction on the commandline to continue using outdated software

Within your tool:

import versionCheck from 'npm-tool-version-check';
const thisVersion = require('./package.json').version; // Update this to work for your package
const remoteJson = 'https://raw.githubusercontent.com/johndcarmichael/npm-tool-version-check/master/package.json'; // Update this URL to work for your package 
const packageName = 'npm-tool-version-check'; // Update this to your package name
versionCheck(thisVersion, remoteJson, packageName)
.then(() => {
  // continue with your tool
}).catch(() => {
  // log additional messaging
})

Bypass

To bypass user interaction and only display the warning to the console:

  • set the process env: npm_tool_version_check__quiet to truthy

Readme

Keywords

Package Sidebar

Install

npm i npm-tool-version-check

Weekly Downloads

811

Version

1.2.0

License

none

Unpacked Size

15.9 kB

Total Files

21

Last publish

Collaborators

  • carmichael.john