Last active
September 24, 2025 06:44
-
-
Save montasim/fabbd94a39ef802784c71e2843967f2d to your computer and use it in GitHub Desktop.
Using the .yarnclean file effectively helps maintain a cleaner, more efficient codebase and can be a crucial part of optimizing JavaScript projects that use Yarn as a package manager.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #################################################### | |
| # Yarn Clean Configuration File | |
| #################################################### | |
| # This file lists patterns of files and directories that are deemed unnecessary and can be safely deleted after installing packages via Yarn. | |
| # The cleaning process reduces the size of node_modules by removing unneeded files such as tests, documentation, and various configuration files. | |
| #################################################### | |
| # Test Directories | |
| # Purpose: Identify test directories that are not needed in production environments. | |
| # Use: Automatically remove common directory names used for tests. | |
| #################################################### | |
| __tests__ | |
| test | |
| tests | |
| powered-test | |
| #################################################### | |
| # Asset Directories | |
| # Purpose: Remove typical documentation and asset directories not needed in production. | |
| # Use: Clean up common directories that contain documentation and media files. | |
| #################################################### | |
| docs | |
| doc | |
| website | |
| images | |
| assets | |
| #################################################### | |
| # Examples | |
| # Purpose: Remove example files and directories. | |
| # Use: Examples are generally not required for production builds. | |
| #################################################### | |
| example | |
| examples | |
| #################################################### | |
| # Code Coverage Directories | |
| # Purpose: Remove directories related to code coverage reports. | |
| # Use: These directories are used during development and are not necessary in production. | |
| #################################################### | |
| coverage | |
| .nyc_output | |
| #################################################### | |
| # Build Scripts | |
| # Purpose: Identify build-related scripts that are not necessary post-installation. | |
| # Use: Removes standard build script files. | |
| #################################################### | |
| Makefile | |
| Gulpfile.js | |
| Gruntfile.js | |
| #################################################### | |
| # Configuration Files | |
| # Purpose: Clean up various CI/CD and project configuration files that are not needed in production. | |
| # Use: Includes a variety of configuration files used by different tools and services. | |
| #################################################### | |
| appveyor.yml | |
| circle.yml | |
| codeship-services.yml | |
| codeship-steps.yml | |
| wercker.yml | |
| .tern-project | |
| .gitattributes | |
| .editorconfig | |
| .*ignore | |
| .eslintrc | |
| .jshintrc | |
| .flowconfig | |
| .documentup.json | |
| .yarn-metadata.json | |
| .travis.yml | |
| #################################################### | |
| # Miscellaneous | |
| # Purpose: Target miscellaneous and markdown files which are generally not required for the functioning of the application. | |
| # Use: Cleanup markdown files and other non-essential file types. | |
| #################################################### | |
| *.md |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You’re absolutely right that the .yarnclean approach is risky because it relies on broad patterns (test, docs, examples, etc.) without context. As you mentioned with Storybook, some packages legitimately require these directories, and cleaning them can break functionality.
I also agree that the benefits are minimal today. With modern package managers and deployment strategies, the disk savings from .yarnclean are negligible compared to the risk of removing something essential.