Add typescript support and automatic openapi client generation from ninja

This commit is contained in:
2024-10-09 16:28:54 +02:00
parent 6f4e93bb76
commit a71ca60270
10 changed files with 786 additions and 17 deletions

View File

@ -12,7 +12,7 @@ from staticfiles.processors import JS, Scss
class ManifestPostProcessingStorage(ManifestStaticFilesStorage):
def url(self, name: str, *, force: bool = False) -> str:
"""Get the URL for a file, convert .scss calls to .css ones"""
"""Get the URL for a file, convert .scss calls to .css ones and .ts to .js"""
# This name swap has to be done here
# Otherwise, the manifest isn't aware of the file and can't work properly
path = Path(name)
@ -27,6 +27,9 @@ class ManifestPostProcessingStorage(ManifestStaticFilesStorage):
)
name = str(path.with_suffix(".css"))
if path.suffix == ".ts":
name = str(path.with_suffix(".js"))
return super().url(name, force=force)
def post_process(