Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ import fs from 'fs';
import path from 'path';

export function cleanAssetCatalog(catalogDir: string): void {
const files = fs
const imageSets = fs
.readdirSync(catalogDir)
.filter(file => file.endsWith('.imageset'));
for (const file of files) {
fs.rmSync(path.join(catalogDir, file));
.filter(imageSet => imageSet.endsWith('.imageset'));

@huntie huntie Dec 11, 2023

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: It's inaccurate to rename this to imageSet within this filter call, given these are candidates within the search directory. Let's use file or fileOrDir (which in this case is technically a file, directory, or package).

(I also don't mind the previous generic naming of files for the outer variable — until there is a future need to remove multiple kinds of files differently.)

for (const imageSet of imageSets) {
fs.rmSync(path.join(catalogDir, imageSet), {recursive: true, force: true});
}
}

Expand Down