Skip to content

Commit

Permalink
Merge pull request #237 from thegalactiks/fix-assets-symlink
Browse files Browse the repository at this point in the history
fix(@galactiks/astro-integration): add assets and public symlinks to …
  • Loading branch information
emmanuelgautier authored Oct 15, 2024
2 parents b39ab46 + 036543f commit 04e5876
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/wicked-lemons-taste.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@galactiks/astro-integration': patch
---

fix assets symlinks
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions examples/contentlayer/content/articles/en/article.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ dateModified: 1970-01-01
datePublished: 1970-01-01
keywords:
- keyword
image:
name: Galactiks Icon
contentUrl: /assets/galactiks-icon.png
---

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
Expand Down
3 changes: 3 additions & 0 deletions examples/contentlayer/content/articles/fr/article.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ dateModified: 1970-01-01
datePublished: 1970-01-01
keywords:
- mot-clé
image:
name: Galactiks Icon
contentUrl: /assets/galactiks-icon.png
---

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
Expand Down
5 changes: 4 additions & 1 deletion packages/adapters/astro/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const symlinkDir = (targetPath: string, path: string) =>
.filter((filename) => !filename.startsWith('.'))
.map((filename) => [join(targetPath, filename), join(path, filename)])
.filter(([target]) => !existsSync(target))
.forEach(([target, path]) => symlinkSync(target, path));
.forEach(([target, path]) => symlinkSync(path, target));

const removeDirSymbolicLinks = (path: string) =>
readdirSync(path)
Expand Down Expand Up @@ -76,6 +76,9 @@ export default function createPlugin(_: GalactiksOptions): AstroIntegration {
},
});

removeDirSymbolicLinks(assetsPath);
removeDirSymbolicLinks(publicPath);

symlinkDir(assetsPath, galactiksConfigContentAssets);
symlinkDir(publicPath, galactiksConfigContentPublic);

Expand Down

0 comments on commit 04e5876

Please sign in to comment.