Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    selfupdatepublic

    selfupdate

    npm version dependencies Build Status

    Selfupdate your global NPM package.

    Installation

    Install selfupdate by running:

    $ npm install --save selfupdate

    Documentation

    selfupdate.update(Object packageJSON, Function callback)

    Update a globally installed NPM package.

    If the installation fails with a permission related error, the module will attempt to elevate privileges automatically.

    The function requires the package.json, which you can require like:

    var packageJSON = require('./package.json');

    The callback gets passed two arguments: (error, version), where version is the new version of the package after the update took place.

    Example:

    var selfupdate = require('selfupdate');
    var packageJSON = require('./package.json');
     
    selfupdate.update(packageJSON, function(error, version) {
            if(error) throw error;
            console.log('The package was updated to version: ' + version);
    });

    selfupdate.isUpdated(Object packageJSON, Function callback)

    Check if a global package is in the latest version.

    The function requires the package.json, which you can require like:

    var packageJSON = require('./package.json');

    The callback gets passed two arguments: (error, isUpdated), where isUpdated is a Boolean that determines if the package is up to date.

    Example:

    var selfupdate = require('selfupdate');
    var packageJSON = require('./package.json');
     
    selfupdate.isUpdated(packageJSON, function(error, isUpdated) {
            if(error) throw error;
            console.log('Is the package up to date? ' + isUpdated);
    });

    Tests

    Run the test suite by doing:

    $ gulp test

    Contribute

    Before submitting a PR, please make sure that you include tests, and that coffeelint runs without any warning:

    $ gulp lint

    Support

    If you're having any problem, please raise an issue on GitHub.

    ChangeLog

    v1.1.0

    • [feature] Expose selfupdate.isUpdated()

    License

    The project is licensed under the MIT license.

    install

    npm i selfupdate

    Downloadsweekly downloads

    28

    version

    1.1.0

    license

    MIT

    repository

    githubgithub

    last publish

    collaborators

    • avatar