-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.py
More file actions
executable file
·46 lines (36 loc) · 1.15 KB
/
build.py
File metadata and controls
executable file
·46 lines (36 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/env python3
"""
Build script for GitHub Pages deployment
Generates file list JSON for each folder
"""
import os
import json
def generate_file_list(folder):
"""Generate list of files in folder"""
files = []
folder_path = os.path.join(os.getcwd(), folder)
if not os.path.exists(folder_path):
return files
for filename in os.listdir(folder_path):
filepath = os.path.join(folder_path, filename)
if os.path.isfile(filepath):
files.append({
'name': filename,
'size': os.path.getsize(filepath)
})
# Sort by name
files.sort(key=lambda x: x['name'])
return files
def main():
# Generate file lists
folders = ['content', 'docs']
for folder in folders:
files = generate_file_list(folder)
# Save to JSON
output_file = f'{folder}/files.json'
with open(output_file, 'w') as f:
json.dump(files, f, indent=2)
print(f'✅ Generated {output_file} ({len(files)} files)')
print('\n🚀 Build complete! Ready for GitHub Pages.')
if __name__ == '__main__':
main()