feat(cleanup): add args to the cleanup command to delete any files
Opened this issue ยท 1 comments
๐ Describe the feature
The cleanup command currently deletes the following directories/files ( https://github.com/nuxt/cli/blob/main/src/utils/nuxt.ts#L18-L30 ) .
buildDir
.output
dist
node_modules/.vite
- `node_modules/.cache
If you want to delete a directory other than the currently specified directory or node_modules
itself, you have no choice but to rely on the rimraf
or rm
command.
I prepare an npm script like below every time.
{
"scripts": {
"clean": "rimraf node_modules playground/**/node_modules playground/**/.nuxt",
}
}
Also, in the case of a monorepo configuration using pnpm workspace, .nuxt
, node_modules
, and .output
may not be deleted properly.
Changing rootDir
option for each directory is a very tedious task.
Therefore, I would like to add an argument to the cleanup
command that allows the user to delete arbitrary directories and files.
Design
An example of usage is as follows.
npx nuxi@latest cleanup --cleanDir ['.nuxt', 'node_modules']
$ npx nuxi@latest cleanup --help
Clean up generated Nuxt files and caches (nuxi cleanup v3.11.1)
USAGE nuxi cleanup [OPTIONS] [ROOTDIR]
ARGUMENTS
ROOTDIR Root Directory
OPTIONS
--cwd Current working directory
--logLevel Log level
--cleanDir {any description}
Hi @danielroe , I would appreciate it if you could comment when you have time. ๐
If there are no problems with the policy, I will start creating PR.