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