Limpa e remove arquivos desnecessários das dependências do pacote.
autoclean command frees up space by removing unnecessary files and folders from dependencies. Isso reduz o número de arquivos na pasta
node_modules do seu projeto, isso é útil em um ambiente onde pacotes são checados no controle de versão diretamente.
Nota: Esse comando é considerado somente para casos avançados de uso. A menos que você esteja enfrentando problemas com a quantidade de arquivos que estão instalados na pasta
node_modules não é recomendado o uso desse comando. It will permanently delete files in
node_modules which could cause packages to stop working.
Autoclean functionality is disabled by default. To enable it, manually create a
.yarnclean file, or run
yarn autoclean --init to create the file with default entries. The
.yarnclean file should be added to version control.
.yarnclean file exists in a package, autoclean functionality will be enabled. The clean will be performed:
- After an
- After an
yarn autoclean --forceis run
The clean is performed by reading each line of the
.yarnclean file and using each as a glob pattern of files to delete.
-I/--init : Creates the
.yarnclean file if it does not exist, and adds the default entries. This file should then be reviewed and edited to customize which files will be cleaned. If the file already exists, it will not be overwritten.
-F/--force : If a
.yarnclean file exists, run the clean process. If the file does not exist, do nothing.
yarn autoclean --init command is used to create a
.yarnclean file, it will be pre-populated with a set of default items for deletion. This default list is a guess at what is likely not needed. It is impossible to predict all directories and files that are actually unnecessary for all existing and future NPM packages, so this default list may cause a package to no longer work.
It is highly recommended that you manually review the default entries in
.yarnclean and customize them to fit your needs.
If you discover the autoclean process is deleting files that are needed for a package to work properly, then you should remove the corresponding entry from the
You decide all YAML and Markdown files in all your dependencies installed in
node_modules can be safely deleted. You make a
.yarnclean file containing:
You then run
yarn install or
yarn autoclean --force. The clean process will delete all
*.md files within
node_modules/ recursively (including nested transitive dependencies).