npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

version-notifier

v0.0.1

Published

Let developers know when there is a new release of your package in their next development runtime.

Downloads

3

Readme

version-notifier

Let developers know when there is a new release of your package in their next development runtime.

Out-of-the-box providers will only send you version notifications from your application's dependencies, and not from dependencies of your dependencies. Notifications can be disabled in production environments by using the environment variable NODE_ENV=production or NODE_ENV=prod.

You can also specify custom resolvers, so you don't have to rely on NPM's availability.

Install

This is a Node.js module. Therefore, beforehand, you need to download and install Node.js.

Assuming that you have already used the npm init command, run:

$ npm install version-notifier --save

Getting started

You can call version-notifier anytime on your runtime, but it is recommended to call it as soon as your app starts. For example, in your index.js, in your root directory:

ES6+

import checkVersion from 'version-notifier'
checkVersion(__dirname)

ES5

var checkVersion = require('version-notifier')
checkVersion(__dirname)

The first argument must always be the root directory of your app.

How to configure

package.json

You can specify a different provider through versionNotifier.provider on your package.json. Out-of-the-box providers: npm.

{
    "name": "myPackage",
    "version": "1.0.0",
    "versionNotifier": {
        "provider": "npm"
    }
}

Or you can create your very own version provider by the time you call version-notifier:

Custom version providers
checkVersion(__dirname, function (packageName, currentVersion, log) {
    // your magic
    log('I have just checked my custom provider for a new version of ' + packageName + '.')
})

Function Parameters

checkVersion(appRootDirectory, customProvider, log)

appRootDirectory

Type: string

The root directory of your application. If your main file is already in the root directory, just use __dirname here. Otherwise, you must use specify how to go to your root directory still using __dirname. For example, if you are calling version-notifier inside a subfolder of your root directory, you must use path.join(__dirname, '..') to get the relative path of your root directory.

I used root directory here multiples times because getting the right directory for your app is a must for a fully working environment. Using __dirname, your project can be used as a dependency in other projects.

customProvider

Type: function or object

You can use version-notifier with totally different environments from NPM, with support for alternative dependency checking:

{
    isDependency: function (parentDependenciesJson: JSON, dependencyName: string) : boolean,
    resolver: function (packageName: string, currentVersion: string, log: function) : void
}

Or if you are still using package.json for your project, you can just use a function:

function (packageName: string, currentVersion: string, log: function) : void

Versions ideally follow semver, but it is not a rule since you can create your own custom providers.

log

Type: function

Custom logging function for the results.

function (err?: Error, message?: string) : void

Team

Created and developed by Arthur Arioli Bergamaschi.


License

Licensed under MIT.


Disclaimer: version-notifier is an experiment to improve development environments and it is still in alpha. Methods and behavior can change along the way.