Skip to content

Commit

Permalink
INCOMPLETE:
Browse files Browse the repository at this point in the history
    1. clean up license-check.js file
    1. add license info (and badge indicating verification?) to README
- License: Change from MIT to reflect actual content and dependencies: "(MIT AND Apache-2.0 AND CC-BY-SA-2.0 AND ISC AND LGPL-3.0-or-later AND X11 AND BSD-3-Clause AND BSD-2-Clause AND Unlicense)"
- License: Relicense ext-mathjax from Apache-2.0 to MIT per josegaert/ext-mathjax#6 ,
- License: Clarify in `@license` that `ext-server_moinsave.js` is MIT OR GPL-2.0-or-later per subsequent text
- License: Add script to check licenses
- License: Add `licenseInfo.json` file to clarify default license (MIT) and file and package-specific licenses
    - Per http://benalman.com/about/license/ , the GPL mentioned is GPL-2.0
    - Per https://jquery.org/license/ , jQuery is MIT
- Optimization: Remove unused `jquery-ui-1.8.custom.min.js` file
  • Loading branch information
brettz9 committed Nov 26, 2019
1 parent 3200e0a commit 628c0f9
Show file tree
Hide file tree
Showing 10 changed files with 308 additions and 89 deletions.
5 changes: 4 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,10 @@ module.exports = {
},
{
extends: ['plugin:node/recommended-script'],
files: ['cypress/support/build-coverage-badge.js']
files: [
'cypress/support/build-coverage-badge.js',
'license-check.js'
]
},
{
files: ["cypress/**"],
Expand Down
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ screencasts
.github/ISSUE_TEMPLATE/bug_report.md
build
lgtm.yml
license-check.js

cypress/**
cypress.env.json
Expand Down
2 changes: 1 addition & 1 deletion editor/contextmenu/jQuery.contextMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* @todo Update to latest version and adapt (and needs jQuery update as well): {@link https://github.com/swisnl/jQuery-contextMenu}
* @version 1.0.1
*
* @license (GPL-2.0-or-later OR MIT)
* @license (MIT OR GPL-2.0-or-later)
*
* This plugin is dual-licensed under the GNU General Public License
* and the MIT License and is copyright A Beautiful Site, LLC.
Expand Down
2 changes: 1 addition & 1 deletion editor/extensions/ext-mathjax.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* ext-mathjax.js
*
* @license Apache-2.0
* @license MIT
*
* @copyright 2013 Jo Segaert
*
Expand Down
2 changes: 1 addition & 1 deletion editor/extensions/ext-server_moinsave.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* ext-server_moinsave.js
*
* @license MIT
* @license (MIT OR GPL-2.0-or-later)
*
* @copyright 2010 Alexis Deveria, 2011 MoinMoin:ReimarBauer
* adopted for moinmoins item storage. It sends in one post png and svg data
Expand Down
84 changes: 0 additions & 84 deletions editor/jquery-ui/jquery-ui-1.8.custom.min.js

This file was deleted.

78 changes: 78 additions & 0 deletions license-check.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
'use strict';

/*
For SVG-edit
In the list that follows, these are already present in https://github.com/jslicense/npm-license-corrections.json/edit/master/index.csv
- deep-is (0.1.3)
1. Waiting on whether might avoid need for specifying `licenses`/`packages`
as alluded to in comment at https://github.com/jslicense/licensee.js/pull/61
1. Waiting: Since specifying, OSI, wondering why "Unlicense", which has a valid format,
is not OSI-recognized: https://github.com/unlicense/unlicense.org/issues/72
1. Waiting: Ok license, but could use better parsing (would also need
dependencies to update):
1. "MIT" but has [bad format](https://github.com/thlorenz/deep-is/pull/7):
https://github.com/thlorenz/deep-is
1. Fixed format ("MIT") but hasn't put into new npm release (latest: 1.1.2):
https://github.com/gkz/prelude-ls/issues/121
2. Has valid format ("(AFL-2.1 OR BSD-3-Clause)") but last release (0.2.3) using `licenses`:
https://github.com/kriszyp/json-schema
Currently using:
1. MIT
1. ISC
1. BSD-3-Clause
1. BSD-2-Clause
1. Apache-2.0
1. Unlicense (see above)
*/

const licensee = require('licensee');

licensee(
{
// Add prelude-ls (1.1.2) to corrections?
// - Automatic corrections is reason prelude-ls (1.1.2) is ok when
// `corrections` is on, despite not being in list
// - Appears may have only been bad without `corrections` as last version was
// using `licenses`, not because of OR:
// why is json-schema (0.2.3) "(AFL-2.1 OR BSD-3-Clause)" showing up ok
// with its OR conjunction when `corrections` is on
// The manual corrections are useful but automatic ones are critical
// handling old objects, arrays of objects etc.
corrections: true,
packages: {
// 'load-stylesheets': '*'
},
licenses: {
// osi: true
spdx: [
'MIT', 'ISC', 'BSD-3-Clause', 'BSD-2-Clause', 'Apache-2.0', 'Unlicense'
]
}
},
require('path').join(__dirname, '../ttt'),
// Rejected changing implementation of `licensee` to Promise: https://github.com/jslicense/licensee.js/pull/55#issuecomment-558437231
// eslint-disable-next-line promise/prefer-await-to-callbacks
(err, results) => {
if (err) {
// eslint-disable-next-line no-console
console.log('Error', err);
return;
}
// console.log('results', results);
console.log('Non-approved', results.filter((r) => !r.approved).map(({license, repository: {url}}) => {
return {license, url};
}));
console.log('Approved', JSON.stringify(results.filter((r) => r.approved).reduce((obj, {name, license, repository: {url}}) => {
if (!obj[license]) {
obj[license] = [];
}
// obj[license].push(url);
obj[license].push(name);
return obj;
}, {}), null, 2));
}
);
23 changes: 23 additions & 0 deletions licenseInfo.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"licenseInfo": {
"default": "MIT",
"bundledRootPackages": ["load-stylesheets", "jamilih", "query-result", "qr-manipulation", "stackblur-canvas", "regenerator-runtime", "core-js-bundle"],
"bundledPackagesByLicense": {
"(AFL-2.1 OR BSD-3-Clause)": "json-schema",
"Apache-2.0": ["aws-sign2", "caseless", "forever-agent", "oauth-sign", "request", "tunnel-agent", "xml-name-validator"],
"BSD-2-Clause": ["browser-process-hrtime", "escodegen", "esprima", "estraverse", "esutils", "uri-js", "webidl-conversions"],
"BSD-3-Clause": ["abab", "bcrypt-pbkdf", "qs", "tough-cookie", "tough-cookie", "source-map", "tough-cookie"],
"ISC": ["har-schema", "json-stringify-safe", "query-result", "request-promise-core", "request-promise-native", "saxes", "stealthy-require"],
"Unlicense": ["tweetnacl"]
},
"filesByLicense": {
"(MIT OR GPL-2.0)": ["editor/jquery-ui/jquery-ui-1.8.17.custom.min.js", "editor/jquerybbq/jquery.bbq.min.js", "editor/js-hotkeys/jquery.hotkeys.min.js"],
"(MIT OR GPL-2.0-or-later)": ["editor/contextmenu/jQuery.contextMenu.js", "editor/extensions/ext-server_moinsave.js"],
"Apache-2.0": ["editor/contextmenu.js", "editor/extensions/ext-foreignobject.js", "editor/extensions/ext-grid.js", "editor/extensions/ext-markers.js", "screencasts/svgopen2010/index.html", "editor/jgraduate/jQuery.jGraduate.js", "editor/extensions/mathjax/MathJax.min.js", "editor/extensions/mathjax/TeX-AMS-MML_SVG.js"],
"CC-BY-SA-2.0": ["editor/images/polygon.svg"],
"ISC": ["editor/external/query-result/esm/index.js"],
"LGPL-3.0-or-later": ["editor/jspdf/jspdf.plugin.svgToPdf.js"],
"X11": ["editor/jspdf/jspdf.min.js"]
}
}
}
Loading

0 comments on commit 628c0f9

Please sign in to comment.