Page MenuHomePhabricator

[Cashtab] Improve extension build script error handling
ClosedPublic

Authored by bytesofman on Nov 15 2022, 14:17.

Details

Reviewers
kieran709
Group Reviewers
Restricted Project
Commits
rABCdc351b9b3184: [Cashtab] Improve extension build script error handling
Summary

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

Test Plan

npm run extension
extension builds and works
In cashMethods.js, add the line import BCH from 'bch-js'; at the end of the imports. This will cause npm run build to fail
Run npm run extension
Note that the build failed and the script exited
Note the console prints that files were moved back
git status shows no changes other than cashMethods.js

Diff Detail

Repository
rABC Bitcoin ABC
Branch
extension-script-improve
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 20925
Build 41506: Build Diffcashtab-tests
Build 41505: arc lint + arc unit