feat: add gen-deploy cli to generate deploy.json#295
Conversation
| const route = path.resolve(systems, e); | ||
| const out = spawnSync("forge",["flatten" ,route]); | ||
| const flatCode = out.stdout.toString() | ||
| const used = comps.filter(c => flatCode.includes(c)) |
There was a problem hiding this comment.
Btw this would include components that the system doesn't actually write to, not that I have a better solution in mind
There was a problem hiding this comment.
Regex the
setfunction?
That was my 1st thought actually, but set is called on the variable, which can have any name. And even if you account for that, a library may have some func which uses set, but the system doesnt use that func.
I've been trying some stuff with solidity-parser, but it's not rly gonna help here (imports make things very complicated)
There was a problem hiding this comment.
I can think of 2 ways.
- try find calls in systems that hit any non-view/pure function on components. (might be hard tho)
- add warning that this function might add more write access than actually required. user might wanna remove some manually
There was a problem hiding this comment.
- For 1 you'd need to write some complicated parsing, imo not worth it for this little utility
- I like 2, would prefer it for my project compared to filling writeAccess manually from scratch
Another option I could suggest: parse e.g. @custom:ecsc TestComponent; but neither forge inspect, nor solidity-parser can do that. So I guess you'd need solc's devdoc json output. Seems complicated, but still way easier than writing a function parser.
There was a problem hiding this comment.
added warning msg :)
|
As discussed above this solution generates a |
added mud gen-deploy cli
generate deploy.json from files
param
specification
files change