Skip to content

Commit

Permalink
refactor: optimize clean command by precomputing paths for deletion
Browse files Browse the repository at this point in the history
  • Loading branch information
suojae committed Jan 25, 2025
1 parent 4be680c commit b49b95f
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions packages/melos/lib/src/commands/clean.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,14 @@ mixin _CleanMixin on _Melos {
final pathsToClean = [
...cleanablePubFilePaths,
'.dart_tool',
];
].map((relativePath) => p.join(package.path, relativePath));

for (final generatedPubFilePath in pathsToClean) {
deleteEntry(p.join(package.path, generatedPubFilePath));
for (final path in pathsToClean) {
try {
deleteEntry(path);
} catch (error) {
logger.warning('Failed to delete $path: $error');
}
}
}

Expand Down

0 comments on commit b49b95f

Please sign in to comment.