liquidapps-io / zeus-sdk

EOSIO & EVM smart contract unit testing suite and API provider
51 stars 24 forks source link

mapping.json on storage path instead of reading/changing mapping.js #10

Closed prcolaco closed 4 years ago

prcolaco commented 4 years ago

I found handy, since we have a storage directory in ~/.zeus/ (default), to have our mapping there in a mapping.json file so that the user can install new versions of zeus-cmd without losing his deployment mappings. This feels also like a cleaner approach instead of changing the distributed mapping.js source file. Also fixed the temp cleanup when an unbox command gets interrupted by user or by an exception, by providing a handler that always runs the cleanup. At least in mac I found that many temporary directories were left behind, so those few lines 12-17 solve that.

prcolaco commented 4 years ago

Improved original idea after stepping into the problem that the mapping in master of zeus-sdk/zeus-cmd wasn't updated as of the latest release in npmjs. This was causing me to not be able to compile, due to packages being different. So I thought that this should be an important thing, to be able to update the zeus base mappings, without interfering with users local mappings... Now the local mappings file stays only with deployed packages by the user, and the _mapping.js load() (yeah mapping.js moved to helpers) joins the defaults (/defaults/mapping.json) to the local mappings in ~/.zeus/mapping.json. This is the best of both worlds, as defaults can be changed and the user can override by deploying their own packages.

NatPDeveloper commented 4 years ago

Very cool! Not losing the mapping file is a nice add.

If you're good with the PR I can go ahead and create an internal PR / add documentation.

NatPDeveloper commented 4 years ago

I've created the PR internally! Will let you know what becomes of it

Thank you as always for your contribution

NatPDeveloper commented 4 years ago

merged internally, thank you for the PR!