diff --git a/.hgignore b/.hgignore --- a/.hgignore +++ b/.hgignore @@ -8,7 +8,6 @@ syntax: glob *.mo .eggs/ tarballcache/ -node_modules/ syntax: regexp ^rcextensions @@ -22,6 +21,8 @@ syntax: regexp ^\.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 --git a/MANIFEST.in b/MANIFEST.in --- a/MANIFEST.in +++ b/MANIFEST.in @@ -12,12 +12,12 @@ include development.ini 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 --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 @@ -35,22 +35,24 @@ 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. """ - 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 --git a/package.json b/kallithea/front-end/package.json rename from package.json rename to kallithea/front-end/package.json