Skip to content

Commit 215bd1e

Browse files
committed
feat: don't git vendor lib
1 parent 8a9fa07 commit 215bd1e

File tree

8 files changed

+47
-27
lines changed

8 files changed

+47
-27
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,4 @@ tmp/*
5959
.idea/*
6060

6161
assets/*
62+
vendor/*

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ RUN poetry build && "$VENV_PATH/bin/pip" install dist/*.whl \
4444
# Static base
4545
FROM builder-base as static-base
4646

47-
RUN python manage.py collectstatic
47+
RUN python manage.py download_vendor_files && python manage.py collectstatic
4848

4949
# Static
5050
FROM nginx:mainline-alpine as static

controller/sentry/static/admin/chart/js/chart.date.min.js

Lines changed: 0 additions & 7 deletions
This file was deleted.

controller/sentry/static/admin/chart/js/chart.min.js

Lines changed: 0 additions & 15 deletions
This file was deleted.

controller/sentry/templates/admin/chart_change_form.html

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
{% extends "django_object_actions/change_form.html" %}
2-
{% load static %}
2+
{% load static vendor_tags %}
3+
34

45
{% block extrahead %}
56
{{ block.super }}
67
{{ media }}
7-
<script src="{% static 'admin/chart/js/chart.min.js' %}"></script>
8-
<script src="{% static 'admin/chart/js/chart.date.min.js' %}"></script>
8+
{% vendor 'chartjs' %}
9+
{% vendor 'chartjs-date' %}
910
<script src="{% static 'admin/chart/js/adminchart.js' %}"></script>
1011
{{ adminchart_chartjs_config|json_script:"adminchart-chartjs-config" }}
1112
{% endblock %}

controller/settings.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,28 @@
3535
MEDIA_URL = os.getenv("MEDIA_URL", "/assets/media/")
3636
STATIC_ROOT = os.path.join(BASE_DIR, "assets/static")
3737
MEDIA_ROOT = os.path.join(BASE_DIR, "assets/media")
38+
STATICFILES_DIRS = (os.path.join(BASE_DIR, "vendor/"),)
39+
40+
VENDOR = {
41+
"chartjs": {
42+
"url": "https://cdnjs.cloudflare.com/ajax/libs/Chart.js/3.9.1/",
43+
"js": [
44+
{
45+
"path": "chart.min.js",
46+
"sri": "sha384-9MhbyIRcBVQiiC7FSd7T38oJNj2Zh+EfxS7/vjhBi4OOT78NlHSnzM31EZRWR1LZ",
47+
}
48+
],
49+
},
50+
"chartjs-date": {
51+
"url": "https://cdn.jsdelivr.net/npm/[email protected]/dist/",
52+
"js": [
53+
{
54+
"path": "chartjs-adapter-date-fns.bundle.min.js",
55+
"sri": "sha384-cVMg8E3QFwTvGCDuK+ET4PD341jF3W8nO1auiXfuZNQkzbUUiBGLsIQUE+b1mxws",
56+
}
57+
],
58+
},
59+
}
3860

3961

4062
ALLOWED_HOSTS = os.getenv("ALLOWED_HOSTS", "").split(",")
@@ -77,6 +99,7 @@
7799
"health_check.cache",
78100
"health_check.storage",
79101
"django_celery_results",
102+
"vendor_files",
80103
"controller.sentry",
81104
]
82105

poetry.lock

Lines changed: 17 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ sentry-dynamic-sampling-lib = "^1.1.3"
3131
sentry-sdk = "^1.14.0"
3232
django-nonrelated-inlines = "^0.2"
3333
python-dateutil = "^2.8.2"
34+
django-vendor-files = "^0.3"
3435

3536

3637
[tool.poetry.group.dev.dependencies]

0 commit comments

Comments
 (0)