is-published-to-npm
v2.0.1
Published
Checks if a given package & version have been pushed to npm
Downloads
2
Readme
is-published-to-npm
Is this version of this package published to npm yet?
Use as a cli tool:
# from a directory with a package.json
is-published-to-npm
# or for any package
is-published-to-npm {your package} {your version}
(Check the exit status - anything not zero means it has already been published)
Or as a module:
const { isPublishedToNPM } = require('is-published-to-npm');
// or import { isPublishedToNPM } from 'is-published-to-npm';
const pkg = process.argv[2];
const version = process.argv[3];
isPublishedToNPM(pkg, version)
.then(published => {
if (published) {
console.log(pkg + ' v' + version + ' has been published');
process.exit(1);
} else {
console.log(pkg + ' v' + version + ' has not been published yet');
}
})
.catch(err => {
console.log(err.message);
process.exit(1);
});