mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 07:49:52 +03:00
experiment with moving from npm to yarn
This commit is contained in:
@@ -2,6 +2,8 @@ from pathlib import Path
|
||||
from shutil import copytree, rmtree, copyfileobj
|
||||
import os
|
||||
import gzip
|
||||
|
||||
# brotli has better compression than gzip but requires https so leaving here for future
|
||||
# import brotli
|
||||
|
||||
Import("env")
|
||||
@@ -11,6 +13,8 @@ def gzipFile(file):
|
||||
with gzip.open(file + '.gz', 'wb') as f_out:
|
||||
copyfileobj(f_in, f_out)
|
||||
os.remove(file)
|
||||
|
||||
# brotli version:
|
||||
# with open(file + '.br', 'wb') as f_out:
|
||||
# with open(file, 'rb') as f_in:
|
||||
# f_out.write(brotli.compress(f_in.read(), quality=11))
|
||||
@@ -26,13 +30,13 @@ def buildWeb():
|
||||
os.chdir("interface")
|
||||
print("Building web interface...")
|
||||
try:
|
||||
env.Execute("npm install")
|
||||
env.Execute("npx typesafe-i18n --no-watch")
|
||||
env.Execute("yarn install")
|
||||
env.Execute("yarn run typesafe-i18n --no-watch")
|
||||
with open("./src/i18n/i18n-util.ts") as r:
|
||||
text = r.read().replace("Locales = 'pl'", "Locales = 'en'")
|
||||
with open("./src/i18n/i18n-util.ts", "w") as w:
|
||||
w.write(text)
|
||||
env.Execute("npm run build")
|
||||
env.Execute("yarn run build")
|
||||
|
||||
buildPath = Path("build")
|
||||
wwwPath = Path("../data/www")
|
||||
@@ -40,7 +44,7 @@ def buildWeb():
|
||||
if wwwPath.exists() and wwwPath.is_dir():
|
||||
rmtree(wwwPath)
|
||||
|
||||
print("Copying web files to data directory")
|
||||
print("Copying web files from build to data/www...")
|
||||
copytree(buildPath, wwwPath)
|
||||
for currentpath, folders, files in os.walk(wwwPath):
|
||||
for file in files:
|
||||
|
||||
Reference in New Issue
Block a user