Changeset - 96b53ab02c2a
[Not reviewed]
default
0 3 0
Mads Kiilerich - 7 years ago 2018-12-25 20:23:42
mads@kiilerich.com
front-end: use license-checker to generate information about code used to build the front-end
3 files changed with 32 insertions and 5 deletions:
0 comments (0 inline, 0 general)
kallithea/bin/kallithea_cli_front_end.py
Show inline comments
 
@@ -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')
kallithea/front-end/package.json
Show inline comments
 
@@ -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"
 
  }
 
}
kallithea/templates/about.html
Show inline comments
 
@@ -158,12 +158,17 @@
 
  </ul>
 

	
 
  <p>The above are the copyright holders who have submitted direct
 
  contributions to the Kallithea repository.  In
 
  the <a href="https://kallithea-scm.org/repos/kallithea">Kallithea source
 
  code</a>, there is
 
  a <a href="https://kallithea-scm.org/repos/kallithea/files/tip/LICENSE.md">list
 
  contributions to the Kallithea repository.</p>
 

	
 
  <p>In the <a href="https://kallithea-scm.org/repos/kallithea">Kallithea
 
  source code</a>, there is a
 
  <a href="https://kallithea-scm.org/repos/kallithea/files/tip/LICENSE.md">list
 
  of third-party libraries and code that Kallithea incorporates</a>.</p>
 

	
 
  <p>The front-end contains a <a href="${h.url('/LICENSES.txt')}">list of
 
  software that is used to build the front-end</a> but isn't distributed as a
 
  part of Kallithea.</p>
 

	
 
  </div>
 
</div>
 

	
0 comments (0 inline, 0 general)