Skip to content

Commit

Permalink
Added hidden option for gulp integration, Added example file, Correct…
Browse files Browse the repository at this point in the history
…ed license info as part of package descriptor, Added .gitignore
  • Loading branch information
mwittig committed Jan 7, 2016
1 parent d96c660 commit 1554066
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 9 deletions.
31 changes: 31 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
### Node template
# Logs
logs
*.log
npm-debug.log*

# Runtime data
pids
*.pid
*.seed

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directory
# https://docs.npmjs.com/misc/faq#should-i-check-my-node-modules-folder-into-git
node_modules

# Created by .ignore support plugin (hsz.mobi)
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,11 @@ History
* Revised license information to provide a SPDX 2.0 license identifier in-line with npm v2.1 guidelines on
license metadata - see also https://github.com/npm/npm/releases/tag/v2.10.0

* 20150106, V0.1.1
* Added hidden option for gulp integration
* Added example file
* Corrected license info as part of package descriptor

Todo
----

Expand Down
18 changes: 18 additions & 0 deletions examples/api-example.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
var crawler = require('../lib'),
options = {
start: ['../'],
exclude: ['.'],
json: 'licenses.json',
unknown: false
};

crawler.dumpLicenses(options,
function(error, res){
if (error) {
console.error("Error:", error);
}
else {
console.dir(res);
}
}
);
12 changes: 9 additions & 3 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ var path = require('path'),
extend = require('jquery-extend'),
async = require('async'),
fs = require('fs'),
mkdirp = require('mkdirp');
mkdirp = require('mkdirp'),
treeify = require('treeify');


exports.dumpLicenses = function(args, callback) {
Expand Down Expand Up @@ -72,12 +73,17 @@ exports.dumpLicenses = function(args, callback) {
console.log('file written', args.csv);
}
}
else {
else if (! args.gulp) {
checker.print(result);
}
console.log("Number of entries found:", Object.keys(result).length);
}
callback(error, result);
if (! error && args.gulp) {
callback(error, treeify.asTree(result, true));
}
else {
callback(error, result);
}
});
}
else {
Expand Down
13 changes: 7 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@
"npm-license-crawler": "./bin/npm-license-crawler"
},
"dependencies": {
"async": "^1.5.1",
"jquery-extend": "~2.0.3",
"async": "^1.0.0",
"nopt": "^3.0.2",
"license-checker": "git+https://github.com/mwittig/license-checker",
"mkdirp": "^0.5.1",
"nopt-usage": "^0.1.0",
"nopt": "^3.0.2",
"nopt-defaults": "^0.0.1",
"license-checker": "git+https://github.com/mwittig/license-checker"
"nopt-usage": "^0.1.0",
"treeify": "^1.0.1"
},
"devDependencies": {
"vows": "*",
Expand All @@ -36,7 +37,7 @@
"bugs": {
"url": "http://github.com/mwittig/npm-license-crawler/issues"
},
"license": "BSD-3-Clause-Clear",
"license": "BSD-3-Clause",
"repository": {
"type": "git",
"url": "http://github.com/mwittig/npm-license-crawler.git"
Expand All @@ -51,4 +52,4 @@
"node": ">0.8.x",
"npm": ">1.1.x"
}
}
}

0 comments on commit 1554066

Please sign in to comment.