UnsignedArduino / Awesome-Arcade

This is the source code for the website Awesome Arcade!
https://awesome-arcade.vercel.app
GNU General Public License v3.0
5 stars 4 forks source link

More info for extensions #129

Open UnsignedArduino opened 3 months ago

UnsignedArduino commented 3 months ago

Analyzes extension code and GitHub repo for things like:

This is to be shown on a separate page for each extension, after we implement https://github.com/UnsignedArduino/Awesome-Arcade/issues/128

UnsignedArduino commented 3 months ago

Pinging @S0m3randomguy :grin:

UnsignedArduino commented 3 months ago

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:

  1. Get the 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.

  2. We look at every file. Probably, use something like ts-morph and just add all the contents of the files to a project with tsconfig.json and the files from the pxt.json.
  3. Do something with it, probably doing stuff like in https://ts-morph.com/navigation and see what happens.
UnsignedArduino commented 3 months ago

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.

sargedev commented 3 months ago

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

UnsignedArduino commented 3 months ago

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...

sargedev commented 3 months ago

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.