Skip to content

Commit

Permalink
Add new option --relativeModulePath
Browse files Browse the repository at this point in the history
- Also make sure the original contributors do not get lost in the contributors section of the `package.json` file
  • Loading branch information
Roman Seidelsohn committed Feb 24, 2020
1 parent fd31c6e commit dc9be2b
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ You could see something like this:
- `--excludeLicenses [list]` exclude modules which licenses are in the comma-separated list from the output
- `--includeLicenses [list]` include only modules which licenses are in the comma-separated list from the output
- `--relativeLicensePath` output the location of the license files as relative paths
- `--relativeModulePath` output the location of the module files as relative paths
- `--summary` output a summary of the license usage',
- `--failOn [list]` fail (exit with code 1) on the first occurrence of the licenses of the semicolon-separated list
- `--onlyAllow [list]` fail (exit with code 1) on the first occurrence of the licenses not in the semicolon-seperated list
Expand Down
1 change: 1 addition & 0 deletions bin/license-checker-rseidelsohn
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ if (args.help) {
' --excludeLicenses [list] exclude modules which licenses are in the comma-separated list from the output',
' --includeLicenses [list] include only modules which licenses are in the comma-separated list from the output',
' --relativeLicensePath output the location of the license files as relative paths',
' --relativeModulePath output the location of the module files as relative paths',
' --summary output a summary of the license usage',
' --failOn [list] fail (exit with code 1) on the first occurrence of the licenses of the semicolon-separated list',
' --onlyAllow [list] fail (exit with code 1) on the first occurrence of the licenses not in the semicolon-seperated list',
Expand Down
8 changes: 8 additions & 0 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,9 @@ const flatten = function flatten(options) {
};

exports.init = function init(args, callback) {
// Fix path if on Windows:
const workingDir = args.start.replace(/\\\\/g, '\\');

debugLog('scanning %s', args.start);

if (args.customPath) {
Expand Down Expand Up @@ -516,6 +519,11 @@ exports.init = function init(args, callback) {
}
/*istanbul ignore else*/
if (data[item]) {
if (args.relativeModulePath && data[item].path) {
// Cut the absolute portion of the module path (for forward and backward slashes respectively):
data[item].path = data[item].path.replace(`${workingDir}/`, '').replace(`${workingDir}\\`, '');
}

if (args.onlyunknown) {
if (data[item].licenses.indexOf('*') > -1 || data[item].licenses.indexOf(UNKNOWN) > -1) {
sorted[item] = data[item];
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
"Peter Uithoven <peter@peteruithoven.nl>",
"Philipp Tusch <philipp.tusch@huf-group.com>",
"Rogier Schouten <github@workingcode.nl>",
"Roman Seidelsohn <roman.seidelsohn@rseidelsohn.com>",
"Roman Seidelsohn <rseidelsohn@gmail.com>",
"Roman Seidelsohn <rseidelsohn@rbloeth.de>",
"Stan Senotrusov <stan@senotrusov.com>",
Expand Down
55 changes: 54 additions & 1 deletion scripts/contrib.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,60 @@ const opts = join(__dirname, '../');
const pkg = join(__dirname, '../package.json');
const json = require(pkg);

json.contributors = []; //clear it
json.contributors = [
'Adam Weber <adamweber01@gmail.com>',
'Andrew Couch <andy@couchand.com>',
'Asharma <Asharma@agtinternational.com>',
'Bryan English <bryan@bryanenglish.com>',
'Christoph Werner <christoph@codepunkt.de>',
'Cory Reed <creed@mrn.org>',
'Damien Larmine <damien.larmine@gmail.com>',
'Dan Rumney <dancrumb@gmail.com>',
'Dav Glass <davglass@gmail.com>',
'Dick Wiggers <dickje@gmail.com>',
'Drew Folta <drew@folta.net>',
'Elijah Insua <tmpvar@gmail.com>',
'Francois Zaninotto <fzaninotto@gmail.com>',
'Glen Arrowsmith <glen.arrowsmith@gmail.com>',
'Helio Frota <00hf11@gmail.com>',
'Holger Knust <holger.knust@certusview.com>',
'Honza Javorek <mail@honzajavorek.cz>',
'Ivan Latunov <ivan.latunov@chaosgroup.com>',
'James Bloomer <github2@thebloomers.co.uk>',
'Jonny Reeves <john.reeves@improbable.io>',
'Jonny Reeves <jonny@improbable.io>',
'Ladislav Prskavec <abtris@Ladislavs-MacBook-Pro.local>',
'Ladislav Prskavec <ladislav@prskavec.net>',
'Lorenzo Cesana <cesana.lorenzo@gmail.com>',
'Mark Tse <mark.tse@d2l.com>',
'Mark Tse <neverendingqs@users.noreply.github.com>',
'Mattias Amnefelt <mattiasa@cantemo.com>',
'Michael Kühnel <mail@michael-kuehnel.de>',
'Michael Williamson <mike@zwobble.org>',
'Paul Mandel <paul.mand3l@gmail.com>',
'Peter Uithoven <peter@peteruithoven.nl>',
'Philipp Tusch <philipp.tusch@huf-group.com>',
'Rogier Schouten <github@workingcode.nl>',
'Roman Seidelsohn <rseidelsohn@gmail.com>',
'Stan Senotrusov <stan@senotrusov.com>',
'Stoyan Revov <st.revov@gmail.com>',
'Tero Keski-Valkama <tero.keski-valkama@cybercom.com>',
'Thomas Grainger <tagrain@gmail.com>',
'Tim Brust <tim.brust@sinnerschrader.com>',
'Tim Oxley <secoif@gmail.com>',
'Timothée Mazzucotelli <timothee.mazzucotelli@gmail.com>',
'Tobi <tobilg@gmail.com>',
'Tobias Büschel <tobias.bueschel@gmail.com>',
'Yukari Ishibashi <ibeucaly@users.noreply.github.com>',
'Yuri Zapuchlak <yuri@vidmaker.com>',
'badunk <baduncaduncan@gmail.com>',
'creising <creising@gmail.com>',
'gdw2 <gdwarner@Gmail.com>',
'ktmouk <ktmouk@gmail.com>',
'santiagocanti <santiago.canti@auth0.com>',
'tbbstny <tbbstny@users.noreply.github.com>',
'zodiac403 <zodiac403@gmx.de>',
]; //clear it

GitContributors.list(opts, function(err, result) {
result.forEach(function(item) {
Expand Down

0 comments on commit dc9be2b

Please sign in to comment.