Note: there is a bit of potential confusion about the difference between /resources/builder.inc.sh (the full implementation for builder scripts), and /resources/build/builder.inc.sh (the source script that builder scripts should always use). This allows us to make assumptions that will always be true for builder scripts that may not be true for other scripts, such as setting base folder. |
||
|---|---|---|
| .. | ||
| docs | ||
| src | ||
| unit_tests | ||
| .build-builder | ||
| .gitignore | ||
| build.sh | ||
| package.json | ||
| README.md | ||
| tsconfig.all.json | ||
Language Modelling Layer (LMLayer)
Provide predictions and corrections while you type!
See Worker Communication Protocol for a semi-formal specification on how the Worker and the main thread communicate.
System dependencies
You will need Bash and Node.js >= 10.0.
Build
Run build.sh. This will also automatically install dependencies with npm.
./build.sh
Two-stage compilation process
Since the primary LMLayer code runs within a Web Worker, build.sh compiles the
LMLayer in two stages:
-
Compile the inner worker code
- Compile the TypeScript sources for only the Worker code.
- Wrap the Worker code as
embedded_worker.js
-
Compile the top-level code
- Include
embedded_worker.jsverbatim using a TypeScript directive. - Compile the top-level TypeScript code.
- Unwrap the Worker code at runtime.
- Include
Test
This will run both headless unit tests, and in-browser unit tests and integration tests:
./build.sh -test
Test-Driven Development
I like to use entr to automatically build and re-run the unit tests anytime I change a source code file. Here's the command I run in separate window:
git ls-files | entr -c ./build.sh -tdd
Importantly, ./build.sh -tdd skips running the in-browser tests, and skips
downloading/updating npm dependencies.