Skip to content
Snippets Groups Projects
Verified Commit 3ffa48a9 authored by Nik | Klampfradler's avatar Nik | Klampfradler
Browse files

Fix return code of vite build management command

parent 1cee605a
No related branches found
No related tags found
1 merge request!1287Resolve "[Docker] Build succeeds even if vite build fails"
Pipeline #135622 passed with warnings
......@@ -9,6 +9,12 @@ and this project adheres to `Semantic Versioning`_.
Unreleased
----------
Fixed
~~~~~
* [Docker] The build could silently continue even if frontend bundling failed, resulting
in an incomplete AlekSIS frontend app.
`3.1.2`_ - 2023-07-05
---------------------
......
import os
from django.conf import settings
from django.core.management.base import CommandError
from django_yarnpkg.management.base import BaseYarnCommand
from django_yarnpkg.yarn import yarn_adapter
......@@ -26,4 +27,6 @@ class Command(BaseYarnCommand):
yarn_adapter.install(settings.YARN_INSTALLED_APPS)
# Run Vite build
run_vite([options["command"]])
ret = run_vite([options["command"]])
if ret != 0:
raise CommandError("yarn command failed", returncode=ret)
......@@ -49,7 +49,7 @@ def write_vite_values(out_path: str) -> dict[str, Any]:
json.dump(vite_values, out)
def run_vite(args: Optional[Sequence[str]] = None) -> None:
def run_vite(args: Optional[Sequence[str]] = None) -> int:
args = list(args) if args else []
config_path = os.path.join(settings.BASE_DIR, "aleksis", "core", "vite.config.js")
......@@ -64,7 +64,7 @@ def run_vite(args: Optional[Sequence[str]] = None) -> None:
log_level = {"INFO": "info", "WARNING": "warn", "ERROR": "error"}.get(log_level, "silent")
args += ["-l", log_level]
yarn_adapter.call_yarn(["run", "vite"] + args)
return yarn_adapter.call_yarn(["run", "vite"] + args)
def get_language_cookie(code: str) -> str:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment