Skip to content

Commit

Permalink
fix: config defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Jun 30, 2022
1 parent b0dc15e commit 9232fdf
Showing 1 changed file with 18 additions and 16 deletions.
34 changes: 18 additions & 16 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,28 @@ export function defineConfig(config: ChangelogOptions) {
return config
}

const defaultConfig: ChangelogOptions = {
scopeMap: {},
types: {
feat: { title: 'πŸš€ Features' },
fix: { title: '🐞 Bug Fixes' },
perf: { title: '🏎 Performance' },
},
titles: {
breakingChanges: '🚨 Breaking Changes',
},
contributors: true,
capitalize: true,
groupByScope: true,
}

export async function resolveConfig(options: ChangelogOptions) {
const { loadConfig } = await import('c12')
const { config } = await loadConfig<ChangelogOptions>({
const config = await loadConfig<ChangelogOptions>({
name: 'changelogithub',
defaults: {
scopeMap: {},
types: {
feat: { title: 'πŸš€ Features' },
fix: { title: '🐞 Bug Fixes' },
perf: { title: '🏎 Performance' },
},
titles: {
breakingChanges: '🚨 Breaking Changes',
},
contributors: true,
capitalize: true,
groupByScope: true,
},
defaults: defaultConfig,
overrides: options,
})
}).then(r => r.config || defaultConfig)

config.from = config.from || await getLastGitTag()
config.to = config.to || await getCurrentGitBranch()
Expand Down

0 comments on commit 9232fdf

Please sign in to comment.