cli icon indicating copy to clipboard operation
cli copied to clipboard

Add a `netlify clean` command

Open ascorbic opened this issue 4 years ago • 2 comments

Is your feature request related to a problem? Please describe.

In development I often need to clean the cache, and it's annoying having to do this manually.

Describe the solution you'd like

A netlify clean command that clears the Nelify cache, as well as (possibly optionally) the publish directory. Better still would be a way for frameworks to declare their own clean commands too in framework-info.

Describe alternatives you've considered

Doing it manually

Can you submit a pull request?

Yes

ascorbic avatar Jul 19 '21 09:07 ascorbic

Thanks @ascorbic, what do you mean by Netlify cache? Is it everything under <project-dir>/.netlify except the state.json file?

For the publish directory, since it's a valid use case to have versioned controlled files (e.g. _redirects), we either need to detect when it's safe to clean it, or provide an opt-in flag.

Also, do you think we need the following:

  1. ntl clean
  2. ntl build --clean
  3. ntl deploy --build --clean
  4. ntl dev --clean

Where if we detect a framework we run the specific framework clean command?

erezrokah avatar Jul 20 '21 10:07 erezrokah

what do you mean by Netlify cache? Is it everything under /.netlify except the state.json file?

@erezrokah Yes, exactly that.

I think it's simplest to just have 1. Clears .netlify cache by default, and runs framework-specific clean commands if implemented, and/or a command in the toml

ascorbic avatar Jul 21 '21 16:07 ascorbic