Skip to content

Commit cd84699

Browse files
Remove redundant comments when astro add update astro.config.mjs (#6412)
* Remove redundant comments when update * add \n --------- Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com>
1 parent 0abd1d3 commit cd84699

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'astro': patch
3+
---
4+
5+
Remove redundant comments when `astro add` update `astro.config.mjs`

packages/astro/src/core/add/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@ async function updateAstroConfig({
507507
let output = await generate(ast);
508508
const comment = '// https://astro.build/config';
509509
const defaultExport = 'export default defineConfig';
510-
output = output.replace(` ${comment}`, '');
510+
output = output.replace(`\n${comment}`, '');
511511
output = output.replace(`${defaultExport}`, `\n${comment}\n${defaultExport}`);
512512

513513
if (input === output) {

0 commit comments

Comments
 (0)