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

Isolated parser builds #519

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Isolated parser builds #519

wants to merge 2 commits into from

Conversation

fkling
Copy link
Owner

@fkling fkling commented Jul 10, 2020

I don't think that the way astexplorer currently works (building everything as a single web app) is very maintainable. Bundling so many packages seems to be destined to fail at some point.

With this commit I'm trying a new approach: Building separate bundles
for parsers. The main reasoning behind the current approach is:

  • Instead of having to dictate with which tool a parser bundle needs to be generated, every parser has its own build process. This would allow us to choose the simplest approach/tool for a specific parser. My hope is that this won't turn into a maintenance nightmare because the configuration for every parser can stay rather simple, but we'll see.
  • The main parser build script can be run periodically on the server and automatically update bundles to the latest version. Because they are built separately, it doesn't require too many resources on the server either.

I plan to roll this out to more parsers over time. Things will probably have to change to accommodate every parser and maybe even more stuff to accommodate transforms.

Also I will need to find a way to automatically deploy updates to the parsers/ directory.

Note: I want to refrain from using babel to transpile parsers. Many parsers are actually already transformed and I don't think it's too unreasonable to assume that people will use a relatively recent browser.

How it works

parsers/build.sh traverses all parser folders, uses npm to check whether the local version needs an update and invokes the parsers Makefile. Bundles are put in an output folder and links are created for major and minor versions. That is, the bundle process will create something like [email protected] and also links [email protected] and [email protected] to it. The bundles are UMD/AMD builds since that makes it easier to load them in the browser.

Because of the links, a parser wrapper an just load acorn@1 and will get the latest version of that major version.

parsers/build.sh will run periodically as a cronjob.


Safe to say that it works fine locally. Any feedback is welcome!

@fkling fkling requested a review from RReverser July 10, 2020 17:17
I don't think that the way astexplorer currently works (building
everything as a single web app) is very maintainable. Bundling so many
packages seems to be destined to fail at some point.

With this commit I'm trying a new approach: Building separate bundles
for parsers. The main reasoning behind the current approach is:
- Instead of having to dictate with which tool a parser bundle needs to
  be generated, every parser has its own build process. This would allow
  us to choose the simplest approach/tool for a specific parser. My hope
  is that this won't turn into a maintenance nightmare because the
  configuration for every parser can stay rather simple, but we'll see.
- The main parser build script can be run periodically on the server and
  automatically update bundles to the latest version. Because they are
  built separately, it doesn't require too many resources on the server
  either.

I plan to roll this out to more parsers over time. Things will probably
have to change to accommodate every parser and maybe even more stuff to
accommodate transforms.

Also I will need to find a way to automatically deploy updates to the
`parsers/` directory.
@fkling fkling force-pushed the separate-parsers branch from e8da972 to 6a00578 Compare July 10, 2020 17:24
@fkling fkling changed the title Separate parsers Isolated parser builds Jul 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant