Comparing version 0.2.0 to 0.2.1
@@ -19,3 +19,3 @@ #!/usr/bin/env node | ||
nlf = require('../lib/nlf'), | ||
standardFormat = require('../lib/formatters/standard'), | ||
format = require('../lib/formatters/standard'), | ||
options = { | ||
@@ -28,2 +28,3 @@ directory: process.cwd() | ||
.option('-d, --no-dev', 'exclude development dependencies') | ||
.option('-c, --csv', 'output in csv format') | ||
.parse(process.argv); | ||
@@ -33,2 +34,9 @@ | ||
// select which formatter | ||
if (program.csv) { | ||
format = require('../lib/formatters/csv'); | ||
} else { | ||
format = require('../lib/formatters/standard'); | ||
} | ||
nlf.find(options, function (err, data) { | ||
@@ -42,3 +50,3 @@ | ||
if (data && data.length > 0) { | ||
standardFormat.render(data, function (err, output) { | ||
format.render(data, function (err, output) { | ||
if (err) { | ||
@@ -45,0 +53,0 @@ console.error(err); |
@@ -53,22 +53,2 @@ | ||
/** | ||
* Return the module as a CSV record | ||
* | ||
* @return {String} The Module as a CSV record | ||
*/ | ||
Module.prototype.toCsvRecord = function () { | ||
// @todo - what do do if any of the data contains a comma? | ||
// put double quotes around the value? | ||
return this.name + ',' + | ||
this.version + ',' + | ||
this.directory + ',' + | ||
this.repository + ',' + | ||
(this.type || '(none)') + ',' + | ||
this.summary().join(';') + ',' + | ||
this.licenseSources.package.summary().join(';') + ',' + | ||
this.licenseSources.license.summary().join(';') + ',' + | ||
this.licenseSources.readme.summary().join(';'); | ||
}; | ||
/** | ||
* Return a de-duplicated list of all licenses | ||
@@ -117,11 +97,2 @@ * | ||
/** | ||
* Returns the CSV column headings | ||
* @return {[type]} [description] | ||
*/ | ||
Module.prototype.csvHeading = function () { | ||
return 'name,version,directory,repository,type,summary,' + | ||
'from package.json,from license,from readme'; | ||
}; | ||
module.exports = Module; |
@@ -6,3 +6,3 @@ { | ||
"author": "Ian Kelly <iandotkelly@gmail.com>", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"license": "MIT", | ||
@@ -9,0 +9,0 @@ "bin" : { |
@@ -54,3 +54,9 @@ # Node License Finder (nlf) | ||
For output in CSV format use the -c (or --csv) switch: | ||
```sh | ||
$ cd my-module | ||
$ nlf -c | ||
``` | ||
To exclude development dependences and only analyze dependencies for production: | ||
@@ -63,3 +69,2 @@ | ||
### Programatically | ||
@@ -66,0 +71,0 @@ |
@@ -172,27 +172,2 @@ /** | ||
describe('csvHeading method', function () { | ||
it('should return the correct string', function () { | ||
var myModule = new Module('my-module', 'my-module', '1.0.0', '/my/dir'); | ||
myModule.csvHeading().should.equal('name,version,directory,repository,type,summary,from package.json,from license,from readme'); | ||
}); | ||
}); | ||
describe('toCsvRecord method', function () { | ||
it('should return the correct string', function () { | ||
var myModule = new Module('my-module', 'my-module', '1.0.0', '/my/dir'), | ||
summary; | ||
myModule.licenseSources.package.sources.push(new PackageSource('MIT')); | ||
myModule.licenseSources.package.sources.push(new PackageSource('GPL')); | ||
myModule.licenseSources.license.sources.push(fakeMitFile); | ||
myModule.licenseSources.license.sources.push(fakeApacheFile); | ||
myModule.licenseSources.readme.sources.push(fakeMitFile); | ||
myModule.licenseSources.readme.sources.push(fakeApacheFile); | ||
myModule.toCsvRecord().should.equal('my-module,1.0.0,/my/dir,(none),(none),Apache;GPL;MIT,GPL;MIT,Apache;MIT,Apache;MIT'); | ||
}); | ||
}); | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
308334
28
1225
119