Main ReleaseManager class - coordinates the entire release process
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
backupManager: BackupManager
changelogGenerator: ChangelogGenerator
config: NagareConfig
docGenerator: DocGenerator
fileHandlerManager: FileHandlerManager
git: GitOperations
github: GitHubIntegration
logger: Logger
stateTracker: ReleaseStateTracker
templateProcessor: TemplateProcessor
versionUtils: VersionUtils
attemptAutoFix(logs: string,_version: string,monitor: GitHubActionsMonitor,progress: StdProgressIndicator | null,): Promise<{ success: boolean; jsrUrl?: string; error?: string; }>
Attempt to auto-fix CI/CD errors
attemptPreflightAutoFix(result: PreflightResult): Promise<PreflightResult>
Attempt to auto-fix pre-flight check failures
buildSafeReplacement(pattern: RegExp,newValue: string,): string
Build safe replacement string for regex patterns
createProgressIndicator(): StdProgressIndicator | null
Create progress indicator instance
directJsrVerification(verifier: JsrVerifier,packageInfo: { scope: string; name: string; version: string; },_progress: StdProgressIndicator | null,): Promise<{ success: boolean; jsrUrl?: string; error?: string; attempts?: number; }>
Direct JSR verification without CI/CD monitoring
formatChangedFiles(): Promise<void>
Format all changed files after version updates
generateReleaseNotes(version: string,commits: ConventionalCommit[],): ReleaseNotes
Generate release notes from commits
Get the current configuration
getFilesToBackup(_newVersion: string,_releaseNotes: ReleaseNotes,): string[]
Get list of files to backup before modification
getPreflightChecks(): PreflightCheck[]
Get pre-flight checks to run before release
getTemplateValue(data: TemplateData,keyPath: string,): string | undefined
Get a value from template data by key path
mergeWithDefaults(config: NagareConfig): NagareConfig
Merge user config with defaults
performPreflightChecks(): Promise<PreflightResult>
Perform pre-flight validation checks
previewFileUpdates(templateData: TemplateData): Promise<void>
Preview file updates in dry-run mode
previewRelease(releaseNotes: ReleaseNotes | PRReleaseNotes): void
Preview the release changes
release(bumpType?: BumpType): Promise<ReleaseResult>
Main release method - orchestrates the entire release process
shouldVerifyJsrPublish(): boolean
Check if JSR publish verification should be performed
updateCustomFile(filePattern: FileUpdatePattern,templateData: TemplateData,): Promise<void>
Update a custom file based on patterns with enhanced file handler support
updateFiles(version: string,releaseNotes: ReleaseNotes | PRReleaseNotes,): Promise<string[]>
Update all configured files
updateVersionFile(templateData: TemplateData): Promise<void>
Update the main version file using template processor
validateEnvironment(): Promise<void>
Validate environment and prerequisites
validateFileUpdatePatterns(): { valid: boolean; warnings: string[]; errors: string[]; suggestions: string[]; }
Validate file update patterns to detect dangerous configurations
validateFileUpdatePatternsEnhanced(): { valid: boolean; warnings: string[]; errors: string[]; suggestions: string[]; }
Validate file update patterns with handler awareness
verifyJsrPublication(version: string,progress: StdProgressIndicator | null,): Promise<{ success: boolean; jsrUrl?: string; error?: string; attempts?: number; }>
Verify JSR publication with monitoring and auto-fix
validateConfig(config: NagareConfig): { valid: boolean; errors: string[]; }
Validate configuration