Skip to content

Commit

Permalink
make changelogPath work with irregular changelog names
Browse files Browse the repository at this point in the history
  • Loading branch information
silesky committed Jul 24, 2022
1 parent 231aeba commit b356bef
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions scripts/create-release-from-tags/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,20 @@ const getChangelogPath = (packageName: string): string | undefined => {
if (!result)
throw new Error(`could not find package with name: ${packageName}.`)

const myPath = path.join(result.location, 'CHANGELOG.MD')
const pathExists = fs.existsSync(myPath)
let changelogPath = undefined
for (const fileName of ['CHANGELOG.MD', 'CHANGELOG.md']) {
if (changelogPath) break
const myPath = path.join(result.location, fileName)
const pathExists = fs.existsSync(myPath)
if (pathExists) {
changelogPath = myPath
}
}

if (pathExists) {
return myPath
if (changelogPath) {
return changelogPath
} else {
console.log(`could not find path: ${myPath}`)
console.log(`could not find changelog path for ${result.location}`)
}
}

Expand Down

0 comments on commit b356bef

Please sign in to comment.