2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-13 18:45:40 +00:00

[plugins] allow static files for plugins (#7425)

* Add 'clear' option to 'invoke static'

* Add functions for copying static files from installed plugins

* Collect plugin static files as part of 'invoke static'

* Add 'activate' method for PluginConfig

* Run as part of `invoke plugins`
This commit is contained in:
Oliver
2024-06-10 21:05:40 +10:00
committed by GitHub
parent 66b2976d33
commit 9962d85570
6 changed files with 137 additions and 13 deletions

View File

@ -227,6 +227,9 @@ def plugins(c, uv=False):
c.run('pip3 install --no-cache-dir --disable-pip-version-check uv')
c.run(f"uv pip install -r '{plugin_file}'")
# Collect plugin static files
manage(c, 'collectplugins')
@task(help={'uv': 'Use UV package manager (experimental)'})
def install(c, uv=False):
@ -317,8 +320,8 @@ def remove_mfa(c, mail=''):
manage(c, f'remove_mfa {mail}')
@task(help={'frontend': 'Build the frontend'})
def static(c, frontend=False):
@task(help={'frontend': 'Build the frontend', 'clear': 'Remove existing static files'})
def static(c, frontend=False, clear=True):
"""Copies required static files to the STATIC_ROOT directory, as per Django requirements."""
manage(c, 'prerender')
@ -327,7 +330,16 @@ def static(c, frontend=False):
frontend_build(c)
print('Collecting static files...')
manage(c, 'collectstatic --no-input --clear --verbosity 0')
cmd = 'collectstatic --no-input --verbosity 0'
if clear:
cmd += ' --clear'
manage(c, cmd)
# Collect plugin static files
manage(c, 'collectplugins')
@task