The ReleaseManager orchestrates all aspects of the release process including:
- Version calculation based on conventional commits
- File updates using intelligent handlers or custom patterns
- Changelog generation following Keep a Changelog format
- Git operations (tagging, pushing)
- GitHub release creation
- Documentation generation
Release Flow
- Environment Validation - Checks git repository, uncommitted changes
- Version Calculation - Analyzes commits to determine version bump
- File Updates - Updates version in configured files
- Changelog Generation - Creates/updates CHANGELOG.md
- Git Operations - Commits changes and creates tag
- GitHub Release - Creates release on GitHub (if configured)
- Documentation - Generates docs (if configured)
Basic usage with automatic version detection
Basic usage with automatic version detection
const config: NagareConfig = { project: { name: "My App", repository: "https://github.com/user/app" }, versionFile: { path: "./version.ts", template: "typescript" } }; const manager = new ReleaseManager(config); const result = await manager.release(); // Auto-detects version bump if (result.success) { console.log(`Released version ${result.version}`); }
CI/CD integration with skip confirmation
CI/CD integration with skip confirmation
const config: NagareConfig = { project: { name: "My App", repository: "https://github.com/user/app" }, versionFile: { path: "./version.ts", template: "typescript" }, options: { skipConfirmation: true, // No interactive prompts logLevel: LogLevel.DEBUG // Verbose output for CI logs } }; const manager = new ReleaseManager(config); const result = await manager.release("patch");
With intelligent file handlers (v1.1.0+)
With intelligent file handlers (v1.1.0+)
const config: NagareConfig = { project: { name: "My App", repository: "https://github.com/user/app" }, versionFile: { path: "./version.ts", template: "typescript" }, updateFiles: [ { path: "./deno.json" }, // Auto-detected JSON handler { path: "./package.json" }, // Auto-detected JSON handler { path: "./README.md" }, // Auto-detected Markdown handler { path: "./custom.yaml", // Custom pattern for edge cases patterns: { version: /^version:\s*['"]?([^'"]+)['"]?$/m } } ] };
Dry run mode for testing
Dry run mode for testing
const config: NagareConfig = { project: { name: "My App", repository: "https://github.com/user/app" }, versionFile: { path: "./version.ts", template: "typescript" }, options: { dryRun: true } // Preview without making changes }; const manager = new ReleaseManager(config); const result = await manager.release(); // Shows what would happen without actually doing it
Custom commit type mappings
Custom commit type mappings
const config: NagareConfig = { project: { name: "My App", repository: "https://github.com/user/app" }, versionFile: { path: "./version.ts", template: "typescript" }, commitTypes: { feat: "added", // New features fix: "fixed", // Bug fixes perf: "improved", // Performance improvements docs: "documented", // Documentation changes enhance: "enhanced" // Custom type } };
ReleaseManager(config: NagareConfig,deps?: ReleaseManagerDeps)
Constructor with optional dependency injection
validateConfig(config: NagareConfig): { valid: boolean; errors: string[]; }
Validates required fields and configuration consistency. Useful for checking configuration before creating a ReleaseManager.
Get the current configuration
release(bumpType?: BumpType): Promise<ReleaseResult>
Coordinates the entire release workflow:
- Validates environment and configuration
- Analyzes commits to determine version bump
- Generates release notes
- Updates configured files (with preview in dry-run mode)
- Creates git commit and tag
- Pushes to remote repository
- Creates GitHub release (if configured)
- Generates documentation (if enabled)