@bfra.me/semantic-release
Version:
Semantic Release shareable configuration and plugins for bfra.me.
161 lines (157 loc) • 4.62 kB
TypeScript
import { D as DefineConfigOptions, G as GlobalConfig } from '../define-config-DZx0_5qY.js';
import 'type-fest';
/**
* Factory functions for JavaScript configuration files.
*
* This module provides factory functions specifically designed for use in
* JavaScript configuration files (release.config.js, release.config.mjs)
* with full TypeScript support and IntelliSense.
*
* @example
* ```javascript
* // release.config.mjs
* import {createConfig} from '@bfra.me/semantic-release/factories'
*
* export default createConfig({
* branches: ['main'],
* plugins: [
* '@semantic-release/commit-analyzer',
* '@semantic-release/release-notes-generator'
* ]
* })
* ```
*/
/**
* Configuration factory options for JavaScript config files.
*
* These options are specifically designed for JavaScript configuration files
* where you want to create a semantic-release configuration with enhanced features.
*/
interface CreateConfigOptions extends DefineConfigOptions {
/**
* The configuration name for debugging and logging.
*/
name?: string;
/**
* Description of this configuration for documentation.
*/
description?: string;
/**
* Whether to freeze the configuration object to prevent modifications.
* @default false
*/
freeze?: boolean;
}
/**
* Create a semantic-release configuration for JavaScript config files.
*
* This function is specifically designed for use in JavaScript configuration files
* like release.config.mjs where you need full TypeScript support and IntelliSense.
*
* @param config - The semantic-release configuration object
* @param options - Creation options for enhanced functionality
* @returns The configured semantic-release configuration
*
* @example
* ```javascript
* // release.config.mjs
* import {createConfig} from '@bfra.me/semantic-release/factories'
*
* export default createConfig({
* branches: ['main', 'develop'],
* plugins: [
* '@semantic-release/commit-analyzer',
* '@semantic-release/release-notes-generator',
* '@semantic-release/npm',
* '@semantic-release/github'
* ]
* })
* ```
*
* @example
* ```javascript
* // release.config.mjs with environment-specific settings
* import {createConfig} from '@bfra.me/semantic-release/factories'
*
* export default createConfig({
* branches: ['main'],
* plugins: ['@semantic-release/commit-analyzer']
* }, {
* name: 'my-project-release',
* environment: process.env.NODE_ENV === 'development' ? 'development' : 'production',
* validate: true
* })
* ```
*
* @example
* ```javascript
* // release.config.mjs with frozen configuration
* import {createConfig} from '@bfra.me/semantic-release/factories'
*
* export default createConfig({
* branches: ['main'],
* plugins: ['@semantic-release/commit-analyzer']
* }, {
* freeze: true,
* description: 'Production release configuration'
* })
* ```
*/
declare function createConfig<T extends GlobalConfig>(config: T, options?: CreateConfigOptions): T;
declare function createMinimalConfig(options?: {
/**
* Branches to release from.
* @default ['main']
*/
branches?: GlobalConfig['branches'];
/**
* Repository URL if not auto-detected.
*/
repositoryUrl?: string;
/**
* Custom tag format.
* @default 'v${version}'
*/
tagFormat?: string;
/**
* Enable dry-run mode.
* @default false
*/
dryRun?: boolean;
}): GlobalConfig;
/**
* Create a development-friendly semantic-release configuration.
*
* This factory creates a configuration optimized for development workflow
* with dry-run enabled and enhanced logging.
*
* @param baseConfig - Base configuration to enhance for development
* @param options - Development-specific options
* @param options.debug - Enable debug logging (default: true)
* @param options.forceDryRun - Force dry-run mode (default: true)
* @returns Development-optimized configuration
*
* @example
* ```javascript
* // release.config.dev.mjs
* import {createDevConfig} from '@bfra.me/semantic-release/factories'
*
* export default createDevConfig({
* branches: ['develop'],
* plugins: ['@semantic-release/commit-analyzer']
* })
* ```
*/
declare function createDevConfig<T extends GlobalConfig>(baseConfig: T, options?: {
/**
* Enable debug logging.
* @default true
*/
debug?: boolean;
/**
* Force dry-run mode.
* @default true
*/
forceDryRun?: boolean;
}): T;
export { type CreateConfigOptions, createConfig, createDevConfig, createMinimalConfig };