Skip to content

Development guide

Caleb Hearon edited this page Aug 9, 2025 · 15 revisions

After cloning, install the dev packages.

npm install

If you want to change C/C++, you'll also need to install Zig 0.14.

Developing locally

The following commands work out of the src/ directory. Each one of them is a single command: no build step is necessary.

Check types and output to dist/

npm run tsc

Start a live playground server

npm run playground

Run the tests

npm run test

Run the tests with watch mode enabled

npm run test:watch

Run an example (output goes in the same directory)

node -C typescript examples/rtl-1.ts

Changing other types of files

Some of the files in dropflow are generated from other files in the repo. The generated files are tracked in git because they're changed rarely. When you do need to make changes to these files, you'll need to run the appropriate command.

CSS parser

Outputs src/parse-css.js from the .pegjs file.

npm run buildcssparser

Unicode and font databases

Use gen.js to update files in gen/. These are Unicode tries and various character databases. To see available commands, run:

node gen.js help

C/C++ dependencies

Make sure you're using Zig 0.14. This outputs dist/dropflow.wasm from src/dropflow.cc, gen/*.cc, gen/*.c, and the dependencies in build.zig.zon.

zig build

The dist folder

Dropflow is distributed to NPM with JS and .d.ts files in the dist folder. To run tests before publishing or to debug any issues that might arise from this slightly different transformation, use the following commands.

Run the tests from the dist folder (JS)

npm run test:dist

Run an example from the dist folder (JS)

node dist/examples/rtl-1.js