1
0
Fork 1
mirror of https://github.com/zen-browser/desktop.git synced 2025-07-08 00:10:00 +02:00

Formatted the project

This commit is contained in:
mr. M 2025-03-24 22:19:49 +01:00
parent 53eeb4e921
commit bd5d3c00f1
No known key found for this signature in database
GPG key ID: CBD57A2AEDBDA1FB
2 changed files with 57 additions and 53 deletions

View file

@ -12,62 +12,66 @@ ENGINE_DIR = "./engine"
NPM_INSTALL_COMMANDS = ["npm install", "npm install meow@9.0.0"] NPM_INSTALL_COMMANDS = ["npm install", "npm install meow@9.0.0"]
BUNDLE_COMMAND = "npm run bundle --prefix=browser/components/newtab" BUNDLE_COMMAND = "npm run bundle --prefix=browser/components/newtab"
def install_dependencies(): def install_dependencies():
if not os.path.isdir(NEW_TAB_DIR): if not os.path.isdir(NEW_TAB_DIR):
logging.error(f"Directory not found: {NEW_TAB_DIR}") logging.error(f"Directory not found: {NEW_TAB_DIR}")
raise FileNotFoundError(f"New tab directory {NEW_TAB_DIR} does not exist") raise FileNotFoundError(f"New tab directory {NEW_TAB_DIR} does not exist")
for command in NPM_INSTALL_COMMANDS: for command in NPM_INSTALL_COMMANDS:
try: try:
logging.info(f"Running command: {command} in {NEW_TAB_DIR}") logging.info(f"Running command: {command} in {NEW_TAB_DIR}")
subprocess.run( subprocess.run(
command.split(), command.split(),
cwd=NEW_TAB_DIR, cwd=NEW_TAB_DIR,
check=True, check=True,
capture_output=True, capture_output=True,
text=True text=True
) )
logging.info(f"Successfully executed: {command}") logging.info(f"Successfully executed: {command}")
except subprocess.CalledProcessError as e: except subprocess.CalledProcessError as e:
logging.error(f"Command failed: {command} - {e.stderr}") logging.error(f"Command failed: {command} - {e.stderr}")
raise raise
def bundle_newtab_components(): def bundle_newtab_components():
if not os.path.isdir(ENGINE_DIR): if not os.path.isdir(ENGINE_DIR):
logging.error(f"Directory not found: {ENGINE_DIR}") logging.error(f"Directory not found: {ENGINE_DIR}")
raise FileNotFoundError(f"Engine directory {ENGINE_DIR} does not exist") raise FileNotFoundError(f"Engine directory {ENGINE_DIR} does not exist")
try: try:
logging.info(f"Bundling newtab components in {ENGINE_DIR}") logging.info(f"Bundling newtab components in {ENGINE_DIR}")
result = subprocess.run( result = subprocess.run(
BUNDLE_COMMAND.split(), BUNDLE_COMMAND.split(),
cwd=ENGINE_DIR, cwd=ENGINE_DIR,
check=True, check=True,
capture_output=True, capture_output=True,
text=True text=True
) )
logging.info(f"Bundle completed successfully: {result.stdout}") logging.info(f"Bundle completed successfully: {result.stdout}")
except subprocess.CalledProcessError as e: except subprocess.CalledProcessError as e:
logging.error(f"Bundle failed: {e.stderr}") logging.error(f"Bundle failed: {e.stderr}")
raise raise
def update_newtab(init: bool = True): def update_newtab(init: bool = True):
try: try:
if init: if init:
logging.info("Starting dependency installation") logging.info("Starting dependency installation")
install_dependencies() install_dependencies()
logging.info("Dependencies installed successfully") logging.info("Dependencies installed successfully")
logging.info("Starting bundle process") logging.info("Starting bundle process")
bundle_newtab_components() bundle_newtab_components()
logging.info("Newtab update completed successfully") logging.info("Newtab update completed successfully")
except (subprocess.CalledProcessError, FileNotFoundError) as e: except (subprocess.CalledProcessError, FileNotFoundError) as e:
logging.error(f"Update process failed: {str(e)}") logging.error(f"Update process failed: {str(e)}")
raise raise
except Exception as e: except Exception as e:
logging.error(f"Unexpected error: {str(e)}") logging.error(f"Unexpected error: {str(e)}")
raise raise
if __name__ == "__main__": if __name__ == "__main__":
update_newtab(init=False) update_newtab(init=False)

View file

@ -256,7 +256,7 @@ pref('browser.migrate.opera.enabled', true);
// pref('network.trr.mode', 5); // pref('network.trr.mode', 5);
// security: They must enable this themselves, to avoid people downloading malware // security: They must enable this themselves, to avoid people downloading malware
pref('xpinstall.signatures.required', false); pref('xpinstall.signatures.required', true);
// Experimental Zen Features // Experimental Zen Features
// Strategy to use for bytecode cache (Thanks https://github.com/gunir) // Strategy to use for bytecode cache (Thanks https://github.com/gunir)