fork of hey-api/openapi-ts because I need some additional things
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

chore: fix changelog

Lubos e8e8842b 2a192e4a

+18 -26
+2 -18
.changeset/changelog.js
··· 103 103 const [firstLine, ...rest] = replacedChangelog.split('\n'); 104 104 const restSummary = rest.join('\n').trim(); 105 105 106 - // Post-process code blocks: replace triple backtick code blocks with indented code blocks 107 - function convertCodeBlocks(text) { 108 - // Replace ```lang\n...\n``` with indented code 109 - return text.replace(/```(\w*)\n([\s\S]*?)```/g, (match, lang, code) => { 110 - const langComment = lang ? `// ${lang}\n` : ''; 111 - return ( 112 - '\n' + 113 - langComment + 114 - code 115 - .split('\n') 116 - .map((line) => ' ' + line) 117 - .join('\n') + 118 - '\n' 119 - ); 120 - }); 121 - } 122 - 106 + // No code block conversion: preserve original triple backtick code blocks and indentation 123 107 let releaseLine = `\n- ${firstLine}${metadata}`; 124 108 if (restSummary) { 125 - releaseLine += '\n\n' + convertCodeBlocks(restSummary); 109 + releaseLine += '\n\n' + restSummary; 126 110 } 127 111 return releaseLine; 128 112 },
+16 -8
__tests__/changelog.test.ts
··· 134 134 ); 135 135 }); 136 136 137 - it('places metadata on the first line and does not append it after code blocks', async () => { 137 + it('places metadata on the first line and preserves markdown code blocks', async () => { 138 138 const summary = [ 139 139 'refactor(config): replace `off` with null to disable options', 140 140 '', ··· 167 167 expect(line).toMatch( 168 168 /^\n- refactor\(config\): replace `off` with null to disable options \(\[#1613\]\(https:\/\/github.com\/hey-api\/openapi-ts\/pull\/1613\)\) \(\[`fcdd73b`\]\(https:\/\/github.com\/hey-api\/openapi-ts\/commit\/fcdd73b816d74babf47e6a1f46032f5b8ebb4b48\)\) by \[@someone\]\(https:\/\/github.com\/someone\)/, 169 169 ); 170 - // There should be no metadata at the end 171 - expect(line.trim().endsWith('```')).toBe(false); 172 170 // Should not contain quadruple backticks 173 171 expect(line).not.toContain('````'); 174 - // Should contain indented code block 175 - expect(line).toContain(' export default {'); 172 + // Should contain a markdown code block 173 + expect(line).toContain('```js\nexport default {'); 174 + expect(line).toContain( 175 + ' input: "hey-api/backend", // sign up at app.heyapi.dev', 176 + ); 177 + expect(line).toContain(' output: {'); 178 + expect(line).toContain(' format: null,'); 179 + expect(line).toContain(' lint: null,'); 180 + expect(line).toContain(' path: "src/client",'); 181 + expect(line).toContain(' tsConfigPath: null,'); 182 + expect(line).toContain(' },'); 183 + expect(line).toContain('};'); 184 + expect(line).toContain('```'); 176 185 }); 177 186 178 187 it('converts multiple code blocks and preserves non-code content', async () => { ··· 198 207 const line = await changelog.getReleaseLine(changeset, 'minor', { 199 208 repo: 'hey-api/openapi-ts', 200 209 }); 201 - expect(line).toContain(' console.log(1);'); 202 - expect(line).toContain(' console.log(2);'); 210 + expect(line).toContain('```js\nconsole.log(1);\n```'); 211 + expect(line).toContain('```ts\nconsole.log(2);\n```'); 203 212 expect(line).toContain('Some text.'); 204 - expect(line).not.toContain('```'); 205 213 }); 206 214 207 215 describe.each(['author', 'user'])(