Open UnsignedArduino opened 3 months ago
Pinging @S0m3randomguy :grin:
To re-iterate, we want to analyze the source code of the extension to at least show all the exported namespaces, methods, classes, interfaces, etc. We can deal with getting the blocks later...
Given a repo like https://github.com/jwunderl/arcade-tilemap-a-star we should do something like this:
pxt.json
and look at the files
value:
"files": [
"README.md",
"main.ts",
"a-star.ts",
"path-following.ts",
"docs/a-star.md",
"docs/follow-path.md",
"docs/sprite-percent-path-completed.md",
"docs/sprite-is-following-path.md",
"docs/on-path-completion.md"
],
Then we just filter for *.ts
files. The docs/*.md
files can be shown as...docs.
ts-morph
and just add all the contents of the files to a project with tsconfig.json
and the files from the pxt.json
. We also need to see how much time this adds to the build step and if we need caching or not between builds. Worst case, we implement a micro-service for this type of analysis and we do API calls to the server which should have cached them.
So, once we grab all the exported symbols, we can just put the function calls of the curated function definitions through the block render, right? Might need to read the declaration node plain text to get //% param.defl
values to pass into the blocks
That sounds possible.
I was thinking to see how MakeCode/blockly renders the blocks in the toolbox, but that is also complicated.
Worse scenario is we do some browser automation to steal the blocks...
To be fair, we can prerender most blocks and store them as static assets the first time we run the render script. Since extensions don't get updated that often, the seldom block changes won't pose much of a load (considering render speed and performance) so I think the initial approach we came up with is viable.
Analyzes extension code and GitHub repo for things like:
/docs/*md
files from thepxt.json
)This is to be shown on a separate page for each extension, after we implement https://github.com/UnsignedArduino/Awesome-Arcade/issues/128