MCPcopy
hub / github.com/vitejs/vite / collectPrereleaseHeaders

Function collectPrereleaseHeaders

scripts/mergeChangelog.ts:124–150  ·  view source on GitHub ↗
(
  releaseLines: string[],
  pkg: string,
)

Source from the content-addressed store, hash-verified

122}
123
124function collectPrereleaseHeaders(
125 releaseLines: string[],
126 pkg: string,
127): string[] {
128 const lines: string[] = []
129 for (const line of releaseLines) {
130 const match = line.match(
131 /^## (?:<small>)?\[([^\]]+)\]\(([^)]+)\)(?: \((\d{4}-\d{2}-\d{2})\))?/,
132 )
133 if (!match) continue
134 const [, ver, compareUrl, date] = match
135 if (!/alpha|beta|rc/.test(ver)) continue
136
137 const tagPrefix = pkg === 'vite' ? 'v' : `${pkg}@`
138 const tag = `${tagPrefix}${ver}`
139 const header = date
140 ? `#### [${ver}](${compareUrl}) (${date})`
141 : `#### [${ver}](${compareUrl})`
142 lines.push(
143 header,
144 '',
145 `See [${ver} changelog](https://github.com/vitejs/vite/blob/${tag}/packages/${pkg}/CHANGELOG.md)`,
146 '',
147 )
148 }
149 return lines
150}
151
152function buildOutputLines(
153 headerLine: string,

Callers 1

mergeChangelog.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected