-
Notifications
You must be signed in to change notification settings - Fork 47
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
Handle local type definitions in Monaco #2883
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2883 +/- ##
==========================================
+ Coverage 91.69% 91.72% +0.02%
==========================================
Files 349 349
Lines 12975 12975
==========================================
+ Hits 11898 11901 +3
+ Misses 1077 1074 -3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
import createCompletionProvider from './magic-completion'; | ||
import { initiateSaveAndRun } from '../common'; | ||
|
||
const LOCAL_ADAPTORS_ROOT = 'http://localhost:5000'; |
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.
TODO: update this constant when the static fileserver is set up
results.push({ | ||
content: `declare module '@openfn/language-common' { ${content} }`, | ||
}); | ||
if (!content.match(/<!doctype html>/i)) { |
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.
TODO check this doctype stuff - this is from npm serve
returning folders, I think. When the plug is enabled I'll come back and have another look.
4e0f54e
to
c6478d8
Compare
Hi @theroinaochieng, can Frank take a look at this PR? It's not urgent at all. I know I've missed planning so it can wait until next sprint. I think it's only a small task though. Frank, we need to set up a plug which will statically serve the contents of the OPENFN_ADAPTORS_REPO folder. Maybe you can mount it at |
Note to me: do we need to update any docs? What docs do we have to local adaptors? |
Overview
Local adaptor support was added over in #2834, allowing the local monorepo to be used to run jobs through Lightning.
One thing that was (deliberately) excluded was the ability to also load type definitions (for monaco) from the monorepo.
This PR adds support for that, so that you can test your local typings in the editor (very helpful)
Note: This PR does not address the issue of fixing adaptor docs locally.
Implementation
The implementation is pretty simple really.
First of all it assumes that the typings are available over HTTP (see TODO: local serve support)
Then basically all we do is, if local adaptors is enabled, we pull down the typings from localhost. Otherwise, we download them from jsdelivr.
Simple really.
TODO: local serve support
In this current branch of the PR, I am serving adaptor files from the monorepo with an npm package called
serve
.So locally I go to adaptors and I run:
Now the contents of the monorepo are statically served to me on localhost:5000.
But I don't want to use npm server for this: I want to uses a phoenix plug to serve them locally from the app.
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