Skip to content

Commit

Permalink
fix: remove useless assets dir in public dir
Browse files Browse the repository at this point in the history
  • Loading branch information
emmanuelgautier committed Oct 23, 2024
1 parent 6a8ef6b commit ffaa6f6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .changeset/gold-actors-greet.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@galactiks/astro-integration': patch
---

remove useless assets dir during build
8 changes: 2 additions & 6 deletions packages/adapters/astro/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,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,
Expand All @@ -94,11 +92,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);
Expand All @@ -109,7 +106,6 @@ export default function createPlugin(_: GalactiksOptions): AstroIntegration {

'astro:build:done': () => {
removeDirSymbolicLinks(assetsPath);
rmdirSync(publicAssetsPath, { recursive: true });
removeDirSymbolicLinks(publicPath);
},
},
Expand Down

0 comments on commit ffaa6f6

Please sign in to comment.