diff options
author | 2023-03-03 23:41:11 +0800 | |
---|---|---|
committer | 2023-03-03 09:41:11 -0600 | |
commit | cd8469947bb63b4233f3459614c5210feac1da96 (patch) | |
tree | 8842c69337beaa8ec6f956ced87d4a91b758c382 | |
parent | 0abd1d3e42cf7bf5efb8c41f37e011b933fb0629 (diff) | |
download | astro-cd8469947bb63b4233f3459614c5210feac1da96.tar.gz astro-cd8469947bb63b4233f3459614c5210feac1da96.tar.zst astro-cd8469947bb63b4233f3459614c5210feac1da96.zip |
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>
Diffstat (limited to '')
-rw-r--r-- | .changeset/lovely-elephants-peel.md | 5 | ||||
-rw-r--r-- | packages/astro/src/core/add/index.ts | 2 |
2 files changed, 6 insertions, 1 deletions
diff --git a/.changeset/lovely-elephants-peel.md b/.changeset/lovely-elephants-peel.md new file mode 100644 index 000000000..7dfe25b9c --- /dev/null +++ b/.changeset/lovely-elephants-peel.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Remove redundant comments when `astro add` update `astro.config.mjs` diff --git a/packages/astro/src/core/add/index.ts b/packages/astro/src/core/add/index.ts index d90075ce7..3abe00db9 100644 --- a/packages/astro/src/core/add/index.ts +++ b/packages/astro/src/core/add/index.ts @@ -507,7 +507,7 @@ async function updateAstroConfig({ let output = await generate(ast); const comment = '// https://astro.build/config'; const defaultExport = 'export default defineConfig'; - output = output.replace(` ${comment}`, ''); + output = output.replace(`\n${comment}`, ''); output = output.replace(`${defaultExport}`, `\n${comment}\n${defaultExport}`); if (input === output) { |