mirror of
https://github.com/Radiquum/YAMPD.git
synced 2025-05-20 07:39:35 +05:00
feat: add build script
This commit is contained in:
parent
6421fde57e
commit
9cf32caea3
2 changed files with 30 additions and 2 deletions
30
build.py
Normal file
30
build.py
Normal file
|
@ -0,0 +1,30 @@
|
|||
import subprocess
|
||||
import os
|
||||
import shutil
|
||||
|
||||
OUT_DIR = "./dist"
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
if os.path.exists(OUT_DIR) and os.path.isdir(OUT_DIR):
|
||||
shutil.rmtree(OUT_DIR)
|
||||
|
||||
os.makedirs(OUT_DIR)
|
||||
|
||||
subprocess.call(["bun", "run", "build"], cwd="./gui", shell=True)
|
||||
files = [f.name for f in os.scandir("./gui/out") if f.is_file()]
|
||||
dirs = [f.name for f in os.scandir("./gui/out") if f.is_dir()]
|
||||
|
||||
os.makedirs(f"{OUT_DIR}/static")
|
||||
os.makedirs(f"{OUT_DIR}/templates")
|
||||
|
||||
for file in files:
|
||||
if file.endswith(".html"):
|
||||
shutil.copyfile(f"./gui/out/{file}", f"{OUT_DIR}/templates/{file}")
|
||||
continue
|
||||
shutil.copyfile(f"./gui/out/{file}", f"{OUT_DIR}/static/{file}")
|
||||
|
||||
for dir in dirs:
|
||||
shutil.copytree(f"./gui/out/{dir}", f"{OUT_DIR}/static/{dir}", dirs_exist_ok=True)
|
||||
|
||||
shutil.copytree("./src", f"{OUT_DIR}/", dirs_exist_ok=True)
|
Loading…
Add table
Add a link
Reference in a new issue