webdac build — TypeScript Compilation Pipeline
webdac build is the primary build command for Webda applications. It compiles TypeScript, generates the module manifest, and produces JSON Schemas — all in one step.
What it does
Step-by-step:
- Incremental check — computes a digest of the source tree; if nothing changed since the last build (and
webda.module.jsonis intact), skips recompilation. - TypeScript compilation — runs
@webda/tsc-esmto emit ES module JavaScript intolib/. - Module analysis —
ModuleGeneratorwalks the compiled TypeScript program to discover:- Models (
Model,UuidModel, or any subclass) - Services (beans, moddas)
- Deployers
- Operations (
@Operation()methods)
- Models (
- Schema generation —
@webda/content-mapper'sSchemaGeneratorproduces JSON Schemas for each model (input, output, stored views) and each service's parameters. - Module merge — walks
node_modulesforwebda.module.jsonfiles from Webda dependencies and merges theirmoddas,deployers, andschemassections into the local manifest. - Write outputs — writes
webda.module.jsonand.webda-config-schema.json.
Usage
# One-shot build
webdac build
# Watch mode — rebuilds on file changes
webdac build --watch
# Specify a different app directory
webdac build --appPath /path/to/my-app
Options
| Flag | Default | Description |
|---|---|---|
--watch / -w | false | Watch for file changes and rebuild |
--force / -f | false | Recompile even when the cache reports nothing changed |
--appPath | . | Path to the application root (must contain tsconfig.json) |
Real build output (blog-system)
Running webdac build in sample-apps/blog-system:
2026-04-26T14:06:03.932Z [ INFO] Adding schema for WebdaSample/Post.publish.input
2026-04-26T14:06:03.932Z [ INFO] Adding schema for WebdaSample/Post.publish.output
2026-04-26T14:06:03.935Z [ INFO] Adding schema for WebdaSample/User.follow.input
2026-04-26T14:06:03.935Z [ INFO] Adding schema for WebdaSample/User.follow.output
...
2026-04-26T14:06:03.938Z [ INFO] Generating schemas 9
2026-04-26T14:06:03.939Z [ INFO] Generating schema for BinaryFile
2026-04-26T14:06:03.939Z [ INFO] Generating model schemas for Comment
2026-04-26T14:06:03.942Z [ INFO] Generating model schemas for Post
2026-04-26T14:06:03.947Z [ INFO] Generating model schemas for PostTag
2026-04-26T14:06:03.949Z [ INFO] Generating schema for Publisher
2026-04-26T14:06:03.951Z [ INFO] Generating model schemas for Tag
2026-04-26T14:06:03.952Z [ INFO] Generating schema for TestBean
2026-04-26T14:06:03.953Z [ INFO] Generating model schemas for User
2026-04-26T14:06:03.955Z [ INFO] Generating model schemas for UserFollow
Generated files
After a successful build, the following files are created or updated:
my-app/
├── lib/ # compiled JavaScript (gitignore)
│ └── models/
│ └── post.js
├── webda.module.json # module manifest (commit this)
└── .webda/
└── config.schema.json # VS Code autocomplete schema
Watch mode
webdac build --watch
In watch mode, the compiler listens for TypeScript file changes using the TypeScript watch API. When source files change, it re-runs the full pipeline (compilation + module generation). Useful during development alongside webda debug.
Incremental builds
The compiler stores a cache in .webda/cache:
{
"sourceDigest": "abc123",
"moduleDigest": "def456"
}
If sourceDigest matches the current source tree, moduleDigest matches webda.module.json on disk and every emitted file it references exists, the build is skipped entirely. The digests stay in this cache (which is not committed) rather than in webda.module.json, so the generated module only changes when its content does. This makes subsequent builds in watch mode very fast.
Integration with pnpm run build
In the Webda monorepo, pnpm run build in a package typically runs:
{
"scripts": {
"build": "webdac build"
}
}
Verify
cd sample-apps/blog-system
node ../../packages/compiler/lib/shell.js build
2026-04-26T14:06:03.932Z [ INFO] Adding schema for WebdaSample/Post.publish.input
...
2026-04-26T14:06:03.955Z [ INFO] Generating model schemas for UserFollow
Check that webda.module.json was updated:
ls -la sample-apps/blog-system/webda.module.json
See also
- Code Generation —
webdac codefor boilerplate method generation - Module Manifest — the structure and purpose of
webda.module.json - Plugins — extending the compiler with custom morpher modules
- @webda/content-mapper JSON Schema — schema generation details