@bfra.me/semantic-release
Version:
Semantic Release shareable configuration and plugins for bfra.me.
89 lines (87 loc) • 2.48 kB
JavaScript
import {
defineConfig
} from "./chunk-2II77SNF.js";
// src/config/factories.ts
function createConfig(config, options = {}) {
const { name, description, freeze = false, ...defineOptions } = options;
const enhancedConfig = defineConfig(config, defineOptions);
if (name != null && name.length > 0 || description != null && description.length > 0) {
Object.defineProperty(enhancedConfig, "__metadata", {
value: { name, description },
enumerable: false,
writable: false,
configurable: false
});
}
if (freeze) {
return Object.freeze(enhancedConfig);
}
return enhancedConfig;
}
var DEFAULT_TAG_FORMAT = "v${version}";
function createMinimalConfig(options = {}) {
const {
branches = ["main"],
repositoryUrl,
tagFormat = DEFAULT_TAG_FORMAT,
dryRun = false
} = options;
const config = {
branches,
tagFormat,
dryRun,
plugins: [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/npm",
"@semantic-release/github"
]
};
if (repositoryUrl != null && repositoryUrl.length > 0) {
config.repositoryUrl = repositoryUrl;
}
return createConfig(config, {
name: "minimal-config",
description: "Minimal semantic-release configuration with sensible defaults",
validate: true
});
}
function createDevConfig(baseConfig, options = {}) {
const { debug = true, forceDryRun = true } = options;
const devConfig = {
...baseConfig,
// Force dry-run in development
dryRun: forceDryRun || baseConfig.dryRun,
// Disable CI checks for development
ci: false
};
if (debug && devConfig.plugins) {
const hasDebug = devConfig.plugins.some(
(plugin) => typeof plugin === "string" ? plugin.includes("debug") : Array.isArray(plugin) && plugin[0].includes("debug")
);
if (!hasDebug) {
devConfig.plugins = [
...devConfig.plugins,
[
"@semantic-release/exec",
{
verifyReleaseCmd: 'echo "Debug: Verifying release..."',
publishCmd: 'echo "Debug: Publishing release..."'
}
]
];
}
}
return createConfig(devConfig, {
name: "development-config",
description: "Development-optimized semantic-release configuration",
environment: "development",
validate: true
});
}
export {
createConfig,
createMinimalConfig,
createDevConfig
};
//# sourceMappingURL=chunk-XM5DVH32.js.map