Commit daba40d
authored
refactor: optimize clean command by precomputing paths to clean (#855)
## **Description**
This PR optimizes the `_cleanPackage` method by precomputing the paths
to clean (`pathsToClean`) before iterating through them. Specifically,
relative paths are joined with the package root using `p.join` ahead of
time, avoiding repeated path computations during the loop.
### **Key Changes**:
**Precomputing Paths**:
- `pathsToClean` now contains fully resolved paths created by combining
relative paths (`cleanablePubFilePaths` and `.dart_tool`) with the
package root.
- This eliminates the need for `p.join` operations inside the loop,
improving both performance and code readability.
---
## **Type of Change**
- [ ] ✨ `feat` -- New feature (non-breaking change which adds
functionality)
- [ ] 🛠️ `fix` -- Bug fix (non-breaking change which fixes an issue)
- [ ] ❌ `!` -- Breaking change (fix or feature that would cause existing
functionality to change)
- [x] 🧹 `refactor` -- Code refactor
- [ ] ✅ `ci` -- Build configuration change
- [ ] 📝 `docs` -- Documentation
- [ ] 🗑️ `chore` -- Chore
---
## **Checklist**
<!--- Put an `x` in all the boxes that apply: -->
- [x] I have read the
[[CONTRIBUTING](https://github.com/invertase/melos/blob/main/CONTRIBUTING.md)](https://github.com/invertase/melos/blob/main/CONTRIBUTING.md)
guidelines.
- [x] I have read the [[Invertase's Code of
Conduct](https://github.com/invertase/meta/blob/main/CODE_OF_CONDUCT.md)](https://github.com/invertase/meta/blob/main/CODE_OF_CONDUCT.md).
- [ ] I have added tests that prove my fix is effective or that my
feature works.
- [ ] I have added necessary documentation (if applicable).
- [x] I have run `melos bootstrap` and confirmed it is working as
expected locally.1 parent 4be680c commit daba40d
1 file changed
Lines changed: 7 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
| 35 | + | |
36 | 36 | | |
37 | | - | |
38 | | - | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
39 | 43 | | |
40 | 44 | | |
41 | 45 | | |
| |||
0 commit comments