CLI Commands
generate
Generate TypeScript code from proto files. This is the default command.
bash
proto-codegen generate [options]Options:
-c, --config <file>- Config file path (default:proto-codegen.config.json)--proto-dir <dir>- Proto files directory-o, --output-dir <dir>- Output directory--types-only- Generate only type definitions--clients-only- Generate only HTTP clients--no-clean- Do not clean output directory before generation--verbose- Enable verbose logging--log-level <level>- Log level (debug, info, warn, error)
bash
# Use default config
proto-codegen generate
# Specify config file
proto-codegen generate -c my-config.json
# Generate types only
proto-codegen generate --types-only
# Set output directory
proto-codegen generate -o ./src/generatedpublish
Generate code and publish to npm registry.
bash
proto-codegen publish [options]Options:
-c, --config <file>- Config file path--bump <type>- Version bump type (major, minor, patch), default:patch--version <version>- Specify version (overrides auto-bump)--beta- Publish as beta version--tag <tag>- NPM dist-tag, default:beta--dry-run- Simulate without publishing--module <name>- Publish only specified module
bash
# Publish stable version (auto patch bump)
proto-codegen publish
# Publish beta version
proto-codegen publish --beta
# Specify version
proto-codegen publish --version 2.0.0
# Dry run
proto-codegen publish --dry-runlink
Generate code and create local links for frontend development.
bash
proto-codegen link [options]Options:
-c, --config <file>- Config file path--module <name>- Link only specified module--target <dir>- Frontend project directory (auto-updates package.json)--watch- Watch proto files and re-link on changes--dry-run- Simulate without linking
bash
# Create global link
proto-codegen link
# Link to specific frontend project
proto-codegen link --target ./frontend
# Watch mode
proto-codegen link --watch
# Link specific module only
proto-codegen link --module user-serviceunlink
Remove links created by the link command.
bash
proto-codegen unlink [options]Options:
-c, --config <file>- Config file path--module <name>- Unlink only specified module--target <dir>- Frontend project directory--dry-run- Simulate without unlinking