@@ -44,14 +44,34 @@ def get_all_files(repo):
44
44
45
45
def is_image_file (filename ):
46
46
"""Check if a file is an image based on its extension."""
47
- image_extensions = {'.jpg' , '.jpeg' , '.png' , '.gif' , '.bmp' , '.tiff' , '.webp' , '.svg' , '.ico' , '.yaml' }
47
+ image_extensions = {'.jpg' , '.jpeg' , '.png' , '.gif' , '.bmp' , '.tiff' , '.webp' , '.svg' , '.ico' , '.yaml' , '.woff' }
48
48
return Path (filename ).suffix .lower () in image_extensions
49
49
50
+ # is_file_name: takes a path to a file and returns False if file is excluded, file can be a relative path
51
+ def is_excluded_file_name (file ):
52
+ # List of file names or directories to exclude
53
+ excluded_files = [
54
+ 'node_modules' , 'package-lock.json' , 'yarn.lock' , '.DS_Store' , '.gitignore' , '.gitattributes' , '.gitmodules' ,
55
+ '.git' , '.idea' , '.vscode' , '.env' , '.env.local' , '.env.development' , '.env.test' , '.env.production' ,
56
+ '.env.staging' , '.env.local' , '.env.*.local' , 'npm-debug.log' , 'yarn-debug.log' , 'yarn-error.log' , 'yarn-integrity'
57
+ ]
58
+
59
+ # Check if the file is in the list of excluded files or in an excluded directory
60
+ file_name = os .path .basename (file ) # Get the base name of the file
61
+ for excluded in excluded_files :
62
+ # Match either the exact file name or a wildcard match (for .env.*)
63
+ if excluded .startswith ('.env.*' ) and file_name .startswith ('.env.' ) or file_name == excluded :
64
+ return True
65
+
66
+ # If it's not excluded, return False
67
+ return False
68
+
69
+
50
70
def build_structure (root_path , files ):
51
71
"""Build a nested dictionary structure representing the project files."""
52
72
structure = {}
53
73
for file_path in files :
54
- if is_image_file (file_path ):
74
+ if is_image_file (file_path ) or is_excluded_file_name ( file_path ) :
55
75
continue # Skip image files
56
76
full_path = Path (root_path ) / file_path
57
77
# Ensure the file exists
0 commit comments