From d829b86693faff87b51696c2c23da476868b0c3d Mon Sep 17 00:00:00 2001 From: Oleksandr Lebedynskyi Date: Wed, 1 Jul 2015 16:33:12 +0200 Subject: [PATCH] Return promise from programRun --- README.md | 2 ++ lib/npm-check-updates.js | 6 ++---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 29628e24..70c8f6ee 100644 --- a/README.md +++ b/README.md @@ -99,6 +99,8 @@ var checkUpdates = require('npm-check-updates'); checkUpdates.run({ upgrade: true, // see available options above force: true +}).then(function() { + console.log('done upgrading dependencies'); }); ``` diff --git a/lib/npm-check-updates.js b/lib/npm-check-updates.js index 4509ffd1..06e0abb2 100644 --- a/lib/npm-check-updates.js +++ b/lib/npm-check-updates.js @@ -159,9 +159,7 @@ function programInit() { function programRun() { programInit(); - options.global ? - programRunGlobal() : - programRunLocal() + return options.global ? programRunGlobal() : programRunLocal(); } function programRunGlobal() { @@ -201,6 +199,6 @@ module.exports = { options = opts || {}; options.args = options.args || []; - vm.initialize(options.global).then(programRun); + return vm.initialize(options.global).then(programRun); } };