T2752
If npm run build fails during a build of the extension, Cashtab makes a big mess that is difficult to clean up. It will leave the extension files in place of the web files (App.js and others), and then delete the old files. So you need to manually unwind a lot of stuff to get back to normal.
This can happen easily as npm run build may fail even when npm start looks great, for example if there is an unused variable in a file.
This diff moves the logic for restoring the file structure into the cleanup function, so that the original file structure is preserved even if there is an error in npm run build