mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 00:09:51 +03:00
minor changes to yarn
This commit is contained in:
@@ -2,4 +2,4 @@
|
|||||||
|
|
||||||
When developing and testing the web interface, it's handy not to bother with re-flashing an ESP32 each time. The idea is to mimic the ESP using a mock/stub server that responds to the REST (HTTP POST & GET) and WebSocket calls.
|
When developing and testing the web interface, it's handy not to bother with re-flashing an ESP32 each time. The idea is to mimic the ESP using a mock/stub server that responds to the REST (HTTP POST & GET) and WebSocket calls.
|
||||||
|
|
||||||
To set it up it do run `yarn install` in the `mock-api` folder, then from the `interface` folder run `yarn run standalone`. This will start the mock API server on port 3080 using data from `mock-api/server.js` and the web server runs on port 3000.
|
To use first make sure you have nodejs installed (>v18) then install yarn (`npm install -g yarn`). Now type `yarn` from this `mock-api` folder. To run EMS-ESP's WebUI navigate up to the `interface` folder and type `yarn run standalone`. This will start the mock API server on port 3080 using static dummy data from `mock-api/server.js` and also the web server which is at <http://localhost:3000>.
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import gzip
|
|||||||
|
|
||||||
Import("env")
|
Import("env")
|
||||||
|
|
||||||
|
|
||||||
def gzipFile(file):
|
def gzipFile(file):
|
||||||
with open(file, 'rb') as f_in:
|
with open(file, 'rb') as f_in:
|
||||||
with gzip.open(file + '.gz', 'wb') as f_out:
|
with gzip.open(file + '.gz', 'wb') as f_out:
|
||||||
@@ -20,17 +21,19 @@ def gzipFile(file):
|
|||||||
# f_out.write(brotli.compress(f_in.read(), quality=11))
|
# f_out.write(brotli.compress(f_in.read(), quality=11))
|
||||||
# os.remove(file)
|
# os.remove(file)
|
||||||
|
|
||||||
|
|
||||||
def flagExists(flag):
|
def flagExists(flag):
|
||||||
buildFlags = env.ParseFlags(env["BUILD_FLAGS"])
|
buildFlags = env.ParseFlags(env["BUILD_FLAGS"])
|
||||||
for define in buildFlags.get("CPPDEFINES"):
|
for define in buildFlags.get("CPPDEFINES"):
|
||||||
if (define == flag or (isinstance(define, list) and define[0] == flag)):
|
if (define == flag or (isinstance(define, list) and define[0] == flag)):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
def buildWeb():
|
def buildWeb():
|
||||||
os.chdir("interface")
|
os.chdir("interface")
|
||||||
print("Building web interface...")
|
print("Building web interface...")
|
||||||
try:
|
try:
|
||||||
env.Execute("yarn install")
|
env.Execute("yarn")
|
||||||
env.Execute("yarn run typesafe-i18n --no-watch")
|
env.Execute("yarn run typesafe-i18n --no-watch")
|
||||||
with open("./src/i18n/i18n-util.ts") as r:
|
with open("./src/i18n/i18n-util.ts") as r:
|
||||||
text = r.read().replace("Locales = 'pl'", "Locales = 'en'")
|
text = r.read().replace("Locales = 'pl'", "Locales = 'en'")
|
||||||
@@ -53,6 +56,7 @@ def buildWeb():
|
|||||||
finally:
|
finally:
|
||||||
os.chdir("..")
|
os.chdir("..")
|
||||||
|
|
||||||
|
|
||||||
if (len(BUILD_TARGETS) == 0 or "upload" in BUILD_TARGETS):
|
if (len(BUILD_TARGETS) == 0 or "upload" in BUILD_TARGETS):
|
||||||
buildWeb()
|
buildWeb()
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user