Skip to content
This repository was archived by the owner on Jan 3, 2026. It is now read-only.

Commit 4fa6779

Browse files
committed
🤖 [AUTO] 1.2.13 2023-06-26 12:43:36
1 parent 9b98e82 commit 4fa6779

2 files changed

Lines changed: 42 additions & 43 deletions

File tree

core/library/client.py

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -296,23 +296,3 @@ class NativeClient(WebClient):
296296
# Client.is_native is an non-overridable variable which indicates weather or not
297297
# this client is a react-native based client or not.
298298
is_native:bool = True
299-
300-
def __init__(self):
301-
# User setup dependent options
302-
if self.DIR is None:
303-
self.DIR = self.NAME
304-
if self.ENDPOINT == '':
305-
self.ENDPOINT = self.DIR if not self.DIR == settings.INDEX else ''
306-
self.IS_INDEX = self.ENDPOINT == ''
307-
# Generate production environment file
308-
with open(self.ENV, 'w') as prd_env:
309-
prd_env.write(self._env(prd=True))
310-
# Generate development environment file
311-
with open(self.ENV + '.development', 'w') as dev_env:
312-
dev_env.write(self._env(prd=False))
313-
# Build the url structure
314-
self.URL = self._url()
315-
self.URLS = self.__urls__() if callable(self.__urls__) else None
316-
# Load HTML Template
317-
self.html = None
318-
self.html_path = f'{self.DIR}.app'

core/tools/commands/node/clients.py

Lines changed: 42 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import subprocess
33
from json import loads
44
from time import sleep
5-
from shutil import rmtree
5+
from shutil import rmtree, move
66
from os.path import exists
77
from threading import Thread
88
from datetime import datetime
@@ -68,6 +68,7 @@ def client(app_data, build=False, app_name=""):
6868
:return None:
6969
"""
7070
if build and 'build' in app_data:
71+
static_dir = f"{settings.BASE_DIR}/static/{app_name}"
7172
print(f"\n> {app_name} @ {clients_json[app_name]['version']}")
7273

7374
console.out(f" {console.wait} Installing", end="\r")
@@ -96,6 +97,13 @@ def client(app_data, build=False, app_name=""):
9697
)
9798
console.out(" ✅ Compiled ", "success")
9899

100+
if 'export:web' in app_data['build']:
101+
console.out(f" {console.wait} Exporting Static Files", end="\r")
102+
if exists(static_dir):
103+
rmtree(static_dir)
104+
move(src=f"{app_data['src']}/web-build", dst=static_dir)
105+
console.out(f" {console.success} Exported ", "success")
106+
99107
console.out(f" {console.wait} Post-Processing", end="\r")
100108
update_client_meta_data(app_name, app_data)
101109
console.out(" ✅ Post-Processed ", "success")
@@ -360,7 +368,7 @@ def update_overlord_configuration():
360368

361369
# De-git repository
362370
console.out(f" {console.wait} Removing .git/*", end="\r")
363-
rmtree(f'clients/{name}/.git')
371+
rmtree(f'{settings.BASE_DIR}/clients/{name}/.git')
364372
console.out(" ✅ Removed .git/* ", "success")
365373

366374
# Update meta_data
@@ -370,33 +378,38 @@ def update_overlord_configuration():
370378
console.out(" ✅ Updated meta file ", "success")
371379

372380
if native:
373-
# Update native app.json
381+
# Update app.json
374382
console.out(f" {console.wait} Updating app.json", end="\r")
375383
with open(f'clients/{name}/app.json') as package:
376384
content = package.read()
377-
content = content.replace('app-name', name.lower())
385+
content = content.replace('app-name', name)
378386
with open(f'clients/{name}/app.json', 'w') as new_file:
379387
new_file.write(content)
380388
console.out(" ✅ Updated app.json ", "success")
381389

382-
else:
383-
# Update index.html
384-
console.out(f" {console.wait} Updating public/index.html", end="\r")
385-
with open(f'clients/{name}/public/index.html') as index_content:
386-
content = index_content.read()
387-
content = content.replace('{#app_name#}', name)
388-
with open(f'clients/{name}/public/index.html', 'w') as new_file:
389-
new_file.write(content)
390-
console.out(" ✅ Updated public/index.html ", "success")
391-
392-
# Update manifest.json
393-
console.out(f" {console.wait} Updating public/manifest.json", end="\r")
394-
with open(f'{settings.BASE_DIR}/clients/{name}/public/manifest.json') as manifest:
395-
content = manifest.read()
396-
content = content.replace('app-name', name)
397-
with open(f'{settings.BASE_DIR}/clients/{name}/public/manifest.json', 'w') as new_file:
398-
new_file.write(content)
399-
console.out(" ✅ Updated public/manifest.json ", "success")
390+
# Update index.html
391+
index_html_path = \
392+
f'{settings.BASE_DIR}/clients/{name}/web/index.html' if native else \
393+
f'{settings.BASE_DIR}/clients/{name}/public/index.html'
394+
console.out(f" {console.wait} Updating index.html", end="\r")
395+
with open(index_html_path, 'r') as index_content:
396+
content = index_content.read()
397+
content = content.replace('{#app_name#}', name)
398+
with open(index_html_path, 'w') as new_file:
399+
new_file.write(content)
400+
console.out(f" {console.success} Updated index.html ", "success")
401+
402+
# Update manifest.json
403+
manifest_json_path = \
404+
f'{settings.BASE_DIR}/clients/{name}/web/manifest.json' if native else \
405+
f'{settings.BASE_DIR}/clients/{name}/public/manifest.json'
406+
console.out(f" {console.wait} Updating public/manifest.json", end="\r")
407+
with open(manifest_json_path, 'r') as manifest:
408+
content = manifest.read()
409+
content = content.replace('app-name', name)
410+
with open(manifest_json_path, 'w') as new_file:
411+
new_file.write(content)
412+
console.out(" ✅ Updated manifest.json ", "success")
400413

401414
# Update package.json
402415
console.out(f" {console.wait} Updating package.json", end="\r")
@@ -413,12 +426,18 @@ def update_overlord_configuration():
413426
with open(f'{settings.BASE_DIR}/clients/{name}/shared.json') as shared:
414427
content = shared.read()
415428
content = content.replace('overlord_web_client', name)
429+
content = content.replace('overlord_native_client', name)
416430
with open(f'{settings.BASE_DIR}/clients/{name}/shared.json', 'w') as new_file:
417431
new_file.write(content)
418432
console.out(" ✅ Updated shared.json ", "success")
419433

420434
if native:
421-
console.input("npm install -g expo-cli", cwd=f"{settings.BASE_DIR}/clients/{name}")
435+
console.out(f" {console.wait} Installing expo-cli", end="\r")
436+
console.input("npm install expo-cli", cwd=f"{settings.BASE_DIR}/clients/{name}")
437+
console.out(f" {console.success} Installed expo-cli ", "success")
438+
console.out(f" {console.wait} Installing eas-cli", end="\r")
439+
console.input("npm install eas-cli", cwd=f"{settings.BASE_DIR}/clients/{name}")
440+
console.out(f" {console.success} Installed eas-cli ", "success")
422441

423442
update_overlord_configuration()
424443
return install(name)

0 commit comments

Comments
 (0)