1
0
Fork 0
mirror of https://github.com/MatomoCamp/pretalx.git synced 2024-09-09 05:13:44 +02:00

Move frontend under pretalx/ for easier packaging

This commit is contained in:
Tobias Kunze 2023-08-26 19:58:15 +02:00
parent e0a4cfb001
commit 86fe1fccc6
30 changed files with 14 additions and 13 deletions

View file

@ -83,7 +83,7 @@ jobs:
if: matrix.database == 'postgres'
- name: Install frontend dependencies
run: npm ci
working-directory: ./src/frontend/schedule-editor
working-directory: ./src/pretalx/frontend/schedule-editor
- name: Run checks
run: python manage.py check --deploy
working-directory: ./src

View file

@ -9,11 +9,13 @@ exclude src/pretalx.cfg
recursive-exclude doc *
recursive-exclude src/data *
recursive-exclude src/local *
recursive-exclude src/static.dist *
recursive-include src/pretalx/frontend *
recursive-exclude src/pretalx/frontend/schedule-editor/dist *
recursive-exclude src/pretalx/frontend/schedule-editor/node_modules *
recursive-exclude src/frontend/schedule-editor/node_modules *
recursive-include src/frontend *
recursive-include src/pretalx/static *
recursive-include src/static.dist *
recursive-include src/pretalx/locale *
recursive-include src/pretalx/agenda/templates *
recursive-include src/pretalx/api/templates *

View file

@ -119,7 +119,7 @@ all sites except those that use big custom JavaScript components, like the sched
In order to use those, you have two options in any case, you will need to have ``node`` and
``npm`` installed on your system.
Then go to the ``src/frontend/schedule-editor`` folder and run::
Then go to the ``src/pretalx/frontend/schedule-editor`` folder and run::
(env)$ npm install

View file

@ -115,6 +115,7 @@ version = {attr = "pretalx.__version__"}
[tool.setuptools.packages.find]
where = ["src"]
include = ["pretalx*"]
exclude = ["pretalx/frontend/node_modules"]
namespaces = false
[tool.check-manifest]

View file

@ -17,8 +17,7 @@ class Command(Parent):
# run "npm start" in the frontend directory
frontend_dir = (
Path(__file__).parent.parent.parent.parent.parent
/ "frontend/schedule-editor"
Path(__file__).parent.parent.parent.parent / "frontend/schedule-editor"
)
vite_server = Popen(["npm", "start"], cwd=frontend_dir)

View file

@ -74,7 +74,7 @@ class Command(Parent):
pathreplace(move[1], move[0])
# Create frontend translations
base_path = locale_path.parent.parent
base_path = locale_path.parent
frontend_path = base_path / "frontend/schedule-editor"
locales = [locale.name for locale in locale_path.iterdir() if locale.is_dir()]
@ -91,5 +91,5 @@ class Command(Parent):
# Now merge the js file with the django file in each language
for locale in locales:
command = f"msgcat -o pretalx/locale/{locale}/LC_MESSAGES/django.po --use-first pretalx/locale/{locale}/LC_MESSAGES/django.po frontend/schedule-editor/locales/en/translation.po"
command = f"msgcat -o locale/{locale}/LC_MESSAGES/django.po --use-first locale/{locale}/LC_MESSAGES/django.po frontend/schedule-editor/locales/en/translation.po"
subprocess.run(command, check=True, shell=True, cwd=base_path)

View file

@ -44,8 +44,7 @@ class Command(BaseCommand):
)
with override_settings(_VITE_IGNORE=True):
frontend_dir = (
Path(__file__).parent.parent.parent.parent.parent
/ "frontend/schedule-editor/"
Path(__file__).parent.parent.parent.parent / "frontend/schedule-editor/"
)
env = os.environ.copy()
env["OUT_DIR"] = str(settings.STATIC_ROOT)

View file

@ -7,11 +7,11 @@
import i18next from 'i18next'
import moment from 'moment-timezone'
const localeModules = import.meta.glob('../../../../pretalx/locale/*/LC_MESSAGES/django.po')
const localeModules = import.meta.glob('../../../locale/*/LC_MESSAGES/django.po')
const momentLocaleModules = import.meta.glob('../../node_modules/moment/dist/locale/*.js')
export default async function (locale) {
const localeModule = await localeModules[`../../../../pretalx/locale/${locale}/LC_MESSAGES/django.po`]?.()
const localeModule = await localeModules[`../../../locale/${locale}/LC_MESSAGES/django.po`]?.()
const momentLocale = locale.split("_")[0]
const momentLocaleModule = await momentLocaleModules[`../../node_modules/moment/dist/locale/${momentLocale}.js`]?.()
moment.locale(momentLocale)