mirror of
https://github.com/withastro/astro.git
synced 2024-12-16 21:46:22 -05:00
small fix to an incorrect check (#10300)
This commit is contained in:
parent
cb00c8b692
commit
725f83fdb9
1 changed files with 5 additions and 5 deletions
|
@ -72,12 +72,12 @@ export function fileURLIntegration(): AstroIntegration {
|
|||
unlinks.push(fs.promises.unlink(url));
|
||||
}
|
||||
await Promise.all(unlinks);
|
||||
// Delete the assets directory if it is empty.
|
||||
// NOTE(fks): Ignore errors here because this is expected to fail
|
||||
// if the directory contains files, or if it does not exist.
|
||||
// If it errors for some unknown reason, it's not a big deal.
|
||||
const assetDir = new URL(config.build.assets, config.outDir);
|
||||
const assetFiles = await fs.promises.readdir(assetDir);
|
||||
if (!assetFiles.length) {
|
||||
// Directory is empty, delete it.
|
||||
await fs.promises.rmdir(assetDir);
|
||||
}
|
||||
await fs.promises.rmdir(assetDir).catch(() => []);
|
||||
} else {
|
||||
// Move files back over to the dist output path
|
||||
const moves: Promise<unknown>[] = [];
|
||||
|
|
Loading…
Reference in a new issue