##// END OF EJS Templates
front-end: Introduce 'front-end' directory with source files for building the front-end...
Mads Kiilerich -
r7379:19a9f024 default
parent child Browse files
Show More
@@ -1,36 +1,37 b''
1 1 syntax: glob
2 2 *.pyc
3 3 *.swp
4 4 *.sqlite
5 5 *.tox
6 6 *.egg-info
7 7 *.egg
8 8 *.mo
9 9 .eggs/
10 10 tarballcache/
11 node_modules/
12 11
13 12 syntax: regexp
14 13 ^rcextensions
15 14 ^build
16 15 ^dist/
17 16 ^docs/build/
18 17 ^docs/_build/
19 18 ^data$
20 19 ^sql_dumps/
21 20 ^\.settings$
22 21 ^\.project$
23 22 ^\.pydevproject$
24 23 ^\.coverage$
24 ^kallithea/front-end/node_modules$
25 ^kallithea/front-end/package-lock\.json$
25 26 ^kallithea/public/css/style\.css(\.map)?$
26 27 ^kallithea/public/css/pygments.css$
27 28 ^theme\.less$
28 29 ^kallithea\.db$
29 30 ^test\.db$
30 31 ^Kallithea\.egg-info$
31 32 ^my\.ini$
32 33 ^fabfile.py
33 34 ^\.idea$
34 35 ^\.cache$
35 36 ^\.pytest_cache$
36 37 /__pycache__$
@@ -1,29 +1,29 b''
1 1 include .coveragerc
2 2 include Apache-License-2.0.txt
3 3 include CONTRIBUTORS
4 4 include COPYING
5 5 include Jenkinsfile
6 6 include LICENSE-MERGELY.html
7 7 include LICENSE.md
8 8 include MIT-Permissive-License.txt
9 9 include README.rst
10 10 include dev_requirements.txt
11 11 include development.ini
12 12 include pytest.ini
13 13 include requirements.txt
14 14 include tox.ini
15 include package.json
16 15 recursive-include docs *
17 16 recursive-include init.d *
18 17 recursive-include kallithea/alembic *
19 18 include kallithea/bin/ldap_sync.conf
20 19 include kallithea/lib/paster_commands/template.ini.mako
20 recursive-include kallithea/front-end *
21 21 recursive-include kallithea/i18n *
22 22 recursive-include kallithea/public *
23 23 recursive-include kallithea/templates *
24 24 recursive-include kallithea/tests/fixtures *
25 25 recursive-include kallithea/tests/scripts *
26 26 include kallithea/tests/models/test_dump_html_mails.ref.html
27 27 include kallithea/tests/performance/test_vcs.py
28 28 include kallithea/tests/vcs/aconfig
29 29 recursive-include scripts *
@@ -1,56 +1,58 b''
1 1 # -*- coding: utf-8 -*-
2 2 # This program is free software: you can redistribute it and/or modify
3 3 # it under the terms of the GNU General Public License as published by
4 4 # the Free Software Foundation, either version 3 of the License, or
5 5 # (at your option) any later version.
6 6 #
7 7 # This program is distributed in the hope that it will be useful,
8 8 # but WITHOUT ANY WARRANTY; without even the implied warranty of
9 9 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 10 # GNU General Public License for more details.
11 11 #
12 12 # You should have received a copy of the GNU General Public License
13 13 # along with this program. If not, see <http://www.gnu.org/licenses/>.
14 14
15 15 import click
16 16 import kallithea.bin.kallithea_cli_base as cli_base
17 17
18 18 import os
19 19 import subprocess
20 20
21 21 import kallithea
22 22
23 23 @cli_base.register_command()
24 24 @click.option('--install-deps/--no-install-deps', default=True,
25 25 help='Skip installation of dependencies, via "npm".')
26 26 @click.option('--generate/--no-generate', default=True,
27 27 help='Skip generation of front-end files.')
28 28 def front_end_build(install_deps, generate):
29 29 """Build the front-end.
30 30
31 31 Install required dependencies for the front-end and generate the necessary
32 32 files. This step is complementary to any 'pip install' step which only
33 33 covers Python dependencies.
34 34
35 35 The installation of front-end dependencies happens via the tool 'npm' which
36 36 is expected to be installed already.
37 37 """
38 rootdir = os.path.dirname(os.path.dirname(os.path.abspath(kallithea.__file__)))
38 front_end_dir = os.path.abspath(os.path.join(kallithea.__file__, '..', 'front-end'))
39 public_dir = os.path.abspath(os.path.join(kallithea.__file__, '..', 'public'))
39 40
40 41 if install_deps:
41 42 click.echo("Running 'npm install' to install front-end dependencies from package.json")
42 subprocess.check_call(['npm', 'install'], cwd=rootdir)
43 subprocess.check_call(['npm', 'install'], cwd=front_end_dir)
43 44
44 45 if generate:
45 46 click.echo("Generating CSS")
46 with open(os.path.join(rootdir, 'kallithea', 'public', 'css', 'pygments.css'), 'w') as f:
47 with open(os.path.join(public_dir, 'pygments.css'), 'w') as f:
47 48 subprocess.check_call(['pygmentize',
48 49 '-S', 'default',
49 50 '-f', 'html',
50 51 '-a', '.code-highlight'],
51 52 stdout=f)
52 lesscpath = os.path.join(rootdir, 'node_modules', '.bin', 'lessc')
53 lesspath = os.path.join(rootdir, 'kallithea', 'public', 'less', 'main.less')
54 csspath = os.path.join(rootdir, 'kallithea', 'public', 'css', 'style.css')
53 lesscpath = os.path.join(front_end_dir, 'node_modules', '.bin', 'lessc')
54 lesspath = os.path.join(public_dir, 'less', 'main.less')
55 csspath = os.path.join(public_dir, 'css', 'style.css')
55 56 subprocess.check_call([lesscpath, '--relative-urls', '--source-map',
56 '--source-map-less-inline', lesspath, csspath])
57 '--source-map-less-inline', lesspath, csspath],
58 cwd=front_end_dir)
1 NO CONTENT: file renamed from package.json to kallithea/front-end/package.json
General Comments 0
You need to be logged in to leave comments. Login now