Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(cleanup): add args to the cleanup command to delete any files #415

Open
shinGangan opened this issue May 20, 2024 · 1 comment
Open

Comments

@shinGangan
Copy link
Contributor

shinGangan commented May 20, 2024

📚 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}
@shinGangan
Copy link
Contributor Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant