How to use the npm-check-updates.run function in npm-check-updates

To help you get started, we’ve selected a few npm-check-updates examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Cognizant-CDE-Australia / generator-confit / config / check-update / checkForUpdates.js View on Github external
function checkForUpdates(packageObj) {

  ncu.run({
    // Always specify the path to the package file
    packageData: JSON.stringify({dependencies: packageObj}),
    // Any command-line option can be specified here.
    // These are set by default:
    logLevel: 'error',
    greatest: true,
    silent: true,
    jsonUpgraded: true
  }).then((upgraded) => {
    console.log('\nTo upgrade:');
    //, upgraded);
    let keys = Object.keys(upgraded);
    keys.forEach(key => console.log(`${key}  ${packageObj[key]}${upgraded[key]}`));
  });
}
github JsAaron / xut.js / build / ncu.package.js View on Github external
//https://github.com/tjunnone/npm-check-updates
const ncu = require('npm-check-updates')
const fs = require('fs')

ncu.run({
  packageFile: 'package.json',
  silent: true,
  jsonUpgraded: true,
  jsonAll: true
    // upgrade: true,
    // upgradeAll: true
}).then((upgraded) => {
  console.log('dependencies to upgrade:', upgraded);
  const data = JSON.stringify(upgraded).replace(/,/g, ",\n").replace(/{/, '{\n').replace(/}/, '\n}')
  fs.writeFileSync('upgrade.js', `"UPDATE DATA: ${new Date()}" \n` + data)
});
github webex / react-widgets / scripts / utils / update.js View on Github external
#!/usr/bin/env babel-node
/**
 * This script allows you to upgrade all of the @ciscospark dependencies
 * to their latest version.
 */

const ncu = require('npm-check-updates');

ncu.run({
  // Always specify the path to the package file
  packageFile: 'package.json',
  // Any command-line option can be specified here.
  // These are set by default:
  filter: /^@(ciscospark|webex).*$/,
  upgrade: true
}).then(() => {
  console.log('@ciscospark dependencies upgraded');
});
github scenarioo / scenarioo-js / build / dependencyCheck.js View on Github external
gulp.task('checkNpmDependencies', function (done) {
    gutil.log('This can take a minute...');

    var reportFileName = './npm_dependencies_report.md';

    ncu.run({
        packageFile: 'package.json',
        'error-level': 1 // we don't want to fail CI... we write a report file
    }).then(function (upgraded) {
        var tmpl = '# NPM DependencyCheck Report for <%- name %>\nThe following dependencies are out-of-date:\n\n<% _.forEach(upgraded, function(version, dependency) { %>* <%- dependency %>: <%- currentDependencies[dependency]%> -> <%- version%>\n<% }); %>';
        return _.template(tmpl)(_.merge({
            upgraded: upgraded
        }, getPackageInformation()));
    }).then(function (report) {
        return q.nfcall(fs.writeFile, reportFileName, report);
    }).then(function () {
        gutil.log(gutil.colors.green('Report saved to ' + reportFileName));
    }).catch(done);

});
github codeBelt / slush-project / slush / tasks / testingBuildSystem / audit / tools / tasks / auditScripts.js View on Github external
const checkModules = (type) => {
    return ncu.run({
            packageManager: type
        })
        .then((upgraded) => {

            const keys = Object.keys(upgraded);

            if (keys.length === 0) {
                console.log('none');
            } else {
                const table = new Table({
                    head: [`${type} name`, 'latest version']
                });

                Object.keys(upgraded).forEach((name) => {
                    table.push([name, upgraded[name]]);
                });
github krausest / js-framework-benchmark / webdriver-ts / src / updateFrameworks.ts View on Github external
async function ncuRunUpdate(packageVersionInfo: PackageVersionInformationResult) {
    console.log("Update "+packageVersionInfo.framework.keyedType +'/' + packageVersionInfo.framework.directory);
    await ncu.run({
        packageFile: path.resolve('..', 'frameworks', packageVersionInfo.framework.keyedType, packageVersionInfo.framework.directory, 'package.json'),
        upgrade: true
    });
}
github wejs / generator-wejs / bin / up-projects.js View on Github external
function updateBlog(done) {
    ncu.run({
      packageFile: 'blog/templates/_package.json',
      jsonUpgraded: false,
      upgrade: true,
      upgradeAll: true
    }).then(function () {
      console.log('Upgrated blog project');
      done();
    }).catch(done);
  },
  function updateEvents(done) {
github kubernetes / dashboard / build / dependencies.js View on Github external
return through.obj(function(file, codec, cb) {
    let relativePath = path.relative(process.cwd(), file.path);

    ncu.run({
         packageFile: relativePath,
         packageManager: packageManager,
       })
        .then(function(toUpgrade) {
          let dependenciesStr = Object.keys(toUpgrade)
                                    .map((key) => {
                                      return `${key}: ${toUpgrade[key]}\n`;
                                    })
                                    .join('');

          if (dependenciesStr.length !== 0) {
            gulputil.log(gulputil.colors.yellow(
                `Dependencies needed to update:\n${dependenciesStr}\n` +
                `Run: 'gulp update-${packageManager}-deps', then '${packageManager} ` +
                `install' to update dependencies.\n`));
          }

npm-check-updates

Find newer versions of dependencies than what your package.json allows

Apache-2.0
Latest version published 2 days ago

Package Health Score

95 / 100
Full package analysis