Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More info for extensions #129

Open
UnsignedArduino opened this issue May 12, 2024 · 6 comments
Open

More info for extensions #129

UnsignedArduino opened this issue May 12, 2024 · 6 comments
Labels
extension Extension suggestion. help wanted Extra attention is needed javascript

Comments

@UnsignedArduino
Copy link
Owner

UnsignedArduino commented May 12, 2024

Analyzes extension code and GitHub repo for things like:

  • Releases (just use the API)
  • Docs (find all the JS-docs and/or /docs/*md files from the pxt.json)
  • Clicks (will eventually come from a database when I get around to implementing it again)
  • Exposed JS classes, namespaces, functions, interfaces, etc. (discussed below)
  • Color and icon in toolbox (from the comment)
  • Blocks (this will come later)

This is to be shown on a separate page for each extension, after we implement #128

@UnsignedArduino UnsignedArduino added help wanted Extra attention is needed extension Extension suggestion. javascript labels May 12, 2024
@UnsignedArduino
Copy link
Owner Author

Pinging @S0m3RandomGuy 😁

@UnsignedArduino
Copy link
Owner Author

UnsignedArduino commented May 12, 2024

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
Copy link
Owner Author

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
Copy link
Contributor

sargedev commented May 12, 2024

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
Copy link
Owner Author

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
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
extension Extension suggestion. help wanted Extra attention is needed javascript
Projects
None yet
Development

No branches or pull requests

2 participants