Product
Introducing SSO
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
version-notifier
Advanced tools
Readme
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.
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
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.
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
:
checkVersion(__dirname, function (packageName, currentVersion, log) {
// your magic
log('I have just checked my custom provider for a new version of ' + packageName + '.')
})
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
Created and developed by Arthur Arioli Bergamaschi.
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.
FAQs
Let developers know when there is a new release of your package in their next development runtime.
The npm package version-notifier receives a total of 1 weekly downloads. As such, version-notifier popularity was classified as not popular.
We found that version-notifier demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.