Comparing version 0.2.3 to 0.2.4
@@ -16,5 +16,10 @@ /** | ||
path = require('path'), | ||
fs = require('fs'), | ||
glob = require('glob'), | ||
FileSource = require('./file-source'), | ||
PackageSource = require('./package-source'), | ||
csvFormatter = require('./formatters/csv'), | ||
standardFormatter = require('./formatters/standard'), | ||
LicenseCollection = require('./license-collection'), | ||
licenseFind = require('./license-find'), | ||
matchNodeModules = /node_modules\//; | ||
@@ -249,2 +254,3 @@ | ||
addFiles(readmeFiles, module.licenseSources.readme, function (err) { | ||
var index; | ||
@@ -256,2 +262,3 @@ if (err) { | ||
// finally, if there is data in package.json relating to licenses | ||
// simple license declarations first | ||
if (moduleData.license) { | ||
@@ -261,2 +268,11 @@ module.licenseSources.package.add(new PackageSource(moduleData.license)); | ||
// more complex ones | ||
if (moduleData.licenses) { | ||
for (index = 0; index < moduleData.licenses.length; index++) { | ||
module.licenseSources.package.add( | ||
new PackageSource(moduleData.licenses[index]) | ||
); | ||
} | ||
} | ||
callback(null, module); | ||
@@ -317,3 +333,23 @@ }); | ||
/** | ||
* Does a file exist? | ||
* | ||
* @param {String} filePath The path of the file | ||
* @return {Boolean} True if the file exists | ||
*/ | ||
function fileExistsSync(filePath) { | ||
try { | ||
var stats = fs.statSync(filePath); | ||
return stats.isFile(); | ||
} catch (err) { | ||
if (err.code === 'ENOENT') { | ||
return false; | ||
} | ||
throw err; | ||
} | ||
} | ||
/** | ||
* Function to find licenses | ||
@@ -342,2 +378,6 @@ * | ||
if (!fileExistsSync(path.join(options.directory, 'package.json'))) { | ||
return callback(new Error('No package.json file found.')); | ||
} | ||
// use npm read-installed module to search out all the node modules | ||
@@ -368,3 +408,7 @@ readInstalled(options.directory, null, log, function (err, data) { | ||
'FileSource': FileSource, | ||
'PackageSource': PackageSource | ||
'PackageSource': PackageSource, | ||
'csvFormatter': csvFormatter, | ||
'standardFormatter': standardFormatter, | ||
'licenseFind': licenseFind, | ||
'LicenseCollection': LicenseCollection | ||
}; |
@@ -6,3 +6,3 @@ { | ||
"author": "Ian Kelly <iandotkelly@gmail.com>", | ||
"version": "0.2.3", | ||
"version": "0.2.4", | ||
"license": "MIT", | ||
@@ -18,12 +18,12 @@ "bin" : { | ||
"dependencies": { | ||
"commander": "~0.6.1", | ||
"read-installed": "~0.2.2", | ||
"glob": "~3.2.1", | ||
"commander": "~2.0.0", | ||
"read-installed": "~0.2.4", | ||
"glob": "~3.2.6", | ||
"archy": "~0.0.2" | ||
}, | ||
"devDependencies": { | ||
"jshint": "~2.1.4", | ||
"jshint": "~2.1.10", | ||
"should": "~1.2.2", | ||
"mocha": "~1.12.0", | ||
"globs": "~0.1.0" | ||
"mocha": "~1.12.1", | ||
"globs": "~0.1.1" | ||
}, | ||
@@ -30,0 +30,0 @@ "engines": { |
<!-- @@NLF-IGNORE@@ --> | ||
# Node License Finder (nlf) | ||
# Node License Finder (nlf) [![Build Status](https://secure.travis-ci.org/iandotkelly/nlf.png)](http://travis-ci.org/iandotkelly/nlf) [![Dependency Status](https://gemnasium.com/iandotkelly/nlf.png)](https://gemnasium.com/iandotkelly/nlf) | ||
@@ -5,0 +5,0 @@ nlf is a utility for attempting to identify the licenses of modules in a node.js project. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
0
100
1849
252532
28
1
+ Addedcommander@2.0.0(transitive)
- Removedcommander@0.6.1(transitive)
Updatedcommander@~2.0.0
Updatedglob@~3.2.6
Updatedread-installed@~0.2.4