From f8595865ea29e49f1ee96fb26ca2c612d6bd07d9 Mon Sep 17 00:00:00 2001 From: Bernhard Kirchen Date: Wed, 11 Sep 2024 21:34:59 +0200 Subject: [PATCH] webapp autocompile: try yarnpkg --- pio-scripts/compile_webapp.py | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/pio-scripts/compile_webapp.py b/pio-scripts/compile_webapp.py index ace042bf..0ae54e76 100644 --- a/pio-scripts/compile_webapp.py +++ b/pio-scripts/compile_webapp.py @@ -28,21 +28,27 @@ def check_files(directories, filepaths, hash_file): break if not update: - print("webapp artifacts should be up-to-date") + print("INFO: webapp artifacts should be up-to-date") return - print("compiling webapp (hang on, this can take a while and there might be little output)...") + print("INFO: compiling webapp (hang on, this can take a while and there might be little output)...") + yarn = "yarn" try: - # if these commands fail, an exception will prevent us from - # persisting the current hashes => commands will be executed again - subprocess.run(["yarn", "--cwd", "webapp", "install", "--frozen-lockfile"], - check=True) - - subprocess.run(["yarn", "--cwd", "webapp", "build"], check=True) - + subprocess.check_output([yarn, "--version"]) except FileNotFoundError: - raise Exception("it seems 'yarn' is not installed/available on your system") + yarn = "yarnpkg" + try: + subprocess.check_output([yarn, "--version"]) + except FileNotFoundError: + raise Exception("it seems neither 'yarn' nor 'yarnpkg' is installed/available on your system") + + # if these commands fail, an exception will prevent us from + # persisting the current hashes => commands will be executed again + subprocess.run([yarn, "--cwd", "webapp", "install", "--frozen-lockfile"], + check=True) + + subprocess.run([yarn, "--cwd", "webapp", "build"], check=True) with open(hash_file, 'wb') as f: pickle.dump(file_hashes, f)