Vega Codegen
The Turbo Module API package provides the Vega Codegen tool to simplify the code generation process. Vega Codegen generates native signatures and scaffolding code from a TypeScript interface definition of a Turbo Module.
Note: To avoid caching the packages globally, run npm install
before running Codegen.
The following example shows how to run the tool.
npx @amazon-devices/keplerscript-turbomodule-api codegen src/js/src/NativeSampleTurboModule.ts \
--new -o src/kepler/NativeModules
The tool offers the following options:
-n, --new
: Writes implementation templates (and overwrites existing implementations with the same name). Existing files are saved with.bak
extension.-o, --outputPath
: Specifies where to generate the native files.-s, --namespace
: The C++ namespace of your TurboModule. Defaults tomyTurboModule
.-c, --className
: The C++ class name used in the generated code. Defaults to match yourTurboModuleRegistry
call from the TypeScript interface.-f, --outFile
: The name to use to generate the file names. Defaults to match yourTurboModuleRegistry
call from the TypeScript interface.
After running the tool, you can add your implementations in src/kepler/NativeModules/SampleTurboModule.cpp
.
For additional details on running the tool, see Vega Codegen FAQ. For example implementations with more complex types. see Advanced Turbo Module topics.
Last updated: Sep 30, 2025