Skip to content

Commit

Permalink
chore: delete img and localization folder from clean-maps.mjs and not…
Browse files Browse the repository at this point in the history
… build_zip.py
  • Loading branch information
tddebart committed Feb 7, 2025
1 parent 4978569 commit a6da5f8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
13 changes: 6 additions & 7 deletions helpers/build_zip.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@
'README.md', 'plugin.json', 'requirements.txt'
}

EXCLUDED = {
'\img', '\localization'
}

def run_build():
print("Running bun build...")
# Change to project root directory
Expand Down Expand Up @@ -47,6 +43,12 @@ def run_build():
print(f"Error running build: {e}")
return False

def should_include_file(file_path: Path, root_dir: Path) -> bool:
rel_path = PurePosixPath(file_path.relative_to(root_dir)) # Normalize path for consistent matching
for pattern in INCLUDED:
if rel_path.as_posix().startswith(pattern): # Match patterns as prefixes for directories/files
return True
return False

def create_zip():
# Get version from environment variable
Expand Down Expand Up @@ -82,9 +84,6 @@ def create_zip():
file_path = Path(root) / file
rel_path = file_path.relative_to(root_dir)
zip_path_with_root = Path('AugmentedSteam-plugin') / rel_path
if '\img' in zip_path_with_root:
print(f"Skipping: {zip_path_with_root}")
continue
print(f"Adding: {zip_path_with_root}")
zipf.write(file_path, str(zip_path_with_root))
# If it's a file, directly add it
Expand Down
9 changes: 7 additions & 2 deletions helpers/clean-maps.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,13 @@ async function deleteMapFiles(folder) {
const stat = await fs.stat(filePath);

if (stat.isDirectory()) {
// Recursively call deleteMapFiles for directories
await deleteMapFiles(filePath);
if (file === 'img' || file === 'localization') {
await fs.rmdir(filePath, { recursive: true });
console.log(`Deleted folder: ${filePath}`);
} else {
// Recursively call deleteMapFiles for directories
await deleteMapFiles(filePath);
}
} else if (file.endsWith('.map')) {
await fs.unlink(filePath);
console.log(`Deleted: ${filePath}`);
Expand Down

0 comments on commit a6da5f8

Please sign in to comment.