Skip to content

Commit

Permalink
update readme and add output file names
Browse files Browse the repository at this point in the history
  • Loading branch information
Richie Mackay committed Apr 13, 2016
1 parent 0ac837e commit e45156a
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 13 deletions.
19 changes: 14 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,22 @@ Options:
-h, --help output usage information
-V, --version output the version number
-m, --packageManager <name> npm (default) | bower
-o --outputFile <filename> ./ncu-report/ncu-report.md (default)
-f --format <name> markdown (default) | dokuwiki
-v --verbose verbose˜
-o, --outputFile <filename> ./ncu-report/ncu-report.md (default)
-f, --format <name> 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 |
Expand Down
27 changes: 19 additions & 8 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,34 @@ var reportService = require('./reportService');

var vm = require('npm-check-updates/lib/versionmanager');


program
.version('0.0.8')
.option('-m, --packageManager <name>', 'npm (default) | bower', 'npm')
.option('-o --outputFile <filename>', '.\/ncu-report\/ncu-report.md (default)', './ncu-report/ncu-report.md')
.option('-f --format <name>', 'markdown (default) | dokuwiki', 'markdown')
.option('-v --verbose', 'verbose')
.option('-o, --outputFile <filename>', '.\/ncu-report\/ncu-report.md (default)')
.option('-f, --format <name>', '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
};

Expand All @@ -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);
});
});
Expand Down

0 comments on commit e45156a

Please sign in to comment.