dark
dark copied to clipboard
Rewrite static assets feature in Dark
- remove remaining OCaml editor-servers
(WIP research brain-dump)
Relevant files in code (all in fsharp-backend):
src/ApiServer/Api/APIInitialLoad.fssrc/BackendOnlyStdLib/LibStaticAssets.fssrc/LibBackend/Config.fssrc/LibBackend/Pusher.fssrc/LibBackend/StaticAssets.fssrc/LibBackend/webserver_apiserver.ml.unportedtests/httptestfiles/serve-latest.testtests/staticassets-tests/README.mdtests/testfiles/staticassets.teststests/Tests/ApiServer.Tests.fstests/Tests/LibExecution.Tests.fstests/TestUtils/TestUtils.fs
Edit: there may be some upload-related stuff in webserver.ml, not in the F# project at all. Need to study more here.
Existing Functionality
- upload static assets
- external upload script
- backend stuff that handles the uploads by the script
- access via StdLib fns in BwdServer (list them out here)
- display the static asset deploys within the Editor
- ApiServer gathers this during
initial_load - ui.html and the
clientcode coordinate to display such
- ApiServer gathers this during
- upload static assets (currently only in OCaml)
- call Pusher when performed so client gets notification of new assets
Questions:
- ~Should
StaticAssetsshould be a Package wholly outside of the Dark repo?~ no
Research TODOs
- [ ] list out the stdlib fns here
- [ ] read through those code files and expand upon this document
- [ ] think through impl.
- [ ] think through testing
Should StaticAssets should be a Package wholly outside of the Dark repo?
No. Packages don't have the ability to dip into the runtime like StdLib functions do (and they're not intended to).
external upload script
This is https://github.com/darklang/dark-cli
What do you mean by "dip into the runtime"?
A stdlib function is written in F#, so it can call functions and use types from LibBackend. But a package can only call things already exposed as Stdlib functions.
I'll be continuing this work in #4259 for a while, focusing specifically on the upload of static assets. Eventually we may circle back to rewriting the whole thing in Dark.
Note that while there's some discussion about needing to dip into the runtime, we likely don't need to - we can simply replace our "internal" Postgres table with a Dark datastore in a canvas.
There's some related discussion in #4278 worth reading. (all future-thinking, not planning per se)
Not applicable in darklang-next.