hereby is the task runner system that orchestrates the TypeScript repository's build, test, and development workflows. It replaces the previous gulp-based build system and is defined in Herebyfile.mjs This page documents the task definitions, dependency chains, bundling pipeline, and command-line interface for the hereby-based build system.
For information about the specific build outputs (LKG, diagnostic generation, etc.), see Build Pipeline. For CI/CD workflows that invoke hereby tasks, see Main CI Pipeline.
hereby tasks are defined using the task() function imported from the hereby package [Herebyfile.mjs:9]. Each task is a JavaScript object with a name, optional description, optional dependencies, and a run function.
Sources: Herebyfile.mjs9 Herebyfile.mjs45-49 Herebyfile.mjs64-80
Tasks execute their dependencies before running their own run() function. The hereby runtime handles dependency resolution and execution orchestration. The repository exposes these tasks via package.json scripts [package.json:88-101].
Sources: Herebyfile.mjs36 package.json88-100
The repository defines three main compiler entrypoints, each built using the entrypointBuildTask() helper function [Herebyfile.mjs:310]:
| Task | Description | Entrypoint | Output | Compile Cache |
|---|---|---|---|---|
tsc | Command-line compiler | src/tsc/tsc.ts | built/local/tsc.js | Enabled |
services | TypeScript API library | src/typescript/typescript.ts | built/local/typescript.js | No |
tsserver | Language server | src/tsserver/server.ts | built/local/tsserver.js | Enabled |
Build Task Dependency Flow
Sources: Herebyfile.mjs310-414 Herebyfile.mjs416-427 Herebyfile.mjs429-440 Herebyfile.mjs453-465
The entrypointBuildTask() function at [Herebyfile.mjs:310-414] creates a suite of related tasks for each compiler entrypoint:
buildProject() to run tsc [Herebyfile.mjs:314].createBundler() [Herebyfile.mjs:347].Bundler Options:
Sources: Herebyfile.mjs172-179 Herebyfile.mjs180-293 Herebyfile.mjs438 Herebyfile.mjs462
The generateLibs task builds TypeScript library definition files from source by concatenating the copyright header with the .d.ts source [Herebyfile.mjs:64-80].
Sources: Herebyfile.mjs51-62 Herebyfile.mjs64-80
The generateDiagnostics task executes processDiagnosticMessages.mjs to convert the JSON diagnostic definitions into TypeScript code [Herebyfile.mjs:86-92].
The localize task then generates localized diagnostic files for 13 languages by running generateLocalizedDiagnosticMessages.mjs [Herebyfile.mjs:122-130].
Sources: Herebyfile.mjs82-92 Herebyfile.mjs122-130 scripts/processDiagnosticMessages.mjs1-10
The local task is the default target that builds the complete TypeScript compiler distribution [Herebyfile.mjs:663-668].
Sources: Herebyfile.mjs663-668 Herebyfile.mjs650-654 Herebyfile.mjs527-530
The tests task builds the test runner infrastructure [Herebyfile.mjs:534-551].
src/testRunnersrc/testRunner/_namespaces/Harness.tsbuilt/local/run.jstreeShaking: false to preserve all test code [Herebyfile.mjs:546].The runConsoleTests() function handles Mocha execution, coverage collection via c8, and test configuration [scripts/build/tests.mjs:34-188].
Sources: Herebyfile.mjs534-551 Herebyfile.mjs679-684 Herebyfile.mjs702-799 scripts/build/tests.mjs34-188
The lint task runs ESLint with caching enabled [Herebyfile.mjs:559-583]. Formatting is handled by dprint via the format task [Herebyfile.mjs:585-595].
Sources: Herebyfile.mjs559-583 Herebyfile.mjs585-595
The knip task runs the knip tool to identify unused files and exports [Herebyfile.mjs:597-602].
Sources: Herebyfile.mjs597-602 knip.jsonc1-10
hereby tasks access command-line options through the cmdLineOptions object [scripts/build/options.mjs:1-92].
| Option | Type | Default | Description |
|---|---|---|---|
bundle | boolean | true | Bundle with esbuild vs shim |
typecheck | boolean | true | Run tsc type-checking |
dirty | boolean | false | Skip test directory cleaning |
light | boolean | true | Run tests in light mode |
coverage | boolean | false | Generate coverage reports |
Sources: scripts/build/options.mjs1-92 Herebyfile.mjs14
The createBundler() function creates an esbuild configuration wrapper [Herebyfile.mjs:180-293].
Sources: Herebyfile.mjs180-293 Herebyfile.mjs216-260
The scripts/build/projects.mjs module provides core project management [scripts/build/projects.mjs:16-19]:
buildProject(projectName): Runs tsc on a project.watchProject(projectName): Runs tsc in watch mode.cleanProject(projectName): Cleans project outputs.The exec() function handles process spawning with cancellation token support and error reporting [scripts/build/utils.mjs:25-57].
Sources: scripts/build/utils.mjs25-57 Herebyfile.mjs16-19
The memoize() utility caches function results, used for loading the copyright header and generating bundler options [scripts/build/utils.mjs:229-238].
Refresh this wiki