Closed jadertao closed 5 years ago
@JadeTao I don't think this plugin has a mechanism for restoring deleted files However, I'm not familiar enough with this plugin to be a source of truth. Perhaps @chrisblossom knows more.
Alternatively, your code should have been in version control which gives you the ability to revert changes. General backups of your system could also have your missing files.
@JadeTao Did it delete the webpack config file too?
@chrisblossom Maybe the plugin could prevent this by checking if the folder to be deleted is not the current one or called src ?
P.S. Thanks for #106
@JadeTao sorry to hear. @unguul is correct - there is no getting your files back. 😢
@JadeTao The only other thing I can think of is if you are using a Jetbrain's editior such as webstorm, you probably can restore your files using their local history feature.
Maybe the plugin could prevent this by checking if the folder to be deleted is not the current one or called src ?
@unguul This plugin already protects removing process.cwd()
via del without using dangerouslyAllowCleanPatternsOutsideProject: true
in combination with dry: false
.
The readme already already warns the user to use dry: true
before using cleanOnceBeforeBuildPatterns
and/or cleanAfterEveryBuildPatterns
so this does not happen.
lol, it happened to me as well, luckily had my code synced shortly before.
for me, it 'cleaned' everything BUT the output folder, including the git file. IntelliJ has the local history, but otherwise I would have to re-clone, redo anything that was not pushed already.
it remove all my code from root dir. please help me.
MINE TOOOOOO! 😭 WEEE WEEE WEEEE
This plugin really sucks, in some cases, it deletes everything, including idea and .git folder.
This worthless piece of junk just erased some 30 hours of my work. Silly of me that I haven't pushed to git, but still...
AVOID THIS TRASH AS FAR AS YOU CAN!
@chavlji I understand your frustration and can relate to your situation as I've experienced similar things myself. However, please be mindful of the lack of warranty that software usually comes with(out?). This is especially true for open source software that is offered to the world for free(as in free beer).
This is a tool for deleting things. Similarly to rm
or a gun, it is as dangerous as the user allows it to be. You are responsible for putting that -rf
in the command just as much as you are for not using dry run feature.
my teammate just met the same frustrated thing like @chavlji . Lost 3 days works that cannot recover anymore.
I like the opinion about rm or gun. Obviously, clean-webpack-plugin is a powerful weapon which is very impressive.
But, can we try to add some safety lock or first-time warning for those who had never used your useful plugin.
Or, can we try to change the default feature of not delete .git file at least?
With great power comes with great responsibility to make more people happy:)
Yup, please add a feature to not delete .git by default! That should really be a thing as it's a "hidden" folder.
Also for people that had this problem, the only way to recover is from a git push on the remote OR VSCode local timeline backups /home/dev/.config/Code/User/History
and search by modified date. This saved my day :smile:
Just had the same situation. And it would be SO easy to avoid, just make user put an empty file .clean
in the directory that's supposed to be cleaned. If file will be there, every other file will be cleaned. If no such file has been found, it should throw an error. It's that simple.
Also, I just realized: If you are using Intellij IDEA
it's POSSIBLE to recover the lost files! IDEA
stores history of changes outside the project's root, so the deleted files are not lost! What you need to do is:
src
directory, or whatever name your directory with sources had.src
directory, and then click Local History > See History
to see the local changes from before the cleaning. From this screen you can restore the whole directory! Just right click the previous version of this directory and revert it.webpack.config.js
and other files in root. Just create an empty file, and look up its history to restore the content.It just saved my ass and I hope it'll help someone :) .
Added: Actually there might be even a better way:
Local History > See History
to revert the whole project :) .Just lost houndreds hours with this same problem... my hole folder got just empty right in the middle of bug correction (wich means the production version is broken too)...
Cliche tip: KEEP YOUR WORK ON GIT, every little change...
jajaja, a mí también me pasó, afortunadamente mi código se sincronizó poco antes.
cómo lo sincronizaste antes?
PERDI TODO
Also, I just realized: If you are using
Intellij IDEA
it's POSSIBLE to recover the lost files!IDEA
stores history of changes outside the project's root, so the deleted files are not lost! What you need to do is:
- Create the
src
directory, or whatever name your directory with sources had.- Now you can right click this
src
directory, and then clickLocal History > See History
to see the local changes from before the cleaning. From this screen you can restore the whole directory! Just right click the previous version of this directory and revert it.- The same can be done with
webpack.config.js
and other files in root. Just create an empty file, and look up its history to restore the content.It just saved my ass and I hope it'll help someone :) .
Added: Actually there might be even a better way:
- Create new project in place of the old one, with the same name.
- Then you can right click the project name in the left directory listing and use
Local History > See History
to revert the whole project :) .
You've made my day! Thank you so much!
it remove all my code from root dir. please help me.