FEAT: use versioning for frontend (npm) and copy it to lnbits/static/vendor for easier updating (#1590)

* remove static/vendor

* add node dependencies

* add bolt11-decoder

* run npm install inside dockerimage

* only use bundle.js and bundle.css

* use node_modules for bundling vendor assets

* remove dead code

* make argument optional

* reintroduce vendor dir

* reintroduce vendor and single javascript files, minification

* wrong moment, remove minification

* lock packages with non critical issues

* black
This commit is contained in:
dni ⚡
2023-03-31 12:46:24 +02:00
committed by GitHub
parent 43c9c9754b
commit a9bdf24425
34 changed files with 49381 additions and 236 deletions
-15
View File
@@ -13,7 +13,6 @@ from .core.crud import get_dbversions, get_inactive_extensions
from .core.helpers import migrate_extension_database, run_migration
from .db import COCKROACH, POSTGRES, SQLITE
from .extension_manager import get_valid_extensions
from .helpers import get_css_vendored, get_js_vendored, url_for_vendored
@click.command("migrate")
@@ -24,7 +23,6 @@ def db_migrate():
@click.command("assets")
def handle_assets():
transpile_scss()
bundle_vendored()
def transpile_scss():
@@ -39,19 +37,6 @@ def transpile_scss():
css.write(compile_string(scss.read()))
def bundle_vendored():
for getfiles, outputpath in [
(get_js_vendored, os.path.join(settings.lnbits_path, "static/bundle.js")),
(get_css_vendored, os.path.join(settings.lnbits_path, "static/bundle.css")),
]:
output = ""
for path in getfiles():
with open(path) as f:
output += "/* " + url_for_vendored(path) + " */\n" + f.read() + ";\n"
with open(outputpath, "w") as f:
f.write(output)
async def migrate_databases():
"""Creates the necessary databases if they don't exist already; or migrates them."""