Changeset - bf514091b27f
[Not reviewed]
default
92 5 0
Mads Kiilerich (mads) - 7 years ago 2018-12-10 23:32:39
mads@kiilerich.com
front-end: Use codemirror from node_modules and stop bundling it
97 files changed with 13 insertions and 30560 deletions:
0 comments (0 inline, 0 general)
.hgignore
Show inline comments
 
syntax: glob
 
*.pyc
 
*.swp
 
*.sqlite
 
*.tox
 
*.egg-info
 
*.egg
 
*.mo
 
.eggs/
 
tarballcache/
 

	
 
syntax: regexp
 
^rcextensions
 
^build
 
^dist/
 
^docs/build/
 
^docs/_build/
 
^data$
 
^sql_dumps/
 
^\.settings$
 
^\.project$
 
^\.pydevproject$
 
^\.coverage$
 
^kallithea/front-end/node_modules$
 
^kallithea/front-end/package-lock\.json$
 
^kallithea/front-end/tmp$
 
^kallithea/public/codemirror$
 
^kallithea/public/css/select2-spinner\.gif$
 
^kallithea/public/css/select2\.png$
 
^kallithea/public/css/select2x2\.png$
 
^kallithea/public/css/style\.css$
 
^kallithea/public/css/style\.css\.map$
 
^kallithea/public/js/bootstrap\.js$
 
^kallithea/public/js/dataTables\.bootstrap\.js$
 
^kallithea/public/js/jquery\.dataTables\.js$
 
^kallithea/public/js/jquery\.flot\.js$
 
^kallithea/public/js/jquery\.flot\.selection\.js$
 
^kallithea/public/js/jquery\.flot\.time\.js$
 
^kallithea/public/js/jquery\.min\.js$
 
^kallithea/public/js/select2\.js$
 
^theme\.less$
 
^kallithea\.db$
 
^test\.db$
 
^Kallithea\.egg-info$
 
^my\.ini$
 
^fabfile.py
 
^\.idea$
 
^\.cache$
 
^\.pytest_cache$
 
/__pycache__$
LICENSE.md
Show inline comments
 
@@ -9,109 +9,109 @@ Inc. [A copy of GPLv3](/COPYING) is incl
 
Some individual files have copyright notices and those who offer changes to
 
those files should update the copyright notices in those specific files if
 
they so chose.
 

	
 
However, the definitive list of copyright holders for this project is kept in
 
[the about page template](kallithea/templates/about.html) so that it is
 
displayed appropriately when Kallithea is installed.  This is the most
 
important place to update copyright notices.
 

	
 
Third-Party Code Incorporated in Kallithea
 
==========================================
 

	
 
Various third-party code under GPLv3-compatible licenses is included as part
 
of Kallithea.
 

	
 

	
 
Alembic
 
-------
 

	
 
