johnagan / clean-webpack-plugin

A webpack plugin to remove your build folder(s) before building
MIT License
1.96k stars 135 forks source link

Don't Accidentally delete the project's root #155

Closed maddhruv closed 4 years ago

codecov-io commented 5 years ago

Codecov Report

Merging #155 into master will decrease coverage by 1.08%. The diff coverage is 50%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #155      +/-   ##
==========================================
- Coverage   98.86%   97.77%   -1.09%     
==========================================
  Files           1        1              
  Lines          88       90       +2     
  Branches       30       31       +1     
==========================================
+ Hits           87       88       +1     
- Misses          1        2       +1
Impacted Files Coverage Δ
src/clean-webpack-plugin.ts 97.77% <50%> (-1.09%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 6fd2f73...3a190d1. Read the comment docs.

maddhruv commented 5 years ago

@johnagan

chrisblossom commented 5 years ago

This is already built into this library via the npm package del. You can use the dangerouslyAllowCleanPatternsOutsideProject to override.

maddhruv commented 5 years ago

Allow clean patterns outside of process.cwd()

it says this but clean is by default about output.path and i dont think this option even saves your project root

chrisblossom commented 5 years ago

Allow clean patterns outside of process.cwd()

it says this but clean is by default about output.path and i dont think this option even saves your project root

I don't really understand this comment.

Currently you cannot remove your project root without setting dangerouslyAllowCleanPatternsOutsideProject: true and dry: false via del.

Have you had an issue with this not working?

maddhruv commented 5 years ago

I haven't enabled these options but still mistakenly deleted the project's root

chrisblossom commented 5 years ago

I haven't enabled these options but still mistakenly deleted the project's root

Can you provide the options you used to remove your project's root? I'd like to add a test case for this.

juliantroeps commented 5 years ago

@chrisblossom Not sure if thats the same problem, but when I set my config to an empty object like new CleanWebpackPlugin({}), the build fails (error message here) and the whole project gets wiped.