TODO
See also:
- Project Tracking - what we're actually working on right
- Darklang Community Discord
- Roadmap
- Contributor guide
See our guide to the repo for help browsing.
TODO
TODO
We develop Dark within a docker container, so there is not a lot of setup. However, we do need to setup the host system in a few ways to support running scripts, and Docker.
To build and run the server you must have the following installed (and running):
- Homebrew for Mac
- Docker for Mac
- Bash 4 or later:
brew install bash
Everything should just work on Linux, so long as you have docker installed and you are using bash 4 or later.
On Windows, you can run Dark in WSL2 (Windows Subsystem for Linux):
- You must be on at least Windows 10 Version 2004, and you must run WSL 2 (docker does not work in WSL 1)
- Follow the WSL 2 installation instructions
- Follow the Docker for WSL 2 installation instructions
- You need to clone the dark repo with the git
core.autocrlf
setting set tofalse
. You can configure this by runninggit config --global core.autocrlf false
. If you have already cloned dark, you will need to reclone it. - This section of the guide is incomplete. Please create an issue if you find something doesn't work.
Now that the pre-requisites are installed, we should be able to build the development container in Docker, which has the exact right versions of all the tools we use.
- If you're using VSCode, we run our build scripts in the VSCode devcontainer. See the VSCode instructions for instructions.
- Otherwise, simply run
scripts/builder --compile --watch --test
These steps apply for all builds, VSCode or using scripts/builder
:
- Wait until the terminal says "Initial compile succeeded" - this means the
build server is ready. The
builder
script will sit open, waiting for file changes in order to recompile - If you see "initial compile failed", it may be a memory issue. Sometimes trying again will work. If not, ensure you have Docker configured to provide 4GB or more of memory, then try again.
- Open your browser to http://darklang.localhost:9000/a/dark/, username "dark", password "what"
- Edit code normally - on each save to your filesystem, the app will be rebuilt and the browser will reload as necessary
The scripts/
directory is full of scripts. They automatically execute
in the dev container, even if they are run on the host (see
scripts/devcontainer/_assert-in-container
for how this works). Scripts starting with an underscore are primarily intended to be
run by other scripts. Scripts without an underscore are usually intended to be called
by a human, though they are often also called by other scripts as well.
If you've gotten this far, you're now ready to contribute your first PR.
Unit tests run when you specify --test
to scripts/builder
. You can run them as a once off using:
scripts/run-client-tests
scripts/run-in-docker bash
scripts/run-in-docker psql -d devdb
Config files (config/) define all env vars that you can use in Dark code.
All config vars must start with DARK_CONFIG
. Changing a config variable in
config/dev
requires restaring the devcontanier.
You can enable the FluidDebugger by mousing over the Gear in the left-sidebar. There is also "Enable debugger" which enables a legacy debugger that nobody uses and doesn't work well.
If you're using Chrome, enable Custom Formatters to see ReScript values in Chrome Dev Tools instead of their JS representation. From within Chrome Dev Tools, click "⠇", "Settings", "Preferences", "Enable Custom Formatters".
- Contributor docs
- Other ways to run the dev container
- Setting up your editor
- Running unit tests
- Dark unit tests
- If you're interviewing at Dark, read this
- Docs around running Dark in production
- Running the client against production (ngrok)
- Oplist serialization
- Intricacies of Bucklescript-tea
- Writing Stdlib docstrings
- Editing other BS libraries
- Add an account for yourself
- Using fuzzers to develop Dark
- Logging and telemetry
- Writing docstrings in the Dark Standard library