ScriptableMC-Engine
ScriptableMC-Engine copied to clipboard
TypeScriptLibraryExporter documentation support
Since we have access to the bukkit JavaDocs we should be able to generate documentation comments automatically. Need to research more.
https://github.com/paul-hammant/paranamer
https://github.com/paul-hammant/paranamer
Paranamer is now implemented to help with some parameter names. Although full documentation would be nice at least for the bukkit api.
https://github.com/javaparser/javaparser
I have a Bukkit API ts declaration already. Partially auto-generated.
https://github.com/Magikcraft/scriptcraft-types
It’s on npm as well.
I think it also contains the ScriptCraft API typings too, which you won’t want if you are not using ScriptCraft.
I have a npm module loading require implementation as well, which is a patch on Walter’s require implementation. It’s in @Magikcraft/MagikCraft in the SMA/js folder.
I’ll dig out the generation code. It works by scraping the bukkit api docs and doing a ghetto transform to TS (Non-AST aware text tansform). Gets about 90% of the way there. The other 10%, plus crawling the site is manual, but we can probably fix that up.
I'm actually already generating a typescript library via java reflection. I'm just thinking about using the javadocs support to help comment the typescript code better.
I'd definitely be interested in the generation code though as it may help with parsing the java docs. Thanks
No kidding straight outta the ghetto:
https://github.com/jwulf/bukkit-api-scraper/blob/master/index.ts
haha, all good. Thanks, I'm sure mine isn't too much better currently:
https://github.com/astorks/ScriptableMC-Engine/blob/dev/ScriptableMC-Tools-TS/src/main/kotlin/com/pixlfox/scriptablemc/TypescriptLibraryExporter.kt
Being able to pull reflection data directly from the jar is nice though, I just wish argument names where saved properly in the java bytecode instead of arg0, arg1.... That's why I'm looking into the javadocs as well as code comments.
Anyway I'm thinking about cleaning it up and making it a standalone project so you could just set up a build script and pass the spigot api jar and any additional jars and it would generate a typescript project.