Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
logger.warn('Feel free to open issues or PR into gitmoji-changelog')
logger.warn('\t> https://github.com/frinyvonnick/gitmoji-changelog')
}
try {
switch (options.format) {
case 'json': {
const changelog = await getChangelog(options, projectInfo)
logMetaData(changelog)
fs.writeFileSync(options.output, JSON.stringify(changelog))
break
}
default: {
const lastVersion = await getLatestVersion(options.output)
const newOptions = set(options, 'meta.lastVersion', lastVersion)
// Handle the case where changelog file exist but there isn't a previous version
if (options.mode === 'update' && !lastVersion) {
newOptions.mode = 'init'
fs.unlinkSync(options.output)
}
const changelog = await getChangelog(newOptions, projectInfo)
logMetaData(changelog)
await buildMarkdownFile(changelog, newOptions)
}
}
logger.success(`changelog updated into ${options.output}`)