From e45156aa9dbf4de32ac348c24999c7380674d7d5 Mon Sep 17 00:00:00 2001 From: Richie Mackay Date: Wed, 13 Apr 2016 23:27:06 +0100 Subject: [PATCH] update readme and add output file names --- README.md | 19 ++++++++++++++----- lib/index.js | 27 +++++++++++++++++++-------- 2 files changed, 33 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 506ff82..841fbe3 100644 --- a/README.md +++ b/README.md @@ -41,13 +41,22 @@ Options: -h, --help output usage information -V, --version output the version number -m, --packageManager npm (default) | bower - -o --outputFile ./ncu-report/ncu-report.md (default) - -f --format markdown (default) | dokuwiki - -v --verbose verbose˜ + -o, --outputFile ./ncu-report/ncu-report.md (default) + -f, --format markdown (default) | dokuwiki + -v, --verbose verbose˜ ```` +## Output Column Definitions + +| Column | Description | +| :----- | :---------- | +| Package | The name of the package | +| Current | The current version specified in package.json or bower.json | +| Installed | The locally installed version | +| Latest | The latest version available from the remote repository | +| Status | OK or OUTDATED | + +## Example Output -Example Output --------------- | Package | Current | Installed | Latest | Status | | :------ | ------: | --------: | -----: | :----: | | bluebird | ^3.0.5 | 3.3.4 | ^3.3.5 | OUTDATED | diff --git a/lib/index.js b/lib/index.js index 9cf7201..84d4b31 100755 --- a/lib/index.js +++ b/lib/index.js @@ -7,25 +7,34 @@ var reportService = require('./reportService'); var vm = require('npm-check-updates/lib/versionmanager'); - program .version('0.0.8') .option('-m, --packageManager ', 'npm (default) | bower', 'npm') - .option('-o --outputFile ', '.\/ncu-report\/ncu-report.md (default)', './ncu-report/ncu-report.md') - .option('-f --format ', 'markdown (default) | dokuwiki', 'markdown') - .option('-v --verbose', 'verbose') + .option('-o, --outputFile ', '.\/ncu-report\/ncu-report.md (default)') + .option('-f, --format ', 'markdown (default) | dokuwiki', 'markdown') + .option('-v, --verbose', 'verbose') .parse(process.argv); -var packageFile = "package.json"; +var defaultOutputFile = './ncu-report/npm-report.md'; +if (program.format === 'dokuwiki') { + defaultOutputFile = './ncu-report/npm-report.dw'; +} +var packageFile = "package.json"; if (program.packageManager === 'bower') { + defaultOutputFile = './ncu-report/bower-report.md'; + if (program.format === 'dokuwiki') { + defaultOutputFile = './ncu-report/bower-report.dw'; + } packageFile = 'bower.json'; } +var outputFile = program.outputFile || defaultOutputFile; + var options = { packageFile: packageFile, packageManager: program.packageManager, - outputFile: program.outputFile, + outputFile: outputFile, format: program.format }; @@ -42,8 +51,10 @@ var generateReport = function generateReport(configuration, installedPackages) { }); }; -vm.initialize(options).then(function(){ - vm.getInstalledPackages({packageManager: options.packageManager}).then(function(installedPackages){ +vm.initialize(options).then(function() { + vm.getInstalledPackages({ + packageManager: options.packageManager + }).then(function(installedPackages) { generateReport(options, installedPackages); }); });