Compare commits

..

2 Commits

Author SHA1 Message Date
716fe55082 membershipworks: Fix missing bootstrap CSS in invoice PDFs
Some checks failed
Ruff / ruff (push) Successful in 34s
Test / test (push) Failing after 2m33s
2024-07-24 20:01:27 -04:00
6f36a7c8b4 Automatically detect .entry.ts files as Vite entry points 2024-07-24 01:50:34 -04:00
10 changed files with 146 additions and 16 deletions

View File

@ -3,7 +3,7 @@
{% load django_vite %} {% load django_vite %}
{% block vite_extra_assets %} {% block vite_extra_assets %}
{% vite_asset 'dashboard/js/dashboard.ts' %} {% vite_asset 'dashboard/js/dashboard.entry.ts' %}
{% endblock %} {% endblock %}
{% block title %}Claremont MakerSpace Management{% endblock %} {% block title %}Claremont MakerSpace Management{% endblock %}

View File

@ -1,3 +1,3 @@
import "bootstrap/scss/bootstrap.scss"; import "./bootstrap-css-only.entry.ts";
import "bootstrap-icons/font/bootstrap-icons.css"; import "bootstrap-icons/font/bootstrap-icons.css";
import "bootstrap"; import "bootstrap";

View File

@ -1,13 +1,13 @@
{% load static %} {% load static %}
{% load nh3_tags %} {% load nh3_tags %}
{% load django_vite %}
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" <meta name="viewport"
content="width=device-width, initial-scale=1, shrink-to-fit=no"> content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS --> {% vite_asset 'js/bootstrap-css-only.entry.ts' %}
<link href="{% static 'bootstrap.min.css' %}" rel="stylesheet">
<link rel="stylesheet" href="{% static "membershipworks/css/event_invoice_pdf.css" %}" media="print"> <link rel="stylesheet" href="{% static "membershipworks/css/event_invoice_pdf.css" %}" media="print">
{% if preview %} {% if preview %}
<link rel="stylesheet" href="{% static "membershipworks/css/event_invoice_pdf_preview.css" %}" media="print"> <link rel="stylesheet" href="{% static "membershipworks/css/event_invoice_pdf_preview.css" %}" media="print">

View File

