# HG changeset patch # User Mads Kiilerich # Date 1543922180 -3600 # Node ID 19a9f02443c8423c3f216572c4c42af44b2f6225 # Parent b70ad5c7e70629eea7d6eeb79af8a4ced5b8171a front-end: Introduce 'front-end' directory with source files for building the front-end The top level with package.json is not included when installing with pip, and 'kallithea-cli front-end-build' and npm would thus fail. Instead, introduce 'kallithea/front-end/'. It is under 'kallithea/' and is thus included when doing pip install, but it is just a source directory and not under "public". Most of the "less" stuff should probably move there. And probably also most things that now are checked in under "public", so a fully populated public front-end directory can be built anywhere, without write access to the Python installation directory. diff -r b70ad5c7e706 -r 19a9f02443c8 .hgignore --- a/.hgignore Sun Dec 23 21:16:07 2018 +0100 +++ b/.hgignore Tue Dec 04 12:16:20 2018 +0100 @@ -8,7 +8,6 @@ *.mo .eggs/ tarballcache/ -node_modules/ syntax: regexp ^rcextensions @@ -22,6 +21,8 @@ ^\.project$ ^\.pydevproject$ ^\.coverage$ +^kallithea/front-end/node_modules$ +^kallithea/front-end/package-lock\.json$ ^kallithea/public/css/style\.css(\.map)?$ ^kallithea/public/css/pygments.css$ ^theme\.less$ diff -r b70ad5c7e706 -r 19a9f02443c8 MANIFEST.in --- a/MANIFEST.in Sun Dec 23 21:16:07 2018 +0100 +++ b/MANIFEST.in Tue Dec 04 12:16:20 2018 +0100 @@ -12,12 +12,12 @@ include pytest.ini include requirements.txt include tox.ini -include package.json recursive-include docs * recursive-include init.d * recursive-include kallithea/alembic * include kallithea/bin/ldap_sync.conf include kallithea/lib/paster_commands/template.ini.mako +recursive-include kallithea/front-end * recursive-include kallithea/i18n * recursive-include kallithea/public * recursive-include kallithea/templates * diff -r b70ad5c7e706 -r 19a9f02443c8 kallithea/bin/kallithea_cli_front_end.py --- a/kallithea/bin/kallithea_cli_front_end.py Sun Dec 23 21:16:07 2018 +0100 +++ b/kallithea/bin/kallithea_cli_front_end.py Tue Dec 04 12:16:20 2018 +0100 @@ -35,22 +35,24 @@ The installation of front-end dependencies happens via the tool 'npm' which is expected to be installed already. """ - rootdir = os.path.dirname(os.path.dirname(os.path.abspath(kallithea.__file__))) + 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=rootdir) + subprocess.check_call(['npm', 'install'], cwd=front_end_dir) if generate: click.echo("Generating CSS") - with open(os.path.join(rootdir, 'kallithea', 'public', 'css', 'pygments.css'), 'w') as f: + with open(os.path.join(public_dir, 'pygments.css'), 'w') as f: subprocess.check_call(['pygmentize', '-S', 'default', '-f', 'html', '-a', '.code-highlight'], stdout=f) - lesscpath = os.path.join(rootdir, 'node_modules', '.bin', 'lessc') - lesspath = os.path.join(rootdir, 'kallithea', 'public', 'less', 'main.less') - csspath = os.path.join(rootdir, 'kallithea', 'public', 'css', 'style.css') + 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]) + '--source-map-less-inline', lesspath, csspath], + cwd=front_end_dir) diff -r b70ad5c7e706 -r 19a9f02443c8 kallithea/front-end/package.json --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/kallithea/front-end/package.json Tue Dec 04 12:16:20 2018 +0100 @@ -0,0 +1,11 @@ +{ + "name": "kallithea", + "private": true, + "dependencies": { + "bootstrap": "3.3.7" + }, + "devDependencies": { + "less": "~2.7", + "less-plugin-clean-css": "~1.5" + } +} diff -r b70ad5c7e706 -r 19a9f02443c8 package.json --- a/package.json Sun Dec 23 21:16:07 2018 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,11 +0,0 @@ -{ - "name": "kallithea", - "private": true, - "dependencies": { - "bootstrap": "3.3.7" - }, - "devDependencies": { - "less": "~2.7", - "less-plugin-clean-css": "~1.5" - } -}