nodejs / corepack

Zero-runtime-dependency package acting as bridge between Node projects and their package managers
MIT License
2.31k stars 145 forks source link

chore: replace rm -rf with node -e for cross-platform file deletion #501

Closed liwakin closed 3 weeks ago

liwakin commented 3 weeks ago

This PR includes two main updates:

  1. The .gitignore file has been updated to ignore the yarn cache directory. This is because the yarn cache does not need to be tracked in version control.

  2. The usage of 'rm -rf' has been replaced with 'rimraf' in the package scripts. This change ensures cross-platform compatibility.

These changes contribute to better project maintenance and cross-platform compatibility.

liwakin commented 3 weeks ago

What is there for the project to gain by not checking-in the dependencies, in concrete and measurable terms?

Ignoring the .yarn/cache directory has two main benefits:

Regarding rimraf, I'm personally not a fan of adding a third-party dependency just to remove a folder. If we needed cross compatibility we could just call node -e.

I understand your concern about adding a third-party dependency like 'rimraf'. While using node -e is a valid approach, it might not be as readable as using 'rimraf'. An alternative could be implementing the cleanup functionality in a scripts/clean.js file, which would maintain readability and ensure cross-platform compatibility. What are your thoughts on this approach?