Build Command
The build command compiles TypeScript script files in your EcuBus-Pro project into JavaScript. It uses the project's TypeScript configuration and esbuild to bundle and transpile your scripts. You can optionally minify and obfuscate the output for distribution.
Syntax
ecb_cli build <project> <file> [options]Arguments
project: Path to the EcuBus-Pro project file (
.ecb). Can be absolute or relative to the current working directory.file: Path to the TypeScript script file to build (e.g.
node.ts). If not absolute, it is resolved relative to the project directory first, then relative to the current working directory.
Options
-m, --minify: Minify and obfuscate the output code. This makes the code harder to read and reverse-engineer. Obfuscation includes control-flow flattening, string encoding, dead-code injection, and identifier mangling. Source maps are removed after obfuscation, so debugging the obfuscated output is not supported.
-o, --output <dir>: Output directory for the compiled JavaScript file. Default is
.ScriptBuildunder the project root. The given path is relative to the project directory.-l, --log-level <level>: Set the log level (
error,warn,info,debug). Default isinfo.-h, --help: Show help for the build command.
Output
- The compiled file is written as
<basename>.jsin the output directory (default:project/.ScriptBuild/). - A source map file
<basename>.js.mapis generated when not using--minify. - When using
--output, the built file and its source map (if any) are copied to the specified directory.
Examples
Basic build
Compile node.ts in the project:
ecb_cli build D:\path\to\project\Can.ecb node.tsOr with a relative project path:
ecb_cli build ./resources/examples/can/Can.ecb node.tsBuild with obfuscation
Compile and obfuscate the output:
ecb_cli build Can.ecb node.ts -mBuild to a custom output directory
Put the compiled file in a dist folder under the project:
ecb_cli build Can.ecb node.ts -o distBuild with debug logging
ecb_cli build Can.ecb node.ts --log-level=debug