-
Notifications
You must be signed in to change notification settings - Fork 42
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
Monaco offline support #2801
base: main
Are you sure you want to change the base?
Monaco offline support #2801
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2801 +/- ##
=======================================
Coverage 91.39% 91.39%
=======================================
Files 338 338
Lines 12052 12052
=======================================
Hits 11015 11015
Misses 1037 1037 ☔ View full report in Codecov by Sentry. |
@midigofrank when do we need to run I ask because once this is merged to main, local editing will break for everyone, and they'll need to know to run that command |
@josephjclark Also, when you don't have the correct version, a warning is logged:
EDIT: |
@midigofrank when I checked out this branch my monaco was dead. I'm sure there was a warning but there's SO MUCH logging that I didn't see it.
Is there any other way we can alert users about this change? |
Oh @midigofrank I have an unchecked in mix.lock file after running the esbuild install - maybe that's the issue? |
Err, unchecked mix.lock is fine. I'm surprised that mix setup isn't mentioned anywhere in RUNNINGLOCAL.md. Let me review the getting started guide and see how it's solved. This is a non issue for those running Docker though |
Also, for new users we are kinda safe because the assets won't really be built unless esbuild is installed. I reckon the app won't even start if it's missing. |
Ok, so it it's just our dev team that's going to hurt, we don't need to worry too much. Maybe we can add a troubleshooting line somewhere just as a fallback? |
@midigofrank the other thing I noticed here is that the file sizes of the monaco build have bloated significantly Here's local dev on main (prod looks about the same): Here's the same files on this Note that editor.main.js is up to 18mb and tsWrorker.js is 17mb. I've had a quick look at the worker file and it's not obvious to me what the difference is. The new file is many many more lines, but when I skim through it seems to have the same formatting and contents. Weird. I note that you're loading the I don't have time to investigate this any further right now - are you able to take a look? |
Whoa!! Good catch. Let me try and sift through |
Huge Improvement, thank you @midigofrank ! |
Hmm, hang on 🤔 The unminified code in dev, on main and branch, is very different. Neither is minified in dev right? Doesn't need to be. But there's a lot more content coming in the new version That'll be why the files still arent as small as the CDN build. It's not the minification, it's the content Those prod sizes are acceptable I think but I'd still like to understand the difference |
Hmm, yeah it could be the difference in versions. In staging and prod, the cdn is pointing to |
@midigofrank ooh that's interesting. A very likely culprit. And scary! It's critical that local dev and prod are running the same versions of software. Can you work out how to lock down those versions to 0.43.0? |
Ooh and local dev on It seems we just need to lock |
Thanks @midigofrank I've just run through to check a bunch of things:
Both tsworker files are about 4mb on disk. So basically, the difference between the CDN file and the local file is better compression over the wire through some CDN magic. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✨
Hey @josephjclark , this is a problem. Not sure how to proceed here
|
Hey @midigofrank I'll take a look later. Remember that prod is actually on 0.43 so it's not the version change, it's the build change generally |
Call summary:
|
@josephjclark thanks for flagging this, I've noted your concerns about potential future issues related to esbuild 22, dropped a note to understand how the implications of this release so we can figure out scope and prioritization @midigofrank I can't seem to see any notes for QA on this issue description, do you mind adding them? Also reached out about who our second reviewer on this should be. Major claps for finishing this! |
@josephjclark after several deliberations I have found a way through with just Using |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @midigofrank , I got a review request here. (CC @theroinaochieng .)
I've just attempted the validation steps but my Monaco is dead:
[info] GET /assets/monaco-editor/vs/loader.js
[debug] ** (Phoenix.Router.NoRouteError) no route found for GET /assets/monaco-editor/vs/loader.js (LightningWeb.Router)
(lightning 2.10.9) deps/phoenix/lib/phoenix/router.ex:541: LightningWeb.Router.call/2
(lightning 2.10.9) lib/lightning_web/endpoint.ex:1: LightningWeb.Endpoint.plug_builder_call/2
(lightning 2.10.9) lib/lightning_web/endpoint.ex:1: LightningWeb.Endpoint."call (overridable 3)"/2
(lightning 2.10.9) deps/plug/lib/plug/debugger.ex:136: LightningWeb.Endpoint."call (overridable 4)"/2
(lightning 2.10.9) lib/lightning_web/endpoint.ex:1: LightningWeb.Endpoint.call/2
(phoenix 1.7.18) lib/phoenix/endpoint/sync_code_reload_plug.ex:22: Phoenix.Endpoint.SyncCodeReloadPlug.do_call/4
(plug_cowboy 2.7.2) lib/plug/cowboy/handler.ex:11: Plug.Cowboy.Handler.init/2
(cowboy 2.12.0) /Users/taylor/build/lightning/deps/cowboy/src/cowboy_handler.erl:37: :cowboy_handler.execute/2
(cowboy 2.12.0) /Users/taylor/build/lightning/deps/cowboy/src/cowboy_stream_h.erl:306: :cowboy_stream_h.execute/3
(cowboy 2.12.0) /Users/taylor/build/lightning/deps/cowboy/src/cowboy_stream_h.erl:295: :cowboy_stream_h.request_process/3
(stdlib 5.2.3) proc_lib.erl:241: :proc_lib.init_p_do_apply/3
I also see an approval from Joe, but what sounds like an open conversation. Can you only add me back as a reviewer once this thing is ready to test out?
Or, if it is ready to test, please drop in some validation instructions that replace this current set of instructions:
Ensure you don't have any cache. You can test this on a private window
- Run mix esbuild.install to get the newly configured version
- Turn off your internet
- Start the server and try editing any job's body
As a separate bit... I'm worried that there's now a RUNNINGLOCAL.md
file. I see this was created 4 months back, and I'm sorry for not noticing and speaking up then, but why does this exist and duplicate so much of the official https://openfn.github.io/lightning/readme.html#dev-on-lightning-locally instruction?
Conclusion
Two things to do here:
- Let me know if/when this is ready for review. (If now, provide updated review instructions.)
- Delete
RUNNINGLOCAL.md
or... justify its existence, remove duplication from the README.md, and link to it from the README.md
Thank you! This is awesome work and I know MSF will be delighted to see this in action.
@taylordowns2000 thank you for this feedback. I'll circle back with Frank and re-request a review when the provided actions are completed. |
Hey @taylordowns2000 I have just pushed the fix for the issue you were experiencing, sorry my bad, I've also updated the validation instructions accordingly. As for |
Description
This PR enables monaco editor to work offline. It configures the
loader
to look for the files in theassets/
directory.This PR also creates another
esbuild
profile responsible for copying over the required monaco files. I've found this to be easier compared to configuring the worker: https://github.com/suren-atoyan/monaco-react/blob/master/README.md#loader-configCloses #2786
Validation steps
Ensure you don't have any cache. You can test this on a private window
RunEDIT: No longer neededmix esbuild.install
to get the newly configured versionnpm install --prefix assets
to get the updated monaco editor.v0.43.0
AI Usage
Please disclose how you've used AI in this work (it's cool, we just want to know!):
You can read more details in our Responsible AI Policy
Pre-submission checklist
:owner
,:admin
,:editor
,:viewer
)