Skip to content

Commit 663c610

Browse files
committed
Improve frontend build: drop django-npm, restructure, manifest storage for cache busting
1 parent 2a9f059 commit 663c610

24 files changed

+43
-46
lines changed

.ci/run-tests-for-ci.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,24 @@ cp local_settings_example.py local_settings.py
1111
poetry run python manage.py makemessages --all
1212
poetry run python manage.py compilemessages
1313

14+
staticfiles=(
15+
bundle-base.js
16+
bundle-base-with-markup.js
17+
bundle-codemirror.js
18+
bundle-datatables.js
19+
bundle-fullcalendar.js
20+
bundle-prosemirror.js
21+
bundle-prosemirror.js
22+
tex-svg.js
23+
)
24+
25+
mkdir -p frontend-dist
26+
for i in "${staticfiles[@]}"; do
27+
touch "frontend-dist/$i"
28+
done
29+
30+
poetry run python manage.py collectstatic
31+
1432
echo "Starts testing"
1533
export RELATE_LOCAL_TEST_SETTINGS="local_settings_example.py"
1634

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ jobs:
6767
run: npm install
6868

6969
- name: ESLint
70-
run: npx eslint relate/static/js/*.js
70+
run: npx eslint frontend/js/*.js
7171

7272
- name: Rollup build
7373
run: npm run build

collectstatic.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#! /bin/bash
2+
3+
find node_modules/mathjax/es5 -name '*.js' -exec sed -i /sourceMappingURL=/d '{}' \;
4+
poetry run python manage.py collectstatic

course/templates/course/course-base-with-markup.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44
{% block bundle_loads %}
55
{# contains mathjax config #}
66
<script src="{% static 'bundle-base-with-markup.js' %}"></script>
7-
<script src="{% static "mathjax/es5/tex-svg.js" %}" id="MathJax-script" async></script>
7+
<script src="{% static "tex-svg.js" %}" id="MathJax-script" async></script>
88
{% endblock %}

doc/misc.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,11 +194,14 @@ Additional Setup Steps for Deploying to Production
194194

195195
* Run::
196196

197-
python manage.py collectstatic
197+
./collectstatic.sh
198198

199199
to assemble the required collection of static files to be served, as the
200200
production app server will not serve them (unlike the dev server).
201201

202+
(Do not run ``python manage.py collectstatic`` directly; it will fail
203+
because it cannot resolve some source map URLs in mathjax.)
204+
202205
Configuring uwsgi
203206
^^^^^^^^^^^^^^^^^
204207

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)