mirror of
https://github.com/withastro/astro.git
synced 2024-12-16 21:46:22 -05:00
Fix an issue where astro build
writes type declaration files to outDir
(#10861)
* Fix an issue where `astro build` also writes type declaration files to `outDir` * Add changeset
This commit is contained in:
parent
a94046588c
commit
b673bc8505
2 changed files with 12 additions and 0 deletions
5
.changeset/curvy-humans-judge.md
Normal file
5
.changeset/curvy-humans-judge.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
"astro": patch
|
||||
---
|
||||
|
||||
Fixes an issue where `astro build` writes type declaration files to `outDir` when it's outside of root directory.
|
|
@ -442,6 +442,13 @@ async function cleanServerOutput(
|
|||
|
||||
// Clean out directly if the outDir is outside of root
|
||||
if (out.toString() !== opts.settings.config.outDir.toString()) {
|
||||
// Remove .d.ts files
|
||||
const fileNames = await fs.promises.readdir(out);
|
||||
await Promise.all(
|
||||
fileNames
|
||||
.filter((fileName) => fileName.endsWith('.d.ts'))
|
||||
.map((fileName) => fs.promises.rm(new URL(fileName, out)))
|
||||
);
|
||||
// Copy assets before cleaning directory if outside root
|
||||
await copyFiles(out, opts.settings.config.outDir, true);
|
||||
await fs.promises.rm(out, { recursive: true });
|
||||
|
|
Loading…
Reference in a new issue