wgc router plugin build
Thebuild command generates gRPC code based on your GraphQL schema and compiles your plugin into platform-specific binaries.
Usage
Arguments
Options
Description
This command performs several steps to build your plugin:- Detect Plugin Language For Building: The language of the plugin is detected based on the presence of a go.mod file for Go, if it does not exist we check for a
package.jsonfile for TyppeScript, if none of these condition match the command fails - Generate Proto and Mapping Files: Processes your GraphQL schema to generate Protocol Buffers definitions and mapping files
- Generate gRPC Code: Uses the generated Proto files to create Go code for the gRPC service
- Install Language Specific Dependencies: Installs all required dependencies for your plugin
- Build Binaries: Compiles the plugin for one or more platform-architecture combinations
--generate-only flag.
Required Tools
The build command will automatically check for and install the necessary toolchain (like protoc, protoc-gen-go, etc.) when required tools can’t be found in the right version on your system. You can control this behavior with the--skip-tools-installation and --force-tools-installation flags.
For debugging your plugin, use the --debug flag to build with debug symbols. This enables debugging with tools like Delve, GoLand, or VS Code. See the debugging guide for detailed instructions.
You can also install the dependencies manually and use an IDE with Go support. The following table shows the current versions and download links for the required tools:
When building TypeScript plugins, the protoc TS/JS equivalents of the above are obtained via the
.bin folder in your plugins node_modules, these versions can be customized by the package.json of the TS plugin.Examples
Build for the current platform
Generate code only
Build for multiple platforms
Build for all supported platforms
Supported Platforms
The following platform-architecture combinations are supported:
When using the
--all-platforms flag, binaries for all of the above platforms will be built.
Output
The build process creates several outputs:- Generated code in the
generated/directory - Compiled binaries and any relevant accompanying files in the
bin/directory, named according to the target platform (e.g.,my-plugin-darwin-arm64,my-plugin-linux-amd64)