mirror of
https://github.com/withastro/astro.git
synced 2025-01-06 22:10:10 -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));
|
unlinks.push(fs.promises.unlink(url));
|
||||||
}
|
}
|
||||||
await Promise.all(unlinks);
|
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 assetDir = new URL(config.build.assets, config.outDir);
|
||||||
const assetFiles = await fs.promises.readdir(assetDir);
|
await fs.promises.rmdir(assetDir).catch(() => []);
|
||||||
if (!assetFiles.length) {
|
|
||||||
// Directory is empty, delete it.
|
|
||||||
await fs.promises.rmdir(assetDir);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
// Move files back over to the dist output path
|
// Move files back over to the dist output path
|
||||||
const moves: Promise<unknown>[] = [];
|
const moves: Promise<unknown>[] = [];
|
||||||
|
|
Loading…
Reference in a new issue