Kallithea incorporates an [Alembic](http://alembic.zzzcomputing.com/en/latest/)
 
"migration environment" in `kallithea/alembic`, portions of which is:
 

	
 
Copyright © 2009-2016 by Michael Bayer.
 
Alembic is a trademark of Michael Bayer.
 

	
 
and licensed under the MIT-permissive license, which is
 
[included in this distribution](MIT-Permissive-License.txt).
 

	
 

	
 
Bootstrap
 
---------
 

	
 
Kallithea uses the web framework called
 
[Bootstrap](http://getbootstrap.com/), which is:
 

	
 
Copyright © 2011-2016 Twitter, Inc.
 

	
 
and licensed under the MIT-permissive license, which is
 
[included in this distribution](MIT-Permissive-License.txt).
 

	
 
It is not distributed with Kallithea, but will be downloaded
 
using the ''kallithea-cli front-end-build'' command.
 

	
 

	
 

	
 
Codemirror
 
----------
 

	
 
Kallithea incorporates parts of the Javascript system called
 
Kallithea uses the Javascript system called
 
[Codemirror](http://codemirror.net/), version 4.7.0, which is primarily:
 

	
 
Copyright &copy; 2013-2014 by Marijn Haverbeke <marijnh@gmail.com>
 

	
 
and licensed under the MIT-permissive license, which is
 
[included in this distribution](MIT-Permissive-License.txt).
 

	
 
Additional files from upstream Codemirror are copyrighted by various authors
 
and licensed under other permissive licenses.  The sub-directories under
 
[.../public/codemirror](kallithea/public/codemirror) include the copyright and
 
license notice and information as they appeared in Codemirror's upstream
 
release.
 
and licensed under other permissive licenses.
 

	
 
It is not distributed with Kallithea, but will be downloaded
 
using the ''kallithea-cli front-end-build'' command.
 

	
 

	
 

	
 
jQuery
 
------
 

	
 
Kallithea uses the Javascript system called
 
[jQuery](http://jquery.org/).
 

	
 
It is Copyright 2013 jQuery Foundation and other contributors http://jquery.com/ and is under an
 
[MIT-permissive license](MIT-Permissive-License.txt).
 

	
 
It is not distributed with Kallithea, but will be downloaded
 
using the ''kallithea-cli front-end-build'' command.
 

	
 

	
 

	
 
DataTables
 
----------
 

	
 
Kallithea uses the Javascript system called
 
[DataTables](http://www.datatables.net/).
 

	
 
It is Copyright 2008-2015 SpryMedia Ltd. and is under an
 
[MIT-permissive license](MIT-Permissive-License.txt).
 

	
 
It is not distributed with Kallithea, but will be downloaded
 
using the ''kallithea-cli front-end-build'' command.
 

	
 

	
 

	
 
Mergely
 
-------
 

	
 
Kallithea incorporates some code from the Javascript system called
 
[Mergely](http://www.mergely.com/), version 3.3.9.
 
[Mergely's license](http://www.mergely.com/license.php), a
 
[copy of which is included in this repository](LICENSE-MERGELY.html),
 
is (GPL|LGPL|MPL).  Kallithea as GPLv3'd project chooses the GPL arm of that
 
tri-license.
 

	
 

	
 

	
 
Select2
 
-------
 

	
 
Kallithea uses the Javascript system called
 
[Select2](http://ivaynberg.github.io/select2/), which is:
kallithea/bin/kallithea_cli_front_end.py
Show inline comments
 
@@ -37,67 +37,72 @@ def front_end_build(install_deps, genera
 
    The installation of front-end dependencies happens via the tool 'npm' which
 
    is expected to be installed already.
 
    """
 
    front_end_dir = os.path.abspath(os.path.join(kallithea.__file__, '..', 'front-end'))
 
    public_dir = os.path.abspath(os.path.join(kallithea.__file__, '..', 'public'))
 

	
 
    if install_deps:
 
        click.echo("Running 'npm install' to install front-end dependencies from package.json")
 
        subprocess.check_call(['npm', 'install'], cwd=front_end_dir)
 

	
 
    if generate:
 
        tmp_dir = os.path.join(front_end_dir, 'tmp')
 
        if not os.path.isdir(tmp_dir):
 
            os.mkdir(tmp_dir)
 

	
 
        click.echo("Building CSS styling based on Bootstrap")
 
        with open(os.path.join(tmp_dir, 'pygments.css'), 'w') as f:
 
            subprocess.check_call(['pygmentize',
 
                    '-S', 'default',
 
                    '-f', 'html',
 
                    '-a', '.code-highlight'],
 
                    stdout=f)
 
        lesscpath = os.path.join(front_end_dir, 'node_modules', '.bin', 'lessc')
 
        lesspath = os.path.join(public_dir, 'less', 'main.less')
 
        csspath = os.path.join(public_dir, 'css', 'style.css')
 
        subprocess.check_call([lesscpath, '--relative-urls', '--source-map',
 
                '--source-map-less-inline', lesspath, csspath],
 
                cwd=front_end_dir)
 

	
 
        click.echo("Preparing Bootstrap JS")
 
        shutil.copy(os.path.join(front_end_dir, 'node_modules', 'bootstrap', 'dist', 'js', 'bootstrap.js'), os.path.join(public_dir, 'js', 'bootstrap.js'))
 

	
 
        click.echo("Preparing jQuery JS with Flot")
 
        shutil.copy(os.path.join(front_end_dir, 'node_modules', 'jquery', 'dist', 'jquery.min.js'), os.path.join(public_dir, 'js', 'jquery.min.js'))
 
        shutil.copy(os.path.join(front_end_dir, 'node_modules', 'jquery.flot', 'jquery.flot.js'), os.path.join(public_dir, 'js', 'jquery.flot.js'))
 
        shutil.copy(os.path.join(front_end_dir, 'node_modules', 'jquery.flot', 'jquery.flot.selection.js'), os.path.join(public_dir, 'js', 'jquery.flot.selection.js'))
 
        shutil.copy(os.path.join(front_end_dir, 'node_modules', 'jquery.flot', 'jquery.flot.time.js'), os.path.join(public_dir, 'js', 'jquery.flot.time.js'))
 

	
 
        click.echo("Preparing DataTables JS")
 
        shutil.copy(os.path.join(front_end_dir, 'node_modules', 'datatables.net', 'js', 'jquery.dataTables.js'), os.path.join(public_dir, 'js', 'jquery.dataTables.js'))
 
        shutil.copy(os.path.join(front_end_dir, 'node_modules', 'datatables.net-bs', 'js', 'dataTables.bootstrap.js'), os.path.join(public_dir, 'js', 'dataTables.bootstrap.js'))
 

	
 
        click.echo("Preparing Select2 JS")
 
        shutil.copy(os.path.join(front_end_dir, 'node_modules', 'select2', 'select2.js'), os.path.join(public_dir, 'js', 'select2.js'))
 
        shutil.copy(os.path.join(front_end_dir, 'node_modules', 'select2', 'select2.png'), os.path.join(public_dir, 'css', 'select2.png'))
 
        shutil.copy(os.path.join(front_end_dir, 'node_modules', 'select2', 'select2x2.png'), os.path.join(public_dir, 'css', 'select2x2.png'))
 
        shutil.copy(os.path.join(front_end_dir, 'node_modules', 'select2', 'select2-spinner.gif'), os.path.join(public_dir, 'css', 'select2-spinner.gif'))
 

	
 
        click.echo("Preparing CodeMirror JS")
 
        if os.path.isdir(os.path.join(public_dir, 'codemirror')):
 
            shutil.rmtree(os.path.join(public_dir, 'codemirror'))
 
        shutil.copytree(os.path.join(front_end_dir, 'node_modules', 'codemirror'), os.path.join(public_dir, 'codemirror'))
 

	
 
        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
 
{
 
  "name": "kallithea",
 
  "private": true,
 
  "dependencies": {
 
    "bootstrap": "3.3.7",
 
    "codemirror": "4.7",
 
    "datatables.net": "1.10.13",
 
    "datatables.net-bs": "1.10.13",
 
    "jquery": "1.12.3",
 
    "jquery.flot": "0.8.3",
 
    "select2": "3.5.1",
 
    "select2-bootstrap-css": "1.2.4"
 
  },
 
  "devDependencies": {
 
    "less": "~2.7",
 
    "less-plugin-clean-css": "~1.5",
 
    "license-checker": "24.1.0"
 
  }
 
}
kallithea/public/codemirror/LICENSE
Show inline comments
 
deleted file
kallithea/public/codemirror/lib/codemirror.css
Show inline comments
 
deleted file
kallithea/public/codemirror/lib/codemirror.js
Show inline comments
 
deleted file
kallithea/public/codemirror/mode/apl/apl.js
Show inline comments
 
deleted file
kallithea/public/codemirror/mode/asterisk/asterisk.js
Show inline comments
 
deleted file
kallithea/public/codemirror/mode/clike/clike.js
Show inline comments
 
deleted file
kallithea/public/codemirror/mode/clojure/clojure.js
Show inline comments
 
deleted file
kallithea/public/codemirror/mode/cobol/cobol.js
Show inline comments
 
deleted file
kallithea/public/codemirror/mode/coffeescript/coffeescript.js
Show inline comments
 
deleted file
kallithea/public/codemirror/mode/commonlisp/commonlisp.js
Show inline comments
 
deleted file
kallithea/public/codemirror/mode/css/css.js
Show inline comments
 
deleted file
kallithea/public/codemirror/mode/css/less_test.js
Show inline comments
 
deleted file
kallithea/public/codemirror/mode/css/scss_test.js
Show inline comments
 
deleted file
kallithea/public/codemirror/mode/cypher/cypher.js
Show inline comments
 
deleted file
kallithea/public/codemirror/mode/d/d.js
Show inline comments
 
deleted file
kallithea/public/codemirror/mode/diff/diff.js
Show inline comments
 
deleted file
kallithea/public/codemirror/mode/django/django.js
Show inline comments
 
deleted file
kallithea/public/codemirror/mode/dtd/dtd.js
Show inline comments
 
deleted file
kallithea/public/codemirror/mode/dylan/dylan.js
Show inline comments
 
deleted file
kallithea/public/codemirror/mode/ecl/ecl.js
Show inline comments
 
deleted file
kallithea/public/codemirror/mode/eiffel/eiffel.js
Show inline comments
 
deleted file
kallithea/public/codemirror/mode/erlang/erlang.js
Show inline comments
 
deleted file
kallithea/public/codemirror/mode/fortran/fortran.js
Show inline comments
 
deleted file
kallithea/public/codemirror/mode/gas/gas.js
Show inline comments
 
deleted file
kallithea/public/codemirror/mode/gfm/gfm.js
Show inline comments
 
deleted file
kallithea/public/codemirror/mode/gherkin/gherkin.js
Show inline comments
 
deleted file
kallithea/public/codemirror/mode/go/go.js
Show inline comments
 
deleted file
kallithea/public/codemirror/mode/groovy/groovy.js
Show inline comments
 
deleted file
kallithea/public/codemirror/mode/haml/haml.js
Show inline comments
 
deleted file
kallithea/public/codemirror/mode/haskell/haskell.js
Show inline comments
 
deleted file
kallithea/public/codemirror/mode/haxe/haxe.js
Show inline comments
 
deleted file
kallithea/public/codemirror/mode/htmlembedded/htmlembedded.js
Show inline comments
 
deleted file
kallithea/public/codemirror/mode/htmlmixed/htmlmixed.js
Show inline comments
 
deleted file
kallithea/public/codemirror/mode/http/http.js
Show inline comments
 
deleted file
kallithea/public/codemirror/mode/jade/jade.js
Show inline comments
 
deleted file
kallithea/public/codemirror/mode/javascript/javascript.js
Show inline comments
 
deleted file
kallithea/public/codemirror/mode/jinja2/jinja2.js
Show inline comments
 
deleted file
kallithea/public/codemirror/mode/julia/julia.js
Show inline comments
 
deleted file
kallithea/public/codemirror/mode/kotlin/kotlin.js
Show inline comments
 
deleted file
kallithea/public/codemirror/mode/livescript/livescript.js
Show inline comments
 
deleted file
kallithea/public/codemirror/mode/lua/lua.js
Show inline comments
 
deleted file
kallithea/public/codemirror/mode/markdown/markdown.js
Show inline comments
 
deleted file
kallithea/public/codemirror/mode/meta.js
Show inline comments
 
deleted file
kallithea/public/codemirror/mode/mirc/mirc.js
Show inline comments
 
deleted file
kallithea/public/codemirror/mode/mllike/mllike.js
Show inline comments
 
deleted file
kallithea/public/codemirror/mode/modelica/modelica.js
Show inline comments
 
deleted file
kallithea/public/codemirror/mode/nginx/nginx.js
Show inline comments
 
deleted file
kallithea/public/codemirror/mode/ntriples/ntriples.js
Show inline comments
 
deleted file
kallithea/public/codemirror/mode/octave/octave.js
Show inline comments
 
deleted file
kallithea/public/codemirror/mode/pascal/pascal.js
Show inline comments
 
deleted file
kallithea/public/codemirror/mode/pegjs/pegjs.js
Show inline comments
 
deleted file
kallithea/public/codemirror/mode/perl/perl.js
Show inline comments
 
deleted file
kallithea/public/codemirror/mode/php/php.js
Show inline comments
 
deleted file
kallithea/public/codemirror/mode/pig/pig.js
Show inline comments
 
deleted file
kallithea/public/codemirror/mode/properties/properties.js
Show inline comments
 
deleted file
kallithea/public/codemirror/mode/puppet/puppet.js
Show inline comments
 
deleted file
kallithea/public/codemirror/mode/python/python.js
Show inline comments
 
deleted file
kallithea/public/codemirror/mode/q/q.js
Show inline comments
 
deleted file
kallithea/public/codemirror/mode/r/r.js
Show inline comments
 
deleted file
kallithea/public/codemirror/mode/rpm/rpm.js
Show inline comments
 
deleted file
kallithea/public/codemirror/mode/rst/rst.js
Show inline comments
 
deleted file
kallithea/public/codemirror/mode/ruby/ruby.js
Show inline comments
 
deleted file
kallithea/public/codemirror/mode/rust/rust.js
Show inline comments
 
deleted file
kallithea/public/codemirror/mode/sass/sass.js
Show inline comments
 
deleted file
kallithea/public/codemirror/mode/scheme/scheme.js
Show inline comments
 
deleted file
kallithea/public/codemirror/mode/shell/shell.js
Show inline comments
 
deleted file
kallithea/public/codemirror/mode/sieve/sieve.js
Show inline comments
 
deleted file
kallithea/public/codemirror/mode/slim/slim.js
Show inline comments
 
deleted file
kallithea/public/codemirror/mode/smalltalk/smalltalk.js
Show inline comments
 
deleted file
kallithea/public/codemirror/mode/smarty/smarty.js
Show inline comments
 
deleted file
kallithea/public/codemirror/mode/smartymixed/smartymixed.js
Show inline comments
 
deleted file
kallithea/public/codemirror/mode/solr/solr.js
Show inline comments
 
deleted file
kallithea/public/codemirror/mode/sparql/sparql.js
Show inline comments
 
deleted file
kallithea/public/codemirror/mode/sql/sql.js
Show inline comments
 
deleted file
kallithea/public/codemirror/mode/stex/stex.js
Show inline comments
 
deleted file
kallithea/public/codemirror/mode/tcl/tcl.js
Show inline comments
 
deleted file
kallithea/public/codemirror/mode/textile/textile.js
Show inline comments
 
deleted file
kallithea/public/codemirror/mode/tiddlywiki/tiddlywiki.css
Show inline comments
 
deleted file
kallithea/public/codemirror/mode/tiddlywiki/tiddlywiki.js
Show inline comments
 
deleted file
kallithea/public/codemirror/mode/tiki/tiki.css
Show inline comments
 
deleted file
kallithea/public/codemirror/mode/tiki/tiki.js
Show inline comments
 
deleted file
kallithea/public/codemirror/mode/toml/toml.js
Show inline comments
 
deleted file
kallithea/public/codemirror/mode/tornado/tornado.js
Show inline comments
 
deleted file
kallithea/public/codemirror/mode/turtle/turtle.js
Show inline comments
 
deleted file
kallithea/public/codemirror/mode/vb/vb.js
Show inline comments
 
deleted file
kallithea/public/codemirror/mode/vbscript/vbscript.js
Show inline comments
 
deleted file
kallithea/public/codemirror/mode/velocity/velocity.js
Show inline comments
 
deleted file
kallithea/public/codemirror/mode/verilog/verilog.js
Show inline comments
 
deleted file
kallithea/public/codemirror/mode/xml/xml.js
Show inline comments
 
deleted file
kallithea/public/codemirror/mode/xquery/xquery.js
Show inline comments
 
deleted file
kallithea/public/codemirror/mode/yaml/yaml.js
Show inline comments
 
deleted file
kallithea/public/codemirror/mode/z80/z80.js
Show inline comments
 
deleted file
scripts/whitespacecleanup.sh
Show inline comments
 
#!/bin/bash -x
 

	
 
# Enforce some consistency in whitespace - just to avoid spurious whitespaces changes
 

	
 
files=`hg mani | egrep -v '/codemirror/|/fontello/|/email_templates/|(/lockfiles.py|^LICENSE-MERGELY.html|^docs/Makefile|^scripts/whitespacecleanup.sh|/(graph|mergely|native.history|yui.2.9)\.js|/test_dump_html_mails.ref.html|\.png|\.gif|\.ico|\.pot|\.po|\.mo|\.tar\.gz|\.diff)$'`
 
files=`hg mani | egrep -v '/fontello/|/email_templates/|(/lockfiles.py|^LICENSE-MERGELY.html|^docs/Makefile|^scripts/whitespacecleanup.sh|/(graph|mergely|native.history|yui.2.9)\.js|/test_dump_html_mails.ref.html|\.png|\.gif|\.ico|\.pot|\.po|\.mo|\.tar\.gz|\.diff)$'`
 

	
 
sed -i "s/`printf '\r'`//g" $files
 
sed -i -e "s,`printf '\t'`,    ,g" $files
 
sed -i -e "s,  *$,,g" $files
 
sed -i -e 's,\([^ ]\)\\$,\1 \\,g' -e 's,\(["'"'"']["'"'"']["'"'"']\) \\$,\1\\,g' $files
 
# ensure one trailing newline - remove empty last line and make last line include trailing newline:
 
sed -i -e '$,${/^$/d}' -e '$a\' $files
 

	
 
sed -i -e 's,\([^ /]\){,\1 {,g' `hg loc '*.css'`
 
sed -i -e 's|^\([^ /].*,\)\([^ ]\)|\1 \2|g' `hg loc '*.css'`
 

	
 
hg mani | xargs chmod -x
 
hg loc 'set:!binary()&grep("^#!")&!(**_tmpl.py)&!(**/template**)' | xargs chmod +x
 

	
 
hg diff
0 comments (0 inline, 0 general)