@ -11,6 +11,7 @@
"devDependencies": { "devDependencies": {
"@types/bootstrap": "^5.2.10", "@types/bootstrap": "^5.2.10",
"@types/tabulator-tables": "^6.2.3", "@types/tabulator-tables": "^6.2.3",
"globby": "^14.0.2",
"prettier": "^3.3.3", "prettier": "^3.3.3",
"sass": "^1.77.8", "sass": "^1.77.8",
"typescript": "^5.5.4", "typescript": "^5.5.4",

View File

@ -3,7 +3,7 @@
{% load django_vite %} {% load django_vite %}
{% block vite_extra_assets %} {% block vite_extra_assets %}
{% vite_asset 'paperwork/js/department_certifications.ts' %} {% vite_asset 'paperwork/js/department_certifications.entry.ts' %}
{% endblock %} {% endblock %}
{% block content %} {% block content %}

View File

@ -27,6 +27,9 @@ importers:
'@types/tabulator-tables': '@types/tabulator-tables':
specifier: ^6.2.3 specifier: ^6.2.3
version: 6.2.3 version: 6.2.3
globby:
specifier: ^14.0.2
version: 14.0.2
prettier: prettier:
specifier: ^3.3.3 specifier: ^3.3.3
version: 3.3.3 version: 3.3.3
@ -180,6 +183,18 @@ packages:
cpu: [x64] cpu: [x64]
os: [win32] os: [win32]
'@nodelib/fs.scandir@2.1.5':
resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==}
engines: {node: '>= 8'}
'@nodelib/fs.stat@2.0.5':
resolution: {integrity: sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==}
engines: {node: '>= 8'}
'@nodelib/fs.walk@1.2.8':
resolution: {integrity: sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==}
engines: {node: '>= 8'}
'@popperjs/core@2.11.8': '@popperjs/core@2.11.8':
resolution: {integrity: sha512-P1st0aksCrn9sGZhp8GMYwBnQsbvAWsZAX44oXNNvLHGqAOcoVxmjZiohstwQ7SqKnbR47akdNi+uleWD8+g6A==} resolution: {integrity: sha512-P1st0aksCrn9sGZhp8GMYwBnQsbvAWsZAX44oXNNvLHGqAOcoVxmjZiohstwQ7SqKnbR47akdNi+uleWD8+g6A==}
@ -263,6 +278,10 @@ packages:
cpu: [x64] cpu: [x64]
os: [win32] os: [win32]
'@sindresorhus/merge-streams@2.3.0':
resolution: {integrity: sha512-LtoMMhxAlorcGhmFYI+LhPgbPZCkgP6ra1YL604EeF6U98pLlQ3iWIGMdWSC+vWmPBWBNgmDBAhnAobLROJmwg==}
engines: {node: '>=18'}
'@types/bootstrap@5.2.10': '@types/bootstrap@5.2.10':
resolution: {integrity: sha512-F2X+cd6551tep0MvVZ6nM8v7XgGN/twpdNDjqS1TUM7YFNEtQYWk+dKAnH+T1gr6QgCoGMPl487xw/9hXooa2g==} resolution: {integrity: sha512-F2X+cd6551tep0MvVZ6nM8v7XgGN/twpdNDjqS1TUM7YFNEtQYWk+dKAnH+T1gr6QgCoGMPl487xw/9hXooa2g==}
@ -301,6 +320,13 @@ packages:
engines: {node: '>=12'} engines: {node: '>=12'}
hasBin: true hasBin: true
fast-glob@3.3.2:
resolution: {integrity: sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow==}
engines: {node: '>=8.6.0'}
fastq@1.17.1:
resolution: {integrity: sha512-sRVD3lWVIXWg6By68ZN7vho9a1pQcN/WBFaAAsDDFzlJjvoGx0P8z7V1t72grFJfJhu3YPZBuu25f7Kaw2jN1w==}
fill-range@7.1.1: fill-range@7.1.1:
resolution: {integrity: sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==} resolution: {integrity: sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==}
engines: {node: '>=8'} engines: {node: '>=8'}
@ -314,6 +340,14 @@ packages:
resolution: {integrity: sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==} resolution: {integrity: sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==}
engines: {node: '>= 6'} engines: {node: '>= 6'}
globby@14.0.2:
resolution: {integrity: sha512-s3Fq41ZVh7vbbe2PN3nrW7yC7U7MFVc5c98/iTl9c2GawNMKx/J648KQRW6WKkuU8GIbbh2IXfIRQjOZnXcTnw==}
engines: {node: '>=18'}
ignore@5.3.1:
resolution: {integrity: sha512-5Fytz/IraMjqpwfd34ke28PTVMjZjJG2MPn5t7OE4eUCUNf8BAa7b5WUS9/Qvr6mwOQS7Mk6vdsMno5he+T8Xw==}
engines: {node: '>= 4'}
immutable@4.3.7: immutable@4.3.7:
resolution: {integrity: sha512-1hqclzwYwjRDFLjcFxOM5AYkkG0rpFPpr1RLPMEuGczoS7YA8gLhy8SWXYRAA/XwfEHpfo3cw5JGioS32fnMRw==} resolution: {integrity: sha512-1hqclzwYwjRDFLjcFxOM5AYkkG0rpFPpr1RLPMEuGczoS7YA8gLhy8SWXYRAA/XwfEHpfo3cw5JGioS32fnMRw==}
@ -333,6 +367,14 @@ packages:
resolution: {integrity: sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==} resolution: {integrity: sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==}
engines: {node: '>=0.12.0'} engines: {node: '>=0.12.0'}
merge2@1.4.1:
resolution: {integrity: sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==}
engines: {node: '>= 8'}
micromatch@4.0.7:
resolution: {integrity: sha512-LPP/3KorzCwBxfeUuZmaR6bG2kdeHSbe0P2tY3FLRU4vYrjYz5hI4QZwV0njUx3jeuKe67YukQ1LSPZBKDqO/Q==}
engines: {node: '>=8.6'}
nanoid@3.3.7: nanoid@3.3.7:
resolution: {integrity: sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==} resolution: {integrity: sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==}
engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1}
@ -342,6 +384,10 @@ packages:
resolution: {integrity: sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==} resolution: {integrity: sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==}
engines: {node: '>=0.10.0'} engines: {node: '>=0.10.0'}
path-type@5.0.0:
resolution: {integrity: sha512-5HviZNaZcfqP95rwpv+1HDgUamezbqdSYTyzjTvwtJSnIH+3vnbmWsItli8OFEndS984VT55M3jduxZbX351gg==}
engines: {node: '>=12'}
picocolors@1.0.1: picocolors@1.0.1:
resolution: {integrity: sha512-anP1Z8qwhkbmu7MFP5iTt+wQKXgwzf7zTyGlcdzabySa9vd0Xt392U0rVmz9poOaBj0uHJKyyo9/upk0HrEQew==} resolution: {integrity: sha512-anP1Z8qwhkbmu7MFP5iTt+wQKXgwzf7zTyGlcdzabySa9vd0Xt392U0rVmz9poOaBj0uHJKyyo9/upk0HrEQew==}
@ -358,20 +404,34 @@ packages:
engines: {node: '>=14'} engines: {node: '>=14'}
hasBin: true hasBin: true
queue-microtask@1.2.3:
resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==}
readdirp@3.6.0: readdirp@3.6.0:
resolution: {integrity: sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==} resolution: {integrity: sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==}
engines: {node: '>=8.10.0'} engines: {node: '>=8.10.0'}
reusify@1.0.4:
resolution: {integrity: sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==}
engines: {iojs: '>=1.0.0', node: '>=0.10.0'}
rollup@4.19.0: rollup@4.19.0:
resolution: {integrity: sha512-5r7EYSQIowHsK4eTZ0Y81qpZuJz+MUuYeqmmYmRMl1nwhdmbiYqt5jwzf6u7wyOzJgYqtCRMtVRKOtHANBz7rA==} resolution: {integrity: sha512-5r7EYSQIowHsK4eTZ0Y81qpZuJz+MUuYeqmmYmRMl1nwhdmbiYqt5jwzf6u7wyOzJgYqtCRMtVRKOtHANBz7rA==}
engines: {node: '>=18.0.0', npm: '>=8.0.0'} engines: {node: '>=18.0.0', npm: '>=8.0.0'}
hasBin: true hasBin: true
run-parallel@1.2.0:
resolution: {integrity: sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==}
sass@1.77.8: sass@1.77.8:
resolution: {integrity: sha512-4UHg6prsrycW20fqLGPShtEvo/WyHRVRHwOP4DzkUrObWoWI05QBSfzU71TVB7PFaL104TwNaHpjlWXAZbQiNQ==} resolution: {integrity: sha512-4UHg6prsrycW20fqLGPShtEvo/WyHRVRHwOP4DzkUrObWoWI05QBSfzU71TVB7PFaL104TwNaHpjlWXAZbQiNQ==}
engines: {node: '>=14.0.0'} engines: {node: '>=14.0.0'}
hasBin: true hasBin: true
slash@5.1.0:
resolution: {integrity: sha512-ZA6oR3T/pEyuqwMgAKT0/hAv8oAXckzbkmR0UkUosQ+Mc4RxGoJkRmwHgHufaenlyAgE1Mxgpdcrf75y6XcnDg==}
engines: {node: '>=14.16'}
source-map-js@1.2.0: source-map-js@1.2.0:
resolution: {integrity: sha512-itJW8lvSA0TXEphiRoawsCksnlf8SyvmFzIhltqAHluXd88pkCd+cXJVHTDwdCr0IzwptSm035IHQktUu1QUMg==} resolution: {integrity: sha512-itJW8lvSA0TXEphiRoawsCksnlf8SyvmFzIhltqAHluXd88pkCd+cXJVHTDwdCr0IzwptSm035IHQktUu1QUMg==}
engines: {node: '>=0.10.0'} engines: {node: '>=0.10.0'}
@ -388,6 +448,10 @@ packages:
engines: {node: '>=14.17'} engines: {node: '>=14.17'}
hasBin: true hasBin: true
unicorn-magic@0.1.0:
resolution: {integrity: sha512-lRfVq8fE8gz6QMBuDM6a+LO3IAzTi05H6gCVaUpir2E1Rwpo4ZUog45KpNXKC/Mn3Yb9UDuHumeFTo9iV/D9FQ==}
engines: {node: '>=18'}
vite@5.3.4: vite@5.3.4:
resolution: {integrity: sha512-Cw+7zL3ZG9/NZBB8C+8QbQZmR54GwqIz+WMI4b3JgdYJvX+ny9AjJXqkGQlDXSXRP9rP0B4tbciRMOVEKulVOA==} resolution: {integrity: sha512-Cw+7zL3ZG9/NZBB8C+8QbQZmR54GwqIz+WMI4b3JgdYJvX+ny9AjJXqkGQlDXSXRP9rP0B4tbciRMOVEKulVOA==}
engines: {node: ^18.0.0 || >=20.0.0} engines: {node: ^18.0.0 || >=20.0.0}
@ -487,6 +551,18 @@ snapshots:
'@esbuild/win32-x64@0.21.5': '@esbuild/win32-x64@0.21.5':
optional: true optional: true
'@nodelib/fs.scandir@2.1.5':
dependencies:
'@nodelib/fs.stat': 2.0.5
run-parallel: 1.2.0
'@nodelib/fs.stat@2.0.5': {}
'@nodelib/fs.walk@1.2.8':
dependencies:
'@nodelib/fs.scandir': 2.1.5
fastq: 1.17.1
'@popperjs/core@2.11.8': {} '@popperjs/core@2.11.8': {}
'@rollup/rollup-android-arm-eabi@4.19.0': '@rollup/rollup-android-arm-eabi@4.19.0':
@ -537,6 +613,8 @@ snapshots:
'@rollup/rollup-win32-x64-msvc@4.19.0': '@rollup/rollup-win32-x64-msvc@4.19.0':
optional: true optional: true
'@sindresorhus/merge-streams@2.3.0': {}
'@types/bootstrap@5.2.10': '@types/bootstrap@5.2.10':
dependencies: dependencies:
'@popperjs/core': 2.11.8 '@popperjs/core': 2.11.8
@ -600,6 +678,18 @@ snapshots:
'@esbuild/win32-ia32': 0.21.5 '@esbuild/win32-ia32': 0.21.5
'@esbuild/win32-x64': 0.21.5 '@esbuild/win32-x64': 0.21.5
fast-glob@3.3.2:
dependencies:
'@nodelib/fs.stat': 2.0.5
'@nodelib/fs.walk': 1.2.8
glob-parent: 5.1.2
merge2: 1.4.1
micromatch: 4.0.7
fastq@1.17.1:
dependencies:
reusify: 1.0.4
fill-range@7.1.1: fill-range@7.1.1:
dependencies: dependencies:
to-regex-range: 5.0.1 to-regex-range: 5.0.1
@ -611,6 +701,17 @@ snapshots:
dependencies: dependencies:
is-glob: 4.0.3 is-glob: 4.0.3
globby@14.0.2:
dependencies:
'@sindresorhus/merge-streams': 2.3.0
fast-glob: 3.3.2
ignore: 5.3.1
path-type: 5.0.0
slash: 5.1.0
unicorn-magic: 0.1.0
ignore@5.3.1: {}
immutable@4.3.7: {} immutable@4.3.7: {}
is-binary-path@2.1.0: is-binary-path@2.1.0:
@ -625,10 +726,19 @@ snapshots:
is-number@7.0.0: {} is-number@7.0.0: {}
merge2@1.4.1: {}
micromatch@4.0.7:
dependencies:
braces: 3.0.3
picomatch: 2.3.1
nanoid@3.3.7: {} nanoid@3.3.7: {}
normalize-path@3.0.0: {} normalize-path@3.0.0: {}
path-type@5.0.0: {}
picocolors@1.0.1: {} picocolors@1.0.1: {}
picomatch@2.3.1: {} picomatch@2.3.1: {}
@ -641,10 +751,14 @@ snapshots:
prettier@3.3.3: {} prettier@3.3.3: {}
queue-microtask@1.2.3: {}
readdirp@3.6.0: readdirp@3.6.0:
dependencies: dependencies:
picomatch: 2.3.1 picomatch: 2.3.1
reusify@1.0.4: {}
rollup@4.19.0: rollup@4.19.0:
dependencies: dependencies:
'@types/estree': 1.0.5 '@types/estree': 1.0.5
@ -667,12 +781,18 @@ snapshots:
'@rollup/rollup-win32-x64-msvc': 4.19.0 '@rollup/rollup-win32-x64-msvc': 4.19.0
fsevents: 2.3.3 fsevents: 2.3.3
run-parallel@1.2.0:
dependencies:
queue-microtask: 1.2.3
sass@1.77.8: sass@1.77.8:
dependencies: dependencies:
chokidar: 3.6.0 chokidar: 3.6.0
immutable: 4.3.7 immutable: 4.3.7
source-map-js: 1.2.0 source-map-js: 1.2.0
slash@5.1.0: {}
source-map-js@1.2.0: {} source-map-js@1.2.0: {}
tabulator-tables@6.2.5: {} tabulator-tables@6.2.5: {}
@ -683,6 +803,8 @@ snapshots:
typescript@5.5.4: {} typescript@5.5.4: {}
unicorn-magic@0.1.0: {}
vite@5.3.4(sass@1.77.8): vite@5.3.4(sass@1.77.8):
dependencies: dependencies:
esbuild: 0.21.5 esbuild: 0.21.5

