import type { Options as SemRelOptions , PluginSpec } from 'semantic-release' ; import type { Options } from './type' ; import commitAnalyzer from './plugins/commitAnalyzer' ; import git from './plugins/git' ; import github from './plugins/github' ; import npm from './plugins/npm' ; export type { ReleaseRule , Options } from './type' ; const createConfig = ( options ? ) : SemRelOptions => { const opts = { changelogTitle : '# Changelog' , changelogFile : 'CHANGELOG.md' , enableNPM : true , enableGithub : true , ... options , } ; const { npmPublish , pkgRoot , tarballDir } = opts ; const npmConfig = npm ( { npmPublish , pkgRoot , tarballDir } ) ; const { githubUrl , proxy , releasedLabels , failTitle , githubApiPathPrefix , labels , failComment , assignees , addReleases , githubAssets , } = opts ; const githubConfig = github ( { githubUrl , proxy , releasedLabels , failTitle , githubApiPathPrefix , labels , failComment , assignees , addReleases , githubAssets , } ) ; const plugins = [ commitAnalyzer ( opts . releaseRules ) , [ '@semantic-release/release-notes-generator' , { config : 'conventional-changelog-gitmoji-config' , } , ] , [ '@semantic-release/changelog' , { changelogFile : opts . changelogFile , changelogTitle : opts . changelogTitle , } , ] , opts . enableNPM ? npmConfig : '' , opts . enableGithub ? githubConfig : '' , git ( options ) , ] ; return { plugins : plugins . filter ( ( p ) => ! ! p ) , } ; } ; export default createConfig ;