@goedelsoup/nx-weaver
v0.1.0
Published
Nx plugin for OpenTelemetry Weaver integration
Maintainers
Readme
Nx Weaver Plugin
An Nx plugin for integrating OpenTelemetry Weaver into your Nx workspace. This plugin provides executors and generators to validate, generate, and manage Weaver configurations and generated code.
Features
- Validate Executor: Validate Weaver configuration files and schemas
- Generate Executor: Generate code from Weaver configurations
- Docs Executor: Generate documentation from Weaver configurations
- Clean Executor: Clean generated Weaver assets
- Init Generator: Initialize Weaver configuration in your workspace
- Setup Project Generator: Set up Weaver for specific projects
Documentation
For comprehensive documentation, see the Documentation Guide.
- Getting Started - Installation and basic setup
- User Guide - Detailed usage instructions
- API Reference - TypeScript types and utilities
- Examples - Real-world usage examples
Installation
pnpm add @goedelsoup/nx-weaverUsage
Initializing Weaver in Your Workspace
nx generate @goedelsoup/nx-weaver:initThis will create a default weaver.yaml configuration file in your workspace root.
Setting Up Weaver for a Specific Project
nx generate @goedelsoup/nx-weaver:setup-project my-projectThis will create a project-specific Weaver configuration and documentation.
Running Executors
Validate Configuration
nx run my-project:validateOptions:
--config: Path to the Weaver configuration file (default:weaver.yaml)--schema: Path to the schema file to validate against--verbose: Enable verbose output--dryRun: Perform a dry run without making changes
Generate Code
nx run my-project:generateOptions:
--config: Path to the Weaver configuration file (default:weaver.yaml)--output: Output directory for generated files--template: Template to use for code generation--verbose: Enable verbose output--dryRun: Perform a dry run without making changes
Generate Documentation
nx run my-project:docsOptions:
--config: Path to the Weaver configuration file (default:weaver.yaml)--output: Output directory for documentation files--format: Output format (markdown,html, orjson)--verbose: Enable verbose output--dryRun: Perform a dry run without making changes
Clean Generated Files
nx run my-project:cleanOptions:
--patterns: File patterns to clean--output: Output directory to clean--verbose: Enable verbose output--dryRun: Perform a dry run without making changes
Configuration
Weaver Configuration File (weaver.yaml)
version: "1.0"
name: "my-weaver-workspace"
# Component definitions
components:
my-service:
name: "my-service"
type: "service"
language: "typescript"
path: "./src"
# Pipeline definitions
pipelines:
my-pipeline:
name: "my-pipeline"
components: ["my-service"]
# Output configuration
output:
directory: "./generated"
format: "typescript"Project Configuration
Add Weaver targets to your project.json:
{
"targets": {
"validate": {
"executor": "@goedelsoup/nx-weaver:validate",
"options": {
"config": "weaver.yaml"
}
},
"generate": {
"executor": "@goedelsoup/nx-weaver:generate",
"options": {
"config": "weaver.yaml",
"output": "generated"
}
},
"docs": {
"executor": "@goedelsoup/nx-weaver:docs",
"options": {
"config": "weaver.yaml",
"output": "docs",
"format": "markdown"
}
},
"clean": {
"executor": "@goedelsoup/nx-weaver:clean",
"options": {
"patterns": ["generated/**/*"]
}
}
}
}