From 6e38d95fe1e92d811566d5f0407ff3fbb67e3133 Mon Sep 17 00:00:00 2001 From: Willian Galvani Date: Mon, 25 Mar 2024 15:36:46 -0300 Subject: [PATCH] consolidate.py: make a scripts index file --- .github/workflows/deploy.yml | 1 + consolidate.py | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index d876c58..de29de9 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -21,6 +21,7 @@ jobs: python consolidate.py mkdir build mv params* build/ + mv scripts* build/ - name: Deploy 🚀 uses: JamesIves/github-pages-deploy-action@v4 diff --git a/consolidate.py b/consolidate.py index 5f65991..99f15d6 100644 --- a/consolidate.py +++ b/consolidate.py @@ -97,3 +97,19 @@ def sanitize_key(key): # Save the json_data to a JSON file with open('params_v1.json', 'w') as json_file: json.dump(json_data, json_file, indent=4) + + +# Now let's do scripts +# Start at the root directory and walk the directory tree +root_directory = os.getcwd() # Get current directory +files = [] +for dirpath, dirnames, filenames in os.walk(root_directory): + for filename in filenames: + if filename.endswith('.lua'): + file_path = os.path.join(dirpath, filename) + relative_path = os.path.relpath(file_path, root_directory) + files.append(relative_path) + +# Save the json_data to a JSON file +with open('scripts_v1.json', 'w') as json_file: + json.dump(files, json_file, indent=4)