From 21a46b2a7f57ef90cc3d887a71d41110a4993570 Mon Sep 17 00:00:00 2001 From: Emmanuel Gautier Date: Wed, 23 Oct 2024 11:17:53 +0200 Subject: [PATCH] fix: remove useless assets dir in public dir --- .changeset/gold-actors-greet.md | 5 +++++ packages/adapters/astro/src/index.ts | 10 ++-------- 2 files changed, 7 insertions(+), 8 deletions(-) create mode 100644 .changeset/gold-actors-greet.md diff --git a/.changeset/gold-actors-greet.md b/.changeset/gold-actors-greet.md new file mode 100644 index 00000000..ce643bb9 --- /dev/null +++ b/.changeset/gold-actors-greet.md @@ -0,0 +1,5 @@ +--- +'@galactiks/astro-integration': patch +--- + +remove useless assets dir during build diff --git a/packages/adapters/astro/src/index.ts b/packages/adapters/astro/src/index.ts index c63bf521..b12875d3 100644 --- a/packages/adapters/astro/src/index.ts +++ b/packages/adapters/astro/src/index.ts @@ -5,7 +5,6 @@ import { lstatSync, mkdirSync, readdirSync, - rmdirSync, symlinkSync, unlinkSync, } from 'node:fs'; @@ -53,7 +52,6 @@ export default function createPlugin(_: GalactiksOptions): AstroIntegration { let assetsPath: string; let publicPath: string; - let publicAssetsPath: string; return { name: '@galactiks/astro-integration', @@ -76,11 +74,9 @@ export default function createPlugin(_: GalactiksOptions): AstroIntegration { galactiksConfig = setConfig('content.assets', assetsPath); publicPath = fileURLToPath(config.publicDir); + mkdirSync(publicPath, { recursive: true }) galactiksConfig = setConfig('content.public', publicPath); - publicAssetsPath = join(publicPath, 'assets'); - mkdirSync(publicAssetsPath, { recursive: true }); - updateConfig({ site: galactiksConfig.webManifest.start_url, trailingSlash, @@ -94,11 +90,10 @@ export default function createPlugin(_: GalactiksOptions): AstroIntegration { removeDirSymbolicLinks(assetsPath); removeDirSymbolicLinks(publicPath); - removeDirSymbolicLinks(publicAssetsPath); symlinkDir(assetsPath, galactiksConfigContentAssets); symlinkDir(publicPath, galactiksConfigContentPublic); - symlinkDir(publicAssetsPath, galactiksConfigContentAssets); + symlinkDir(publicPath, galactiksConfigContentAssets); if (command === 'dev') { addWatchFile(galactiksConfig.content.generated); @@ -109,7 +104,6 @@ export default function createPlugin(_: GalactiksOptions): AstroIntegration { 'astro:build:done': () => { removeDirSymbolicLinks(assetsPath); - rmdirSync(publicAssetsPath, { recursive: true }); removeDirSymbolicLinks(publicPath); }, },