Overview
Thebuild command is a convenience wrapper that runs the full localization workflow: it extracts messages from source code and immediately compiles them into runtime-ready bundles. This is the recommended command for most development and CI/CD workflows.
Syntax
Options
Enable verbose logging to see detailed progress for both extraction and compilation phases.
Suppress all logging output. Only errors will be displayed.
How It Works
The build command uses theBucketBuildWorker, which orchestrates both extraction and compilation:
1. Extract Phase
RunsBucketExtractWorker to:
- Scan all source files matching bucket patterns
- Extract translatable messages with metadata
- Write updated translation files for all locales
2. Compile Phase
RunsBucketCompileWorker to:
- Read the newly extracted translation files
- Apply fallback logic for missing translations
- Generate optimized runtime JSON bundles
3. Sequential Execution
The build worker ensures:- Extraction completes before compilation starts
- All buckets are processed in parallel for efficiency
- Errors in one bucket donβt block others (
Promise.allSettled)
Examples
Basic build
Verbose build
Quiet build
Multi-Bucket Support
If your configuration defines multiple buckets,build processes them all:
Watch Mode (Coming Soon)
The build command includes commented-out watch functionality:- Monitor source files for changes
- Automatically re-extract and recompile when files change
- Ideal for development workflows
Watch mode is currently disabled in the codebase but may be enabled in future releases.
When to Use
Usesaykit build in these scenarios:
Development
- After adding new messages to your code
- When starting work on localization
- Before testing translation updates
CI/CD Pipeline
Pre-commit Hook
Output Files
The build command generates both: Source translation files (for translators):locales/en.polocales/es.polocales/fr.po
locales/en.jsonlocales/es.jsonlocales/fr.json
Comparison with Separate Commands
| Scenario | Command | Why |
|---|---|---|
| Normal development | saykit build | Keeps everything in sync |
| Added new messages | saykit build | Extract and compile together |
| Translations updated | saykit compile | Only need to recompile |
| Debugging extraction | saykit extract -v | Focus on extraction only |
| CI/CD pipeline | saykit build | Complete workflow |
Performance
The build command is optimized for speed:- Processes all buckets in parallel
- Uses
Promise.allSettledto prevent blocking - Reuses parsed AST when extracting messages
- Caches fallback translations during compilation
- Extraction: ~2-5 seconds
- Compilation: ~100-500ms
- Total: ~2-6 seconds