From c1dbda112b47df54c702cea1861522f9c660b333 Mon Sep 17 00:00:00 2001 From: Jacob Rief Date: Fri, 11 Oct 2024 11:42:56 +0200 Subject: [PATCH] refactor destination of JS/CSS files in static folder --- .gitignore | 2 +- client/{esbuild.config.mjs => adminbuild.config.mjs} | 2 +- finder/admin/file.py | 6 +++--- finder/admin/folder.py | 4 ++-- package.json | 5 ++--- 5 files changed, 9 insertions(+), 10 deletions(-) rename client/{esbuild.config.mjs => adminbuild.config.mjs} (94%) diff --git a/.gitignore b/.gitignore index ee9ce0ca4..340cf04ff 100644 --- a/.gitignore +++ b/.gitignore @@ -45,4 +45,4 @@ data local.sqlite workdir*/ -finder/static/admin/finder/ +finder/static/finder/ diff --git a/client/esbuild.config.mjs b/client/adminbuild.config.mjs similarity index 94% rename from client/esbuild.config.mjs rename to client/adminbuild.config.mjs index a2996beb4..8f8dd4581 100644 --- a/client/esbuild.config.mjs +++ b/client/adminbuild.config.mjs @@ -16,7 +16,7 @@ await build({ bundle: true, minify: buildOptions.minify, sourcemap: buildOptions.debug, - outdir: 'finder/static/admin/finder/js', + outdir: 'finder/static/finder/js/admin', splitting: true, format: 'esm', jsx: 'automatic', diff --git a/finder/admin/file.py b/finder/admin/file.py index 11679b751..53bb103dc 100644 --- a/finder/admin/file.py +++ b/finder/admin/file.py @@ -12,7 +12,7 @@ from finder.models.file import FileModel from finder.models.label import Label -from .inode import InodeAdmin +from finder.admin.inode import InodeAdmin class LabelsChoiceField(ModelMultipleChoiceField): @@ -45,9 +45,9 @@ class FileAdmin(InodeAdmin): @property def media(self): return Media( - css={'all': ['admin/finder/css/finder-admin.css', 'admin/css/forms.css']}, + css={'all': ['finder/css/finder-admin.css', 'admin/css/forms.css']}, js=[format_html( - '', static('admin/finder/js/file-admin.js') + '', static('finder/js/admin/file-admin.js') )], ) diff --git a/finder/admin/folder.py b/finder/admin/folder.py index b64f1d83e..69233312e 100644 --- a/finder/admin/folder.py +++ b/finder/admin/folder.py @@ -33,9 +33,9 @@ class FolderAdmin(InodeAdmin): @property def media(self): return Media( - css={'all': ['admin/finder/css/finder-admin.css']}, + css={'all': ['finder/css/finder-admin.css']}, js=[format_html( - '', static('admin/finder/js/folder-admin.js') + '', static('finder/js/admin/folder-admin.js') )], ) diff --git a/package.json b/package.json index 1d7a4dcb2..eff6aca82 100644 --- a/package.json +++ b/package.json @@ -3,9 +3,8 @@ "license": "MIT", "private": true, "scripts": { - "esbuild": "node client/esbuild.config.mjs", - "compilescss": "sass --load-path=. client:finder/static/admin/finder/css/", - "buildall": "concurrently \"npm run esbuild -- --debug \" \"npm run compilescss\"" + "adminbuild": "node client/adminbuild.config.mjs", + "compilescss": "sass --load-path=. client:finder/static/finder/css/", }, "devDependencies": { "@dnd-kit/core": "^6.1.0",