OpenZeppelin / solidity-docgen

Documentation generator for Solidity projects
MIT License
441 stars 116 forks source link

Use docgen in the browser #437

Open yann300 opened 1 year ago

yann300 commented 1 year ago

we, at Remix, wanted to use solidity-docgen, but it isn't working in the browser. Do you have any plan to be compatible with a non-node context?

We tweaked some part of the library to make it compatible with the browser and will pushed it to our code base (here's the PR: https://github.com/ethereum/remix-project/pull/3267). We can anytime ofc make use of the official lib as soon as it works in the browser.

Also if updating solidity-docgen is too complex, perhaps you would be interested having another repo like solidity-docgen-light that would work in the browser and maybe our PR could help to set the ground for this repo.

Thanks, let us know what you think.

cc @bunsenstraat @joeizang

frangio commented 1 year ago

Can you list what is currently incompatible with the browser context?

yann300 commented 1 year ago

fs is one of them. @bunsenstraat @joeizang could you provide a list of deps that aren't working in the browser?

joeizang commented 1 year ago

Hi @frangio, like @yann300 mentioned, fs is a pain point. Another is the requirement of Hardhat, that also makes it tough for the browser. Basically, when we see __dirname(), it just spells pain. Also we noticed your templates use path resolve and readdir. More pain. Not sure if you guys could create a maybe lighter version of the library that targets the browser and eschews fs or anything that isn't possible for the browser. We know that this is a big ask but would be really appreciative of any kind of effort towards making the library more browser friendly.

I hope to hear from you so we can further this discussion. God bless

frangio commented 1 year ago

Hardhat is not required, see readme. It will still try to use the file system though. I'm interested in fixing this but can't promise any timelines.