import { G as GlobalConfig, D as DefineConfigOptions, P as PluginSpec$1 } from './define-config-5PN4Kb1S.js'; export { a as BranchSpec } from './define-config-5PN4Kb1S.js'; import { a as ChangelogConfig, C as CommitAnalyzerConfig, b as GitConfig, G as GithubConfig, N as NpmConfig, R as ReleaseNotesGeneratorConfig } from './release-notes-generator-CZ4Fl9fQ.js'; import { BranchSpec } from 'semantic-release'; import { LiteralUnion } from 'type-fest'; import { z } from 'zod'; export { z } from 'zod'; /** * Configuration composition utilities for semantic-release. * * This module provides utilities for merging, extending, and overriding * semantic-release configurations, enabling complex configuration scenarios * where presets need to be combined with custom settings. These utilities * are essential for creating reusable configuration patterns and combining * multiple configuration sources. * * **Key Features:** * - Intelligent plugin merging with conflict resolution strategies * - Branch configuration composition with inheritance support * - Deep configuration merging with type safety * - Validation integration with comprehensive error reporting * - Support for preset composition and customization * * **Common Use Cases:** * - Combining preset configurations with project-specific overrides * - Creating organization-wide configuration templates * - Building complex monorepo configurations from smaller pieces * - Environment-specific configuration variations * * @example * ```typescript * import { mergeConfigs, extendConfig } from '@bfra.me/semantic-release/composition' * import { npmPreset, githubPreset } from '@bfra.me/semantic-release/presets' * * // Merge multiple presets * const merged = mergeConfigs( * npmPreset(), * githubPreset(), * { dryRun: true } // Add custom overrides * ) * ``` * * @example * ```typescript * // Extend a base configuration * const extended = extendConfig(npmPreset(), { * plugins: [['@semantic-release/npm', { npmPublish: false }]] * }) * ``` * * @example * ```typescript * // Advanced composition with strategies * const composed = mergeConfigsWithOptions([ * baseConfig, * productionConfig, * environmentConfig * ], { * pluginStrategy: 'append', // Add plugins rather than replacing * branchStrategy: 'merge', // Merge branch configurations * validate: true // Validate the result * }) * ``` */ /** * Options for configuration composition operations. * * These options control how configurations are merged when conflicts arise, * allowing fine-grained control over the composition process. */ interface CompositionOptions { /** * How to handle plugin conflicts when merging configurations. * * Determines the strategy used when multiple configurations define plugins: * - `replace`: Replace existing plugins entirely with new ones * - `merge`: Intelligently merge plugin configurations (default) * - `append`: Add new plugins after existing ones * - `prepend`: Add new plugins before existing ones * * @default 'merge' * * @example * ```typescript * // Replace all existing plugins * mergeConfigsWithOptions([base, override], { * pluginStrategy: 'replace' * }) * * // Append additional plugins * mergeConfigsWithOptions([base, additional], { * pluginStrategy: 'append' * }) * ``` */ pluginStrategy?: 'replace' | 'merge' | 'append' | 'prepend'; /** * How to handle branch configuration conflicts. * * Determines the strategy for combining branch configurations: * - `replace`: Use the new branch configuration entirely * - `merge`: Merge branch configurations intelligently (default) * * @default 'merge' * * @example * ```typescript * // Replace branch configuration completely * mergeConfigsWithOptions([base, override], { * branchStrategy: 'replace' * }) * ``` */ branchStrategy?: 'replace' | 'merge'; /** * Whether to perform deep validation on the result. * * When enabled, the composed configuration will be validated against * semantic-release schemas to ensure correctness. * * @default true * * @example * ```typescript * // Skip validation for performance or dynamic configs * mergeConfigsWithOptions([config1, config2], { * validate: false * }) * ``` */ validate?: boolean; } /** * Merge multiple semantic-release configurations intelligently. * * This function takes multiple configuration objects and merges them together, * applying intelligent strategies for handling conflicts in plugins, branches, * and other configuration options. The merge process follows semantic-release * best practices and maintains type safety throughout. * * **Merge Behavior:** * - Simple properties: Later configurations override earlier ones * - Plugins: Intelligently merged based on plugin names and configurations * - Branches: Combined with deduplication and smart conflict resolution * - Arrays: Merged with deduplication where appropriate * * @param config1 - First configuration object (base configuration) * @param config2 - Second configuration object (override configuration) * @param restConfigs - Additional configuration objects to merge * @returns A merged configuration object with combined settings * * @example * ```typescript * // Basic preset merging * const base = npmPreset({ branches: ['main'] }) * const custom = { * dryRun: true, * repositoryUrl: 'https://github.com/user/repo.git' * } * const merged = mergeConfigs(base, custom) * // Result: npmPreset configuration + dryRun + repositoryUrl * ``` * * @example * ```typescript * // Multi-preset composition * const merged = mergeConfigs( * npmPreset(), * githubPreset(), * { * tagFormat: '${name}@${version}', // Custom tag format * plugins: [ * ['@semantic-release/changelog', { changelogTitle: '# My Changelog' }] * ] * } * ) * ``` * * @example * ```typescript * // Environment-specific configuration * const production = mergeConfigs( * baseConfig, * { ci: true, dryRun: false }, * productionOnlyPlugins * ) * * const development = mergeConfigs( * baseConfig, * { ci: false, dryRun: true }, * developmentPlugins * ) * ``` */ declare function mergeConfigs(config1: GlobalConfig, config2: GlobalConfig, ...restConfigs: GlobalConfig[]): GlobalConfig; /** * Merge multiple semantic-release configurations with advanced options. * * Provides fine-grained control over the merging process through composition options, * allowing customization of how conflicts are resolved and how different configuration * aspects are combined. * * @param configs - Array of configuration objects to merge (must have at least one) * @param options - Options controlling merge behavior and validation * @returns A merged configuration object with settings from all inputs * * @example * ```typescript * // Plugin strategy examples * const replaced = mergeConfigsWithOptions([base, override], { * pluginStrategy: 'replace' // Use only override plugins * }) * * const appended = mergeConfigsWithOptions([base, additional], { * pluginStrategy: 'append' // Add additional plugins to base * }) * * const prepended = mergeConfigsWithOptions([priority, base], { * pluginStrategy: 'prepend' // Priority plugins run first * }) * ``` * * @example * ```typescript * // Complex monorepo configuration * const monorepoConfig = mergeConfigsWithOptions([ * monorepoPreset(), * packageSpecificConfig, * environmentConfig * ], { * pluginStrategy: 'merge', // Intelligently combine plugins * branchStrategy: 'merge', // Merge branch configurations * validate: true // Ensure result is valid * }) * ``` */ declare function mergeConfigsWithOptions(configs: readonly [GlobalConfig, ...GlobalConfig[]], options?: CompositionOptions): GlobalConfig; /** * Extend a base configuration with additional options. * * This function takes a base configuration and extends it with additional options, * using the same merging strategies as `mergeConfigs` but with a cleaner API * for the common case of extending a single base configuration. * * @param base - Base configuration to extend * @param extension - Extension configuration * @param options - Options controlling merge behavior * @returns An extended configuration object * * @example * ```typescript * const base = npmPreset() * const extended = extendConfig(base, { * dryRun: true, * plugins: [['@semantic-release/npm', { npmPublish: false }]] * }) * ``` */ declare function extendConfig(base: GlobalConfig, extension: GlobalConfig, options?: CompositionOptions): GlobalConfig; /** * Override a base configuration with new options. * * This function provides complete replacement semantics, where the override * configuration completely replaces matching properties in the base configuration. * This is useful when you need to completely replace certain aspects like plugins. * * @param base - Base configuration to override * @param override - Override configuration * @param options - Options controlling override behavior * @returns An overridden configuration object * * @example * ```typescript * const base = npmPreset() * const overridden = overrideConfig(base, { * plugins: [['@semantic-release/git']] // Completely replaces plugins * }) * ``` */ declare function overrideConfig(base: GlobalConfig, override: GlobalConfig, options?: Omit): GlobalConfig; /** * Configuration factory functions and utilities for semantic-release. * * This module provides both the enhanced configuration API and backward-compatible * defineConfig function for semantic-release configurations with comprehensive * TypeScript support, runtime validation, and environment-specific optimizations. * * @example * ```typescript * // Basic configuration * import { defineConfig } from '@bfra.me/semantic-release' * * export default defineConfig({ * branches: ['main'], * plugins: ['@semantic-release/commit-analyzer', '@semantic-release/npm'] * }) * ``` * * @example * ```typescript * // Advanced configuration with environment detection * import { defineConfig } from '@bfra.me/semantic-release' * * export default defineConfig({ * branches: ['main', { name: 'beta', prerelease: true }], * plugins: [ * '@semantic-release/commit-analyzer', * ['@semantic-release/npm', { npmPublish: true }], * '@semantic-release/github' * ] * }, { * environment: 'production', * validate: true * }) * ``` */ /** * Define semantic-release global configuration with enhanced validation and features. * * This is the main configuration factory function that provides comprehensive * TypeScript support, runtime validation, environment-specific transformations, * and improved developer experience for semantic-release configurations. * * **Features:** * - Full TypeScript type safety with IntelliSense support * - Runtime validation with detailed error messages and suggestions * - Environment-specific configuration transformations * - Automatic plugin configuration detection and optimization * - Comprehensive error handling with actionable feedback * * @param config - Semantic-release configuration object with full type safety * @param options - Configuration options for validation and environment processing * @returns Enhanced and validated semantic-release configuration * * @throws {ValidationError} When configuration validation fails with detailed error information * * @example * ```typescript * // Basic npm package configuration * export default defineConfig({ * branches: ['main'], * plugins: [ * '@semantic-release/commit-analyzer', * '@semantic-release/release-notes-generator', * '@semantic-release/npm', * '@semantic-release/github' * ] * }) * ``` * * @example * ```typescript * // Monorepo package configuration * export default defineConfig({ * tagFormat: '${name}@${version}', * branches: ['main'], * plugins: [ * ['@semantic-release/commit-analyzer', { * preset: 'conventionalcommits' * }], * ['@semantic-release/npm', { * npmPublish: true, * tarballDir: 'dist' * }] * ] * }) * ``` * * @example * ```typescript * // Development environment with validation disabled * export default defineConfig({ * branches: ['main'], * plugins: ['@semantic-release/commit-analyzer'] * }, { * environment: 'development', * validate: false // Skip validation for dynamic configs * }) * ``` * * @example * ```typescript * // Complex configuration with custom plugins * export default defineConfig({ * branches: [ * 'main', * { name: 'next', prerelease: true }, * { name: 'maintenance', range: '1.x.x' } * ], * plugins: [ * '@semantic-release/commit-analyzer', * '@semantic-release/release-notes-generator', * ['@semantic-release/changelog', { * changelogFile: 'CHANGELOG.md', * changelogTitle: '# Release Notes' * }], * ['@semantic-release/npm', { * npmPublish: true * }], * ['@semantic-release/github', { * assets: [ * { path: 'dist/*.tgz', label: 'Distribution' }, * { path: 'coverage/', label: 'Coverage Report' } * ] * }], * ['@semantic-release/git', { * assets: ['CHANGELOG.md', 'package.json'], * message: 'chore(release): ${nextRelease.version} [skip ci]' * }] * ] * }) * ``` * * @see {@link DefineConfigOptions} for available configuration options * @see {@link https://semantic-release.gitbook.io/semantic-release/usage/configuration} for semantic-release configuration documentation */ declare function defineConfig(config: T, options?: DefineConfigOptions): T; /** * Legacy defineConfig function for backward compatibility. * * This maintains the exact same API as the original function while adding * validation under the hood. Recommended for migration scenarios where * minimal changes are required. * * **Migration Note:** Consider using the main `defineConfig` function with * explicit options for better control over validation and environment handling. * * @param config - Semantic-release configuration object * @returns Validated semantic-release configuration * * @deprecated Consider using `defineConfig(config, { validate: true })` instead * * @example * ```typescript * // Legacy usage (still supported) * export default defineConfigLegacy({ * branches: ['main'], * plugins: ['@semantic-release/npm'] * }) * ``` * * @example * ```typescript * // Recommended migration approach * export default defineConfig({ * branches: ['main'], * plugins: ['@semantic-release/npm'] * }, { * validate: true // Explicit validation control * }) * ``` */ declare function defineConfigLegacy(config: T): T; /** * Environment-specific configuration utilities for semantic-release. * * This module provides comprehensive environment detection and configuration * transformation utilities to support different deployment environments * (development, staging, production, test) with appropriate defaults and * optimizations for each context. */ /** * Supported environment types for semantic-release configurations. */ type Environment = 'development' | 'staging' | 'production' | 'test'; /** * Environment detection result with metadata. */ interface EnvironmentContext { /** * The detected or explicitly set environment. */ environment: Environment; /** * Whether the environment was auto-detected or explicitly set. */ autoDetected: boolean; /** * Source of the environment detection (e.g., 'NODE_ENV', 'CI', 'explicit'). */ source: string; /** * Whether we're running in a CI environment. */ isCI: boolean; /** * Additional metadata about the detected environment. */ metadata: { nodeEnv?: string; ciVendor?: string; branchName?: string; }; } /** * Environment-specific configuration transformations. */ interface EnvironmentTransformations { /** * Branch configuration modifications. */ branches?: string[] | undefined; /** * CI mode configuration. */ ci?: boolean; /** * Dry-run mode configuration. */ dryRun?: boolean; /** * Debug mode configuration. */ debug?: boolean; /** * Repository URL modifications. */ repositoryUrl?: string; /** * Tag format modifications. */ tagFormat?: string; /** * Plugin configuration transformations. */ plugins?: (string | [string, unknown])[]; } /** * Detect the current environment based on various indicators. * * @param explicitEnv - Explicitly specified environment (overrides detection) * @returns Environment context with detection metadata */ declare function detectEnvironment(explicitEnv?: Environment): EnvironmentContext; /** * Get environment-specific configuration transformations. * * @param environment - Target environment * @param context - Environment context with detection metadata * @returns Configuration transformations for the environment */ declare function getEnvironmentTransformations(environment: Environment, context: EnvironmentContext): EnvironmentTransformations; /** * Apply environment-specific transformations to a configuration. * * @param config - Base configuration to transform * @param environment - Target environment * @param context - Environment context with detection metadata * @returns Transformed configuration */ declare function applyEnvironmentTransformations(config: GlobalConfig, environment: Environment, context: EnvironmentContext): GlobalConfig; /** * Create environment-specific configuration presets. */ declare const environmentPresets: { /** * Development environment preset with safe defaults. */ readonly development: { readonly branches: readonly ["main", "master", "develop", "development"]; readonly dryRun: true; readonly debug: true; readonly ci: false; readonly tagFormat: "v${version}-dev"; }; /** * Test environment preset optimized for testing. */ readonly test: { readonly branches: readonly ["main", "master"]; readonly dryRun: true; readonly debug: true; readonly ci: true; readonly tagFormat: "v${version}-test"; }; /** * Staging environment preset for pre-production testing. */ readonly staging: { readonly branches: readonly ["staging", "stage", "main"]; readonly dryRun: false; readonly debug: true; readonly ci: true; readonly tagFormat: "v${version}-staging"; }; /** * Production environment preset for production releases. */ readonly production: { readonly branches: readonly ["main", "master"]; readonly dryRun: false; readonly debug: false; readonly ci: true; readonly tagFormat: "v${version}"; }; }; /** * Type-safe plugin configuration helpers for popular semantic-release plugins. * * This module provides helper functions that create properly typed and validated * configurations for popular semantic-release plugins, enhancing the developer * experience with IntelliSense support and runtime validation. */ /** * Create a type-safe configuration for @semantic-release/commit-analyzer plugin. * * @param config - Plugin configuration options * @returns Plugin specification tuple */ declare function commitAnalyzer(config?: CommitAnalyzerConfig): PluginSpec$1; /** * Create a type-safe configuration for @semantic-release/release-notes-generator plugin. * * @param config - Plugin configuration options * @returns Plugin specification tuple */ declare function releaseNotesGenerator(config?: ReleaseNotesGeneratorConfig): PluginSpec$1; /** * Create a type-safe configuration for @semantic-release/changelog plugin. * * @param config - Plugin configuration options * @returns Plugin specification tuple */ declare function changelog(config?: ChangelogConfig): PluginSpec$1; /** * Create a type-safe configuration for @semantic-release/npm plugin. * * @param config - Plugin configuration options * @returns Plugin specification tuple */ declare function npm(config?: NpmConfig): PluginSpec$1; /** * Create a type-safe configuration for @semantic-release/github plugin. * * @param config - Plugin configuration options * @returns Plugin specification tuple */ declare function github(config?: GithubConfig): PluginSpec$1; /** * Create a type-safe configuration for @semantic-release/git plugin. * * @param config - Plugin configuration options * @returns Plugin specification tuple */ declare function git(config?: GitConfig): PluginSpec$1; /** * Collection of commonly used plugin configurations as presets. */ declare const pluginPresets: { /** * Standard commit analyzer with conventional commits preset. */ readonly standardCommitAnalyzer: PluginSpec$1; /** * Standard release notes generator with conventional commits preset. */ readonly standardReleaseNotes: PluginSpec$1; /** * Standard changelog configuration. */ readonly standardChangelog: PluginSpec$1; /** * NPM plugin configured for public package publishing. */ readonly npmPublicPackage: PluginSpec$1; /** * NPM plugin configured for private package publishing. */ readonly npmPrivatePackage: PluginSpec$1; /** * GitHub plugin with standard configuration. */ readonly githubStandard: PluginSpec$1; /** * Git plugin with standard commit configuration. */ readonly gitStandard: PluginSpec$1; }; /** * Preset factory functions for common semantic-release workflows. * * This module provides pre-configured semantic-release setups for common * scenarios like npm packages, GitHub releases, and monorepo workflows. * Each preset encapsulates best practices and proven configurations for * specific use cases, enabling quick setup with minimal configuration. * * **Available Presets:** * - `npmPreset()` - Full npm package workflow with changelog and GitHub releases * - `githubPreset()` - GitHub releases only, no npm publishing * - `monorepoPreset()` - Monorepo-aware configuration with package-specific tagging * * @example * ```typescript * // NPM package with standard workflow * import { npmPreset } from '@bfra.me/semantic-release/presets' * * export default npmPreset({ * branches: ['main', { name: 'beta', prerelease: true }] * }) * ``` * * @example * ```typescript * // GitHub releases only * import { githubPreset } from '@bfra.me/semantic-release/presets' * * export default githubPreset({ * branches: ['main'] * }) * ``` * * @example * ```typescript * // Monorepo package * import { monorepoPreset } from '@bfra.me/semantic-release/presets' * * export default monorepoPreset({ * packageName: 'my-package', * branches: ['main'] * }) * ``` */ /** * Base preset options that can be applied to any preset. * * These options provide common configuration patterns that work across * all preset types, allowing for consistent customization. */ interface BasePresetOptions { /** * Branches configuration for release workflow. * * Defines which branches can trigger releases and how they're handled. * Supports both production and prerelease branch configurations. * * @default ['main'] * * @example * ```typescript * // Simple main branch only * branches: ['main'] * * // Production + prerelease branches * branches: [ * 'main', * { name: 'beta', prerelease: true }, * { name: 'alpha', prerelease: 'alpha' } * ] * ``` */ branches?: GlobalConfig['branches']; /** * Repository URL if not auto-detected from Git remotes. * * Useful when running in environments where Git remotes aren't properly * configured or when you need to override the detected repository URL. * * @example 'https://github.com/owner/repo.git' * @example 'git@github.com:owner/repo.git' */ repositoryUrl?: string; /** * Enable dry-run mode for testing configurations. * * When enabled, semantic-release will analyze commits and generate * release notes but won't actually publish anything. Useful for * testing and CI pipeline validation. * * @default false * * @example * ```typescript * // Test mode * dryRun: true * * // Environment-based * dryRun: process.env.NODE_ENV !== 'production' * ``` */ dryRun?: boolean; /** * Additional configuration options for the defineConfig function. * * Allows passing validation options, environment settings, and other * advanced configuration options to the underlying defineConfig call. * * @example * ```typescript * defineOptions: { * validate: true, * environment: 'production' * } * ``` */ defineOptions?: DefineConfigOptions; } /** * Create an npm package release preset with comprehensive workflow. * * This preset is optimized for standard npm package releases and includes: * - Conventional commit analysis * - Automated release notes generation * - CHANGELOG.md file maintenance * - npm package publishing * - GitHub release creation * - Git commits for changelog updates * * **Included Plugins:** * - `@semantic-release/commit-analyzer` - Analyzes commits for release type * - `@semantic-release/release-notes-generator` - Generates release notes * - `@semantic-release/changelog` - Maintains CHANGELOG.md file * - `@semantic-release/npm` - Publishes to npm registry * - `@semantic-release/github` - Creates GitHub releases * - `@semantic-release/git` - Commits changelog changes back to repository * * @param options - Configuration options for the npm preset * @returns A complete semantic-release configuration optimized for npm packages * * @example * ```typescript * // Basic npm package configuration * export default npmPreset({ * branches: ['main'] * }) * ``` * * @example * ```typescript * // npm package with prerelease support * export default npmPreset({ * branches: [ * 'main', * { name: 'beta', prerelease: true }, * { name: 'alpha', prerelease: true } * ] * }) * ``` * * @example * ```typescript * // Testing configuration * export default npmPreset({ * branches: ['main'], * dryRun: true, // Test without publishing * defineOptions: { * validate: true // Enable strict validation * } * }) * ``` */ declare function npmPreset(options?: BasePresetOptions): GlobalConfig; /** * Create a GitHub-only release preset without npm publishing. * * This preset is optimized for projects that only need GitHub releases * without npm publishing or local file modifications. Perfect for: * - Applications that don't publish to package registries * - Docker-based projects * - Binary releases * - Documentation sites * * **Included Plugins:** * - `@semantic-release/commit-analyzer` - Analyzes commits for release type * - `@semantic-release/release-notes-generator` - Generates release notes * - `@semantic-release/github` - Creates GitHub releases with assets * * @param options - Configuration options for the GitHub preset * @returns A complete semantic-release configuration for GitHub-only releases * @example * ```typescript * // Basic GitHub releases * export default githubPreset({ * branches: ['main'] * }) * ``` */ declare function githubPreset(options?: BasePresetOptions): GlobalConfig; /** * Create a monorepo package release preset. * * This preset is optimized for packages within a monorepo, supporting * workspace-specific tagging, conditional publishing, and integration * with changesets workflow for coordinated releases. * * @param options - Configuration options for the monorepo preset * @returns A complete semantic-release configuration for monorepo packages * * @example * ```typescript * // Basic monorepo package * export default monorepoPreset({ * branches: ['main'], * packageName: '@org/package-name' * }) * * // With changesets integration * export default monorepoPreset({ * branches: ['main'], * packageName: '@org/package-name', * changesetsIntegration: true, * pkgRoot: 'packages/my-package' * }) * ``` */ declare function monorepoPreset(options?: BasePresetOptions & { /** * Package root directory for monorepo packages. */ pkgRoot?: string; /** * Package name for release tagging. */ packageName?: string; /** * Enable integration with changesets workflow. * When enabled, optimizes for coordinated releases in monorepos. * @default false */ changesetsIntegration?: boolean; /** * Whether to only publish if there are actual changes. * Useful with changesets to avoid empty releases. * @default true when changesetsIntegration is enabled */ publishOnlyIfChanged?: boolean; /** * Custom release notes template for monorepo context. */ releaseNotesTemplate?: string; }): GlobalConfig; /** * Create a development/testing preset. * * This preset is optimized for development and testing with dry-run enabled * and enhanced debugging capabilities. * * @param options - Base configuration to enhance for development * @returns A development-optimized semantic-release configuration * * @example * ```typescript * // Development preset * export default developmentPreset({ * branches: ['develop', 'feature/*'] * }) * ``` */ declare function developmentPreset(options?: BasePresetOptions): GlobalConfig; /** * Available preset types for easy reference. */ declare const presets: { readonly npm: typeof npmPreset; readonly github: typeof githubPreset; readonly monorepo: typeof monorepoPreset; readonly development: typeof developmentPreset; }; /** * Get a preset by name with type safety. * * @param name - Preset name * @returns The preset function * * @example * ```typescript * const preset = getPreset('npm') * export default preset({ branches: ['main'] }) * ``` */ declare function getPreset(name: T): (typeof presets)[T]; /** * Preset versioning and migration utilities for semantic-release configurations. * * This module provides utilities for managing preset versions, detecting compatibility, * and migrating configurations between different preset versions. */ /** * Preset version information. */ interface PresetVersion { /** * The version identifier (e.g., '1.0.0', '2.1.0'). */ version: string; /** * When this version was released. */ releaseDate: Date; /** * Whether this version contains breaking changes. */ breaking: boolean; /** * Description of changes in this version. */ description: string; /** * Migration path from previous versions. */ migrations?: PresetMigration[]; /** * Compatibility information. */ compatibility: { /** * Minimum semantic-release version required. */ semanticRelease: string; /** * Node.js version requirements. */ node: string; /** * Compatible preset versions that can be mixed. */ presets?: string[]; }; } /** * Preset migration definition. */ interface PresetMigration { /** * Source version range this migration applies to. */ from: string; /** * Target version this migration produces. */ to: string; /** * Whether this migration has breaking changes. */ breaking: boolean; /** * Description of the migration. */ description: string; /** * Migration transform function. */ transform: (config: GlobalConfig) => GlobalConfig; /** * Validation function to check if migration is needed. */ isApplicable?: (config: GlobalConfig) => boolean; /** * Post-migration validation. */ validate?: (config: GlobalConfig) => { valid: boolean; errors?: string[]; }; } /** * Preset registry with version information. */ interface PresetRegistry { /** * Registry of available preset versions. */ presets: Record; /** * Currently active versions. */ current: Record; /** * Migration paths between versions. */ migrations: Record; } /** * Configuration migration result. */ interface MigrationResult { /** * Whether migration was successful. */ success: boolean; /** * Migrated configuration (if successful). */ config?: GlobalConfig; /** * Version after migration. */ version?: string; /** * Migration steps that were applied. */ appliedMigrations?: string[]; /** * Warnings encountered during migration. */ warnings?: string[]; /** * Errors that prevented migration. */ errors?: string[]; } /** * Version compatibility check result. */ interface CompatibilityResult { /** * Whether versions are compatible. */ compatible: boolean; /** * Compatibility issues found. */ issues?: CompatibilityIssue[]; /** * Suggested actions to resolve issues. */ suggestions?: string[]; } /** * Compatibility issue information. */ interface CompatibilityIssue { /** * Type of compatibility issue. */ type: 'version-mismatch' | 'breaking-change' | 'dependency-conflict' | 'feature-removed'; /** * Affected component or feature. */ component: string; /** * Description of the issue. */ description: string; /** * Severity of the issue. */ severity: 'error' | 'warning' | 'info'; /** * Suggested resolution. */ resolution?: string; } /** * Preset versioning manager. */ declare class PresetVersionManager { private readonly registry; constructor(registry?: PresetRegistry); /** * Get available versions for a preset. */ getAvailableVersions(presetName: string): PresetVersion[]; /** * Get current version for a preset. */ getCurrentVersion(presetName: string): string | undefined; /** * Get version information for a specific preset version. */ getVersionInfo(presetName: string, version: string): PresetVersion | undefined; /** * Check compatibility between preset versions. */ checkCompatibility(presetName: string, fromVersion: string, toVersion: string): CompatibilityResult; /** * Migrate a configuration to a newer preset version. */ migrateConfig(config: GlobalConfig, presetName: string, fromVersion: string, toVersion: string): MigrationResult; /** * Find migration path between two versions. */ private findMigrationPath; /** * Compare two version strings. */ private compareVersions; /** * Check if a version is compatible with a requirement range. */ private isVersionCompatible; /** * Check if a version is in a given range. */ private isVersionInRange; } /** * Create a new preset version manager. */ declare function createVersionManager(registry?: PresetRegistry): PresetVersionManager; /** * Default preset version manager instance. */ declare const defaultVersionManager: PresetVersionManager; /** * Check compatibility between preset versions. */ declare function checkPresetCompatibility(presetName: string, fromVersion: string, toVersion: string): CompatibilityResult; /** * Migrate a configuration to a newer preset version. */ declare function migratePresetConfig(config: GlobalConfig, presetName: string, fromVersion: string, toVersion: string): MigrationResult; /** * Get available versions for a preset. */ declare function getPresetVersions(presetName: string): PresetVersion[]; /** * Get current version for a preset. */ declare function getCurrentPresetVersion(presetName: string): string | undefined; /** * TypeScript interfaces for semantic-release plugin context objects. * * This module provides comprehensive type definitions for the context objects * passed to each plugin lifecycle stage, based on the semantic-release * plugin development documentation. */ /** * Plugin configuration type. * Can be any object with string keys and unknown values. */ type PluginConfig$1 = Record; /** * Git commit information. */ interface Commit { /** * Commit object with hash information. */ commit: { /** * Full commit hash. */ long: string; /** * Short commit hash. */ short: string; }; /** * Tree object with hash information. */ tree: { /** * Full tree hash. */ long: string; /** * Short tree hash. */ short: string; }; /** * Commit author information. */ author: { /** * Author name. */ name: string; /** * Author email. */ email: string; /** * Author date (ISO 8601 timestamp). */ date: string; }; /** * Commit committer information. */ committer: { /** * Committer name. */ name: string; /** * Committer email. */ email: string; /** * Committer date (ISO 8601 timestamp). */ date: string; }; /** * Commit message subject. */ subject: string; /** * Commit message body. */ body: string; /** * Commit hash (same as commit.long). */ hash: string; /** * Committer date (ISO 8601 timestamp). */ committerDate: string; /** * Full commit message. */ message: string; /** * Git tags associated with the commit. */ gitTags: string; } /** * Release information. */ interface Release { /** * Release version (without 'v' prefix). */ version: string; /** * Git tag for the release (with 'v' prefix). */ gitTag: string; /** * Release channels. */ channels: readonly string[]; /** * Git commit hash for the release. */ gitHead: string; /** * Release name. */ name?: string; /** * Release notes. */ notes?: string; } /** * Next release information with additional fields. */ interface NextRelease extends Release { /** * Release type ('major', 'minor', 'patch', etc.). */ type: string; /** * Release channel. */ channel: string; } /** * Branch information. */ interface Branch { /** * Branch channel. */ channel: string; /** * Branch tags configuration. */ tags: Record; /** * Branch type. */ type: string; /** * Branch name. */ name: string; /** * Branch range. */ range: string; /** * Branch accept pattern. */ accept: readonly string[]; /** * Whether this is the main branch. */ main: boolean; } /** * CI environment information. */ interface CiEnvironment { /** * Whether running in a CI environment. */ isCi: boolean; /** * Current commit hash. */ commit: string; /** * Current branch name. */ branch: string; /** * Additional CI-specific properties. */ [key: string]: unknown; } /** * Logger interface for plugin logging. */ interface Logger { /** * Log an informational message. */ log: (message: string, ...args: unknown[]) => void; /** * Log a warning message. */ warn: (message: string, ...args: unknown[]) => void; /** * Log a success message. */ success: (message: string, ...args: unknown[]) => void; /** * Log an error message. */ error: (message: string, ...args: unknown[]) => void; /** * Log a debug message. */ debug?: (message: string, ...args: unknown[]) => void; } /** * Base context object shared by all lifecycle hooks. */ interface BaseContext { /** * Current working directory. */ cwd: string; /** * Environment variables. */ env: Record; /** * CI environment information. */ envCi: CiEnvironment; /** * Options passed to semantic-release. */ options: Record; /** * Current branch information. */ branch: Branch; /** * All branches configuration. */ branches: readonly Branch[]; /** * Logger instance for plugin output. */ logger: Logger; /** * Standard output stream. */ stdout: NodeJS.WriteStream; /** * Standard error stream. */ stderr: NodeJS.WriteStream; } /** * Context for verifyConditions lifecycle hook. */ interface VerifyConditionsContext extends BaseContext { } /** * Context for analyzeCommits lifecycle hook. */ interface AnalyzeCommitsContext extends BaseContext { /** * List of commits to analyze. */ commits: readonly Commit[]; /** * Existing releases. */ releases: readonly Release[]; /** * Last release information. */ lastRelease: Release; } /** * Result type for analyzeCommits lifecycle hook. */ type AnalyzeCommitsResult = 'major' | 'premajor' | 'minor' | 'preminor' | 'patch' | 'prepatch' | 'prerelease' | string | null | undefined; /** * Context for verifyRelease lifecycle hook. */ interface VerifyReleaseContext extends BaseContext { /** * Commits for the release. */ commits: readonly Commit[]; /** * Next release information. */ nextRelease: NextRelease; /** * Existing releases. */ releases: readonly Release[]; /** * Last release information. */ lastRelease: Release; } /** * Context for generateNotes lifecycle hook. */ interface GenerateNotesContext extends BaseContext { /** * Commits for the release. */ commits: readonly Commit[]; /** * Next release information. */ nextRelease: NextRelease; /** * Existing releases. */ releases: readonly Release[]; /** * Last release information. */ lastRelease: Release; } /** * Result type for generateNotes lifecycle hook. */ type GenerateNotesResult = string; /** * Context for prepare lifecycle hook. */ interface PrepareContext extends BaseContext { /** * Commits for the release. */ commits: readonly Commit[]; /** * Next release information (with populated notes). */ nextRelease: NextRelease & { notes: string; }; /** * Existing releases. */ releases: readonly Release[]; /** * Last release information. */ lastRelease: Release; } /** * Context for publish lifecycle hook. */ interface PublishContext extends BaseContext { /** * Commits for the release. */ commits: readonly Commit[]; /** * Next release information (with populated notes). */ nextRelease: NextRelease & { notes: string; }; /** * Existing releases. */ releases: readonly Release[]; /** * Last release information. */ lastRelease: Release; } /** * Result type for publish lifecycle hook. */ interface PublishResult { /** * Name of the published release. */ name: string; /** * URL of the published release. */ url: string; } /** * Context for success lifecycle hook. */ interface SuccessContext extends BaseContext { /** * Commits for the release. */ commits: readonly Commit[]; /** * Next release information. */ nextRelease: NextRelease; /** * All releases (populated by publish lifecycle). */ releases: readonly (Release & { name: string; url: string; })[]; /** * Last release information. */ lastRelease: Release; } /** * Context for fail lifecycle hook. */ interface FailContext extends BaseContext { /** * Commits that were being processed. */ commits?: readonly Commit[]; /** * Next release information (if available). */ nextRelease?: NextRelease; /** * Existing releases. */ releases?: readonly Release[]; /** * Last release information (if available). */ lastRelease?: Release; /** * Errors that caused the failure. */ errors: readonly Error[]; } /** * TypeScript interfaces for semantic-release plugin lifecycle hooks. * * This module provides comprehensive type definitions for all semantic-release * plugin lifecycle methods, enabling type-safe plugin development with full * IntelliSense support. */ /** * Base type for all plugin lifecycle hooks. * * Each lifecycle hook receives plugin configuration and a context object * with semantic-release runtime information. */ type BaseLifecycleHook = (pluginConfig: TConfig, context: TContext) => Promise | void; /** * Verify conditions lifecycle hook. * * Called by semantic-release to validate plugin configuration and environment. * Should throw an error if conditions are not met for the plugin to work properly. * * @param pluginConfig - Plugin-specific configuration options * @param context - Semantic-release context with environment and configuration */ type VerifyConditionsHook = BaseLifecycleHook; /** * Analyze commits lifecycle hook. * * Called by semantic-release to determine the type of release based on commits. * Should return the release type or undefined if no release is needed. * * @param pluginConfig - Plugin-specific configuration options * @param context - Semantic-release context with commits and release information * @returns Release type ('major', 'minor', 'patch', etc.) or undefined */ type AnalyzeCommitsHook = (pluginConfig: TConfig, context: AnalyzeCommitsContext) => Promise | AnalyzeCommitsResult; /** * Verify release lifecycle hook. * * Called by semantic-release to validate the release before proceeding. * Should throw an error if the release should be blocked. * * @param pluginConfig - Plugin-specific configuration options * @param context - Semantic-release context with next release information */ type VerifyReleaseHook = BaseLifecycleHook; /** * Generate notes lifecycle hook. * * Called by semantic-release to create release notes. * Should return the release notes as a string. * * @param pluginConfig - Plugin-specific configuration options * @param context - Semantic-release context with commits and release information * @returns Release notes as string */ type GenerateNotesHook = (pluginConfig: TConfig, context: GenerateNotesContext) => Promise | GenerateNotesResult; /** * Prepare lifecycle hook. * * Called by semantic-release to prepare the release (e.g., update files, create changelog). * Should perform any necessary file updates or preparations before publishing. * * @param pluginConfig - Plugin-specific configuration options * @param context - Semantic-release context with next release and notes */ type PrepareHook = BaseLifecycleHook; /** * Publish lifecycle hook. * * Called by semantic-release to publish the release. * Should return publication information with name and URL. * * @param pluginConfig - Plugin-specific configuration options * @param context - Semantic-release context with release information * @returns Publication result with name and URL, or void */ type PublishHook = (pluginConfig: TConfig, context: PublishContext) => Promise | PublishResult | void; /** * Success lifecycle hook. * * Called by semantic-release after a successful release. * Should perform any post-release notifications or cleanup. * * @param pluginConfig - Plugin-specific configuration options * @param context - Semantic-release context with successful releases */ type SuccessHook = BaseLifecycleHook; /** * Fail lifecycle hook. * * Called by semantic-release when the release process fails. * Should perform any error notifications or cleanup. * * @param pluginConfig - Plugin-specific configuration options * @param context - Semantic-release context with error information */ type FailHook = BaseLifecycleHook; /** * Complete plugin lifecycle hooks interface. * * A plugin can implement any subset of these lifecycle hooks. * At least one hook must be implemented for a valid plugin. */ interface PluginLifecycleHooks { /** * Verify conditions step - validates plugin configuration and environment. */ verifyConditions?: VerifyConditionsHook; /** * Analyze commits step - determines the type of release based on commits. */ analyzeCommits?: AnalyzeCommitsHook; /** * Verify release step - validates the release before proceeding. */ verifyRelease?: VerifyReleaseHook; /** * Generate notes step - creates release notes. */ generateNotes?: GenerateNotesHook; /** * Prepare step - prepares the release (e.g., update files, create changelog). */ prepare?: PrepareHook; /** * Publish step - publishes the release. */ publish?: PublishHook; /** * Success step - called after a successful release. */ success?: SuccessHook; /** * Fail step - called when the release process fails. */ fail?: FailHook; } /** * Plugin definition interface for creating custom plugins. * * Combines lifecycle hooks with optional metadata and configuration schema. */ interface PluginDefinition extends PluginLifecycleHooks { /** * Plugin configuration schema (optional, for validation). * Can be a Zod schema, JSON Schema, or any validation schema. */ configSchema?: unknown; /** * Plugin metadata. */ metadata?: { /** * Plugin name (should match package name). */ name: string; /** * Plugin version. */ version: string; /** * Plugin description. */ description?: string; /** * Plugin author. */ author?: string; /** * Plugin homepage URL. */ homepage?: string; /** * Plugin repository URL. */ repository?: string; /** * Plugin keywords for discovery. */ keywords?: readonly string[]; /** * Semantic-release version compatibility. */ semanticReleaseCompatibility?: string; }; } /** * Type guard to check if an object implements plugin lifecycle hooks. */ declare function isValidPlugin(plugin: unknown): plugin is PluginLifecycleHooks; /** * Type for validating plugin implementations. * Ensures at least one lifecycle hook is implemented. */ type ValidPlugin = PluginDefinition & ({ verifyConditions: NonNullable['verifyConditions']>; } | { analyzeCommits: NonNullable['analyzeCommits']>; } | { verifyRelease: NonNullable['verifyRelease']>; } | { generateNotes: NonNullable['generateNotes']>; } | { prepare: NonNullable['prepare']>; } | { publish: NonNullable['publish']>; } | { success: NonNullable['success']>; } | { fail: NonNullable['fail']>; }); type PluginSpec = TSpec extends [ infer TName, (infer TConfig)?, ] ? TName | [TName, TConfig] : never interface CommitAnalyzerPluginConfig { /** * Preset value. */ preset?: string releaseRules?: { type: string scope: string release: string }[] } type CommitAnalyzerPluginSpec = PluginSpec< ['@semantic-release/commit-analyzer', CommitAnalyzerPluginConfig] > interface ReleaseNotesGeneratorPluginConfig { /** * Preset value. */ preset?: string } type ReleaseNotesGeneratorPluginSpec = PluginSpec< ['@semantic-release/release-notes-generator', ReleaseNotesGeneratorPluginConfig] > interface NpmPluginConfig { npmPublish?: boolean } type NpmPluginSpec = PluginSpec<['@semantic-release/npm', NpmPluginConfig]> interface GitHubPluginConfig { /** * Some assets */ assets?: string } type GitHubPluginSpec = PluginSpec<['@semantic-release/github', GitHubPluginConfig]> interface SemanticReleasePlugins { '@semantic-release/commit-analyzer': CommitAnalyzerPluginSpec '@semantic-release/release-notes-generator': ReleaseNotesGeneratorPluginSpec '@semantic-release/npm': NpmPluginSpec '@semantic-release/github': GitHubPluginSpec } /** This is a special exported interface for other packages to declare additional types that should bail out for eslint rules. For example `semantic-release-license` can declare it like so in its `d.ts`: ```ts declare module '@bfra-me/semantic-release' { export interface CustomPluginConfig { /** The path to your license path. \@see [Options](https://github.com/cbhq/semantic-release-license/tree/latest#options) *\/ 'semantic-release-license': { license: { path?: string; } } } } ``` */ interface CustomPluginConfig {} type WrapPlugin = { [K in keyof T]: T[K] extends PluginSpec ? T[K] : PluginSpec<[K, T[K]]> } type CustomPlugins = WrapPlugin interface KnownPlugins extends CustomPlugins, SemanticReleasePlugins {} // Extract the TConfig type from a PluginNameAndConfig type PluginConfig = TSpec extends [ string, infer TConfig, ] ? TConfig : never type PluginName = LiteralUnion type Plugin = TLookup extends keyof KnownPlugins ? PluginSpec<[TLookup, PluginConfig]> : TLookup extends string ? PluginSpec<[TLookup, {[key: string]: unknown}]> : TLookup extends unknown[] ? PluginSpec : never interface CustomExtends {} type KnownExtends = LiteralUnion< '@bfra.me/semantic-release' | 'semantic-release-monorepo' | keyof CustomExtends, string > type Extends = KnownExtends | KnownExtends[] interface SemanticReleaseConfig { extends?: Extends branches: readonly BranchSpec[] | BranchSpec repositoryUrl?: string tagFormat?: string plugins?: Plugin[] dryRun?: boolean ci?: boolean | undefined [name: string]: unknown } /** * Zod schemas for core semantic-release configuration types. */ /** * Schema for branch specification configuration. */ declare const branchSpecSchema: z.ZodUnion; range: z.ZodOptional; prerelease: z.ZodOptional>; }, z.core.$strip>]>; /** * Schema for plugin specification validation. */ declare const pluginSpecSchema: z.ZodUnion], null>]>; /** * Schema for global semantic-release configuration. */ declare const globalConfigSchema: z.ZodObject<{ extends: z.ZodOptional]>>; branches: z.ZodOptional; range: z.ZodOptional; prerelease: z.ZodOptional>; }, z.core.$strip>]>>>; repositoryUrl: z.ZodOptional; tagFormat: z.ZodOptional; plugins: z.ZodOptional], null>]>>>; ci: z.ZodOptional; dryRun: z.ZodOptional; debug: z.ZodOptional; preset: z.ZodOptional; presetConfig: z.ZodOptional>; noCi: z.ZodOptional; }, z.core.$strip>; /** * Zod schemas for semantic-release plugin configurations. */ /** * Schema for @semantic-release/commit-analyzer configuration. */ declare const commitAnalyzerConfigSchema: z.ZodObject<{ preset: z.ZodOptional; config: z.ZodOptional>; parserOpts: z.ZodOptional>; releaseRules: z.ZodOptional; scope: z.ZodOptional; subject: z.ZodOptional; release: z.ZodOptional, z.ZodLiteral<"minor">, z.ZodLiteral<"patch">, z.ZodLiteral]>>; breaking: z.ZodOptional; revert: z.ZodOptional; }, z.core.$strip>>>; presetConfig: z.ZodOptional>; }, z.core.$strip>; /** * Schema for @semantic-release/release-notes-generator configuration. */ declare const releaseNotesGeneratorConfigSchema: z.ZodObject<{ preset: z.ZodOptional; config: z.ZodOptional>; parserOpts: z.ZodOptional>; writerOpts: z.ZodOptional; commitGroupsSort: z.ZodOptional>; commitsSort: z.ZodOptional>; noteGroupsSort: z.ZodOptional>; notesSort: z.ZodOptional>; generateOn: z.ZodOptional>; finalizeContext: z.ZodOptional; debug: z.ZodOptional; reverse: z.ZodOptional; includeDetails: z.ZodOptional; ignoreReverted: z.ZodOptional; doFlush: z.ZodOptional; mainTemplate: z.ZodOptional; headerPartial: z.ZodOptional; commitPartial: z.ZodOptional; footerPartial: z.ZodOptional; partials: z.ZodOptional>; transform: z.ZodOptional>; }, z.core.$strip>>; presetConfig: z.ZodOptional>; linkCompare: z.ZodOptional; linkReferences: z.ZodOptional; host: z.ZodOptional; owner: z.ZodOptional; repository: z.ZodOptional; repoUrl: z.ZodOptional; commit: z.ZodOptional; issue: z.ZodOptional; userUrlFormat: z.ZodOptional; }, z.core.$strip>; /** * Schema for @semantic-release/changelog configuration. */ declare const changelogConfigSchema: z.ZodObject<{ changelogFile: z.ZodOptional; changelogTitle: z.ZodOptional; }, z.core.$strip>; /** * Schema for @semantic-release/npm configuration. */ declare const npmConfigSchema: z.ZodObject<{ npmPublish: z.ZodOptional; pkgRoot: z.ZodOptional; tarballDir: z.ZodOptional; }, z.core.$strip>; /** * Schema for @semantic-release/github configuration. */ declare const githubConfigSchema: z.ZodObject<{ githubUrl: z.ZodOptional; githubApiPathPrefix: z.ZodOptional; proxy: z.ZodOptional]>>; assets: z.ZodOptional; label: z.ZodOptional; }, z.core.$strip>]>>>; successComment: z.ZodOptional]>>; failTitle: z.ZodOptional; failComment: z.ZodOptional]>>; labels: z.ZodOptional, z.ZodLiteral]>>; assignees: z.ZodOptional>; releasedLabels: z.ZodOptional, z.ZodLiteral]>>; addReleases: z.ZodOptional, z.ZodLiteral<"top">, z.ZodLiteral]>>; draftRelease: z.ZodOptional; releaseBodyTemplate: z.ZodOptional; releaseNameTemplate: z.ZodOptional; discussionCategoryName: z.ZodOptional; }, z.core.$strip>; /** * Schema for @semantic-release/git configuration. */ declare const gitConfigSchema: z.ZodObject<{ assets: z.ZodOptional>; message: z.ZodOptional; }, z.core.$strip>; /** * Configuration validation utilities using Zod schemas. * * This module provides comprehensive runtime validation for semantic-release * configurations, ensuring type safety and providing detailed error messages * with actionable suggestions for fixing configuration issues. * * **Key Features:** * - Runtime validation using Zod schemas * - Detailed error messages with path information * - Plugin-specific configuration validation * - Comprehensive configuration validation for complete setups * - Helpful suggestions for common configuration mistakes * * @example * ```typescript * import { validateConfig, validateCompleteConfig } from '@bfra.me/semantic-release/validation' * * // Validate basic configuration * const result = validateConfig({ * branches: ['main'], * plugins: ['@semantic-release/npm'] * }) * * if (!result.success) { * console.error('Validation failed:', result.error.getFormattedErrors()) * } * ``` */ /** * Custom validation error class with detailed error information and formatting. * * Extends the standard Error class to provide additional context about * validation failures, including the original Zod error, path information, * and formatted error messages for display. * * @example * ```typescript * try { * validateConfig(invalidConfig) * } catch (error) { * if (error instanceof ValidationError) { * console.error('Validation failed at:', error.path) * console.error('Errors:', error.getFormattedErrors()) * } * } * ``` */ declare class ValidationError extends Error { /** * The original Zod validation error with detailed issue information. */ readonly zodError: z.ZodError; /** * Optional path identifier for the validation context (e.g., 'global', 'plugin:npm'). */ readonly path?: string; /** * Create a new ValidationError instance. * * @param message - Human-readable error message * @param zodError - The original Zod validation error * @param path - Optional path identifier for context */ constructor(message: string, zodError: z.ZodError, path?: string); /** * Get formatted error messages for display to users. * * Transforms Zod validation issues into human-readable error messages * with path information, making it easier to identify and fix configuration problems. * * @returns Array of formatted error message strings * * @example * ```typescript * const errors = validationError.getFormattedErrors() * // ['branches: Expected array, got string', 'plugins.0: Expected string or array, got object'] * ``` */ getFormattedErrors(): string[]; } /** * Validate a global semantic-release configuration against the schema. * * Performs comprehensive validation of the configuration object structure, * checking types, required fields, and value constraints according to * the semantic-release configuration specification. * * @param config - The configuration object to validate * @returns Success result with validated data or failure result with error details * * @example * ```typescript * // Valid configuration * const result = validateConfig({ * branches: ['main'], * plugins: ['@semantic-release/npm', '@semantic-release/github'] * }) * * if (result.success) { * console.log('Configuration is valid:', result.data) * } * ``` * * @example * ```typescript * // Invalid configuration * const result = validateConfig({ * branches: 'main', // Should be array * plugins: '@semantic-release/npm' // Should be array * }) * * if (!result.success) { * console.error('Validation errors:') * result.error.getFormattedErrors().forEach(error => { * console.error(`- ${error}`) * }) * } * ``` */ declare function validateConfig(config: unknown): { success: true; data: z.infer; } | { success: false; error: ValidationError; }; /** * Validate a plugin configuration by plugin name. * * Validates plugin-specific configuration options against known schemas. * For unknown plugins, validation passes through to allow third-party * plugin configurations that aren't part of the core plugin set. * * @param pluginName - The name of the semantic-release plugin * @param config - The plugin configuration object to validate * @returns Success result with validated data or failure result with error details * * @example * ```typescript * // Validate npm plugin configuration * const result = validatePluginConfig('@semantic-release/npm', { * npmPublish: true, * tarballDir: 'dist' * }) * * if (result.success) { * console.log('npm plugin config is valid') * } * ``` * * @example * ```typescript * // Invalid npm plugin configuration * const result = validatePluginConfig('@semantic-release/npm', { * npmPublish: 'yes' // Should be boolean * }) * * if (!result.success) { * console.error('npm plugin config errors:', result.error.getFormattedErrors()) * } * ``` * * @example * ```typescript * // Unknown plugin (validation passes through) * const result = validatePluginConfig('@custom/plugin', { * customOption: 'value' * }) * // result.success === true (unknown plugins are allowed) * ``` */ declare function validatePluginConfig(pluginName: string, config: unknown): { success: true; data: unknown; } | { success: false; error: ValidationError; }; /** * Validate a complete semantic-release configuration including plugins. */ declare function validateCompleteConfig(config: unknown): { success: true; data: z.infer; } | { success: false; errors: ValidationError[]; }; export { type AnalyzeCommitsContext, type AnalyzeCommitsHook, type AnalyzeCommitsResult, type BaseContext, type BaseLifecycleHook, type BasePresetOptions, type Branch, type CiEnvironment, type Commit, type CompositionOptions, type CustomExtends, DefineConfigOptions, type Environment, type EnvironmentContext, type EnvironmentTransformations, type Extends, type FailContext, type FailHook, type GenerateNotesContext, type GenerateNotesHook, type GenerateNotesResult, GlobalConfig, type KnownExtends, type Logger, type MigrationResult, type NextRelease, type PluginConfig$1 as PluginConfig, type PluginDefinition, type PluginLifecycleHooks, PluginSpec$1 as PluginSpec, type PrepareContext, type PrepareHook, type CompatibilityIssue as PresetCompatibilityIssue, type CompatibilityResult as PresetCompatibilityResult, type PresetMigration, type PresetRegistry, type PresetVersion, PresetVersionManager, type PublishContext, type PublishHook, type PublishResult, type Release, type SemanticReleaseConfig, type SuccessContext, type SuccessHook, type ValidPlugin, ValidationError, type VerifyConditionsContext, type VerifyConditionsHook, type VerifyReleaseContext, type VerifyReleaseHook, applyEnvironmentTransformations, branchSpecSchema, changelog, changelogConfigSchema, checkPresetCompatibility, commitAnalyzer, commitAnalyzerConfigSchema, createVersionManager, defaultVersionManager, defineConfig, defineConfigLegacy, detectEnvironment, developmentPreset, environmentPresets, extendConfig, getCurrentPresetVersion, getEnvironmentTransformations, getPreset, getPresetVersions, git, gitConfigSchema, github, githubConfigSchema, githubPreset, globalConfigSchema, isValidPlugin, mergeConfigs, mergeConfigsWithOptions, migratePresetConfig, monorepoPreset, npm, npmConfigSchema, npmPreset, overrideConfig, pluginPresets, pluginSpecSchema, presets, releaseNotesGenerator, releaseNotesGeneratorConfigSchema, validateCompleteConfig, validateConfig, validatePluginConfig as validatePluginConfigRuntime };