diff --git a/kallithea/bin/kallithea_cli_front_end.py b/kallithea/bin/kallithea_cli_front_end.py --- a/kallithea/bin/kallithea_cli_front_end.py +++ b/kallithea/bin/kallithea_cli_front_end.py @@ -17,6 +17,7 @@ import kallithea.bin.kallithea_cli_base import os import subprocess +import json import kallithea @@ -60,3 +61,23 @@ def front_end_build(install_deps, genera subprocess.check_call([lesscpath, '--relative-urls', '--source-map', '--source-map-less-inline', lesspath, csspath], cwd=front_end_dir) + + click.echo("Generating LICENSES.txt") + check_licensing_json_path = os.path.join(tmp_dir, 'licensing.json') + licensing_txt_path = os.path.join(public_dir, 'LICENSES.txt') + subprocess.check_call([ + os.path.join(front_end_dir, 'node_modules', '.bin', 'license-checker'), + '--json', + '--out', check_licensing_json_path, + ], cwd=front_end_dir) + with open(check_licensing_json_path) as jsonfile: + rows = json.loads(jsonfile.read()) + with open(licensing_txt_path, 'w') as out: + out.write("The Kallithea front-end was built using the following Node modules:\n\n") + for name_version, values in sorted(rows.items()): + name, version = name_version.rsplit('@', 1) + line = "%s from https://www.npmjs.com/package/%s/v/%s\n License: %s\n Repository: %s\n" % ( + name_version, name, version, values['licenses'], values.get('repository', '-')) + if values.get('copyright'): + line += " Copyright: %s\n" % (values['copyright']) + out.write(line + '\n') diff --git a/kallithea/front-end/package.json b/kallithea/front-end/package.json --- a/kallithea/front-end/package.json +++ b/kallithea/front-end/package.json @@ -6,6 +6,7 @@ }, "devDependencies": { "less": "~2.7", - "less-plugin-clean-css": "~1.5" + "less-plugin-clean-css": "~1.5", + "license-checker": "24.1.0" } } diff --git a/kallithea/templates/about.html b/kallithea/templates/about.html --- a/kallithea/templates/about.html +++ b/kallithea/templates/about.html @@ -158,12 +158,17 @@
The above are the copyright holders who have submitted direct - contributions to the Kallithea repository. In - the Kallithea source - code, there is - a list + contributions to the Kallithea repository.
+ +In the Kallithea + source code, there is a + list of third-party libraries and code that Kallithea incorporates.
+The front-end contains a list of + software that is used to build the front-end but isn't distributed as a + part of Kallithea.
+