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

Function buildOutputLines

scripts/mergeChangelog.ts:152–181  ·  view source on GitHub ↗
(
  headerLine: string,
  categories: Map<string, string[]>,
  prereleaseLines: string[],
)

Source from the content-addressed store, hash-verified

150}
151
152function buildOutputLines(
153 headerLine: string,
154 categories: Map<string, string[]>,
155 prereleaseLines: string[],
156): string[] {
157 const hasUnknownCategories = [...categories.keys()].filter(
158 (c) => !CATEGORY_ORDER.includes(c),
159 )
160 if (hasUnknownCategories.length > 0) {
161 throw new Error(
162 `Unknown categories found: ${hasUnknownCategories.join(', ')}`,
163 )
164 }
165
166 const outputLines: string[] = [headerLine, '']
167 for (const category of CATEGORY_ORDER) {
168 const items = categories.get(category)
169 if (items && items.length > 0) {
170 outputLines.push(category, '')
171 outputLines.push(...items)
172 outputLines.push('')
173 }
174 }
175
176 if (prereleaseLines.length > 0) {
177 outputLines.push('### Beta Changelogs', '', ...prereleaseLines)
178 }
179
180 return outputLines
181}
182
183const filePath = path.resolve(
184 // eslint-disable-next-line n/no-unsupported-features/node-builtins

Callers 1

mergeChangelog.tsFile · 0.85

Calls 1

getMethod · 0.45

Tested by

no test coverage detected