diff options
author | 2024-03-04 03:01:20 -0800 | |
---|---|---|
committer | 2024-03-04 03:01:20 -0800 | |
commit | 725f83fdb936cedf5dc720b87a148323bb92b733 (patch) | |
tree | 9f0598f9a6569f3a941968d87ab431fbdae238aa | |
parent | cb00c8b6927242369debe92ad2bc7e791616696a (diff) | |
download | astro-725f83fdb936cedf5dc720b87a148323bb92b733.tar.gz astro-725f83fdb936cedf5dc720b87a148323bb92b733.tar.zst astro-725f83fdb936cedf5dc720b87a148323bb92b733.zip |
small fix to an incorrect check (#10300)
-rw-r--r-- | packages/db/src/core/integration/file-url.ts | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/packages/db/src/core/integration/file-url.ts b/packages/db/src/core/integration/file-url.ts index 06bc67de1..72e49004e 100644 --- a/packages/db/src/core/integration/file-url.ts +++ b/packages/db/src/core/integration/file-url.ts @@ -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>[] = []; |