View File

@ -10,7 +10,7 @@
<meta name="viewport" <meta name="viewport"
content="width=device-width, initial-scale=1, shrink-to-fit=no"> content="width=device-width, initial-scale=1, shrink-to-fit=no">
{% block vite_assets %} {% block vite_assets %}
{% vite_asset 'js/base.ts' %} {% vite_asset 'js/base.entry.ts' %}
{% block vite_extra_assets %}{% endblock %} {% block vite_extra_assets %}{% endblock %}
{% endblock %} {% endblock %}
<title> <title>

View File

@ -1,5 +1,19 @@
import { resolve, join } from "node:path"; import path from "node:path";
import { defineConfig } from "vite"; import { defineConfig } from "vite";
import { globbySync } from "globby";
const entry_points = globbySync("*/js/*.entry.ts", { gitignore: true });
const inputs = {
base: "./js/base.entry.ts",
"bootstrap-css-only": "./js/bootstrap-css-only.entry.ts",
};
for (const entry of entry_points) {
inputs[
path.dirname(path.dirname(entry)) + "/" + path.basename(entry, ".entry.ts")
] = entry;
}
export default defineConfig({ export default defineConfig({
base: "/static/", base: "/static/",
@ -9,14 +23,7 @@ export default defineConfig({
}, },
build: { build: {
manifest: "manifest.json", manifest: "manifest.json",
outDir: resolve("./vite-dist"), outDir: path.resolve("./vite-dist"),
rollupOptions: { rollupOptions: { input: inputs },
input: {
base: "./js/base.ts",
"paperwork/department_certifications":
"./paperwork/js/department_certifications.ts",
"dashboard/dashboard": "./dashboard/js/dashboard.ts",
},
},
}, },
}); });