ci(scripts): remove updating changelog.md
This commit is contained in:
@@ -16,8 +16,8 @@ import type { PackageDetails } from './lib/getPackageDetails.js'
|
||||
import { getPackageDetails } from './lib/getPackageDetails.js'
|
||||
import { getPackageRegistryVersions } from './lib/getPackageRegistryVersions.js'
|
||||
import { packagePublishList } from './lib/publishList.js'
|
||||
import { generateReleaseNotes } from './utils/generateReleaseNotes.js'
|
||||
import { getRecommendedBump } from './utils/getRecommendedBump.js'
|
||||
import { updateChangelog } from './utils/updateChangelog.js'
|
||||
|
||||
const filename = fileURLToPath(import.meta.url)
|
||||
const dirname = path.dirname(filename)
|
||||
@@ -124,17 +124,12 @@ async function main() {
|
||||
|
||||
// Preview/Update changelog
|
||||
header(`${logPrefix}📝 Updating changelog...`)
|
||||
const {
|
||||
changelog: changelogContent,
|
||||
releaseNotes,
|
||||
releaseUrl,
|
||||
} = await updateChangelog({
|
||||
const { changelog: changelogContent, releaseUrl } = await generateReleaseNotes({
|
||||
bump,
|
||||
dryRun,
|
||||
toVersion: 'HEAD',
|
||||
fromVersion,
|
||||
openReleaseUrl: true,
|
||||
writeChangelog: changelog,
|
||||
})
|
||||
|
||||
console.log(chalk.green('\nChangelog Preview:\n'))
|
||||
|
||||
@@ -15,7 +15,6 @@ type Args = {
|
||||
bump?: 'major' | 'minor' | 'patch' | 'prerelease'
|
||||
dryRun?: boolean
|
||||
openReleaseUrl?: boolean
|
||||
writeChangelog?: boolean
|
||||
}
|
||||
|
||||
type ChangelogResult = {
|
||||
@@ -33,8 +32,8 @@ type ChangelogResult = {
|
||||
releaseNotes: string
|
||||
}
|
||||
|
||||
export const updateChangelog = async (args: Args = {}): Promise<ChangelogResult> => {
|
||||
const { toVersion = 'HEAD', dryRun, bump, openReleaseUrl, writeChangelog } = args
|
||||
export const generateReleaseNotes = async (args: Args = {}): Promise<ChangelogResult> => {
|
||||
const { toVersion = 'HEAD', dryRun, bump, openReleaseUrl } = args
|
||||
|
||||
const fromVersion =
|
||||
args.fromVersion || execSync('git describe --match "v*" --tags --abbrev=0').toString().trim()
|
||||
@@ -111,14 +110,6 @@ export const updateChangelog = async (args: Args = {}): Promise<ChangelogResult>
|
||||
changelog += `### ⚠️ BREAKING CHANGES\n\n${stringifiedSections.breaking.join('\n')}\n\n`
|
||||
}
|
||||
|
||||
if (writeChangelog) {
|
||||
const changelogPath = 'CHANGELOG.md'
|
||||
const existingChangelog = await fse.readFile(changelogPath, 'utf8')
|
||||
const newChangelog = changelog + '\n\n' + existingChangelog
|
||||
await fse.writeFile(changelogPath, newChangelog)
|
||||
console.log(`Changelog updated at ${changelogPath}`)
|
||||
}
|
||||
|
||||
// Add contributors after writing to file
|
||||
const releaseNotes = changelog + contributors
|
||||
|
||||
@@ -234,10 +225,14 @@ function formatCommitForChangelog(commit: GitCommit, includeBreakingNotes = fals
|
||||
// module import workaround for ejs
|
||||
if (import.meta.url === `file://${process.argv[1]}`) {
|
||||
// This module is being run directly
|
||||
const { fromVersion, toVersion, bump, openReleaseUrl, writeChangelog } = minimist(
|
||||
process.argv.slice(2),
|
||||
)
|
||||
updateChangelog({ bump, fromVersion, toVersion, dryRun: false, openReleaseUrl, writeChangelog })
|
||||
const { fromVersion, toVersion, bump, openReleaseUrl } = minimist(process.argv.slice(2))
|
||||
generateReleaseNotes({
|
||||
bump,
|
||||
fromVersion,
|
||||
toVersion,
|
||||
dryRun: false,
|
||||
openReleaseUrl,
|
||||
})
|
||||
.then(() => {
|
||||
console.log('Done')
|
||||
})
|
||||
Reference in New Issue
Block a user