Skip to content

Commit

Permalink
create relative symlink instead of full path (#6144)
Browse files Browse the repository at this point in the history
Co-authored-by: Mitchell Hamilton <mitchell@hamil.town>
  • Loading branch information
gautamsi and emmatown committed Jul 22, 2021
1 parent b32921e commit 1172e18
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/tidy-poems-tickle.md
@@ -0,0 +1,5 @@
---
'@keystone-next/keystone': patch
---

Changed symlink generation to use relative path instead of absolute. Solves running project in docker when mapping volume.
12 changes: 10 additions & 2 deletions packages/keystone/src/admin-ui/system/generateAdminUI.ts
Expand Up @@ -61,13 +61,21 @@ export const generateAdminUI = async (
if (config.images) {
const storagePath = Path.resolve(config.images.local?.storagePath ?? './public/images');
await fs.mkdir(storagePath, { recursive: true });
await fs.symlink(storagePath, Path.join(publicDirectory, 'images'), 'junction');
await fs.symlink(
Path.relative(publicDirectory, storagePath),
Path.join(publicDirectory, 'images'),
'junction'
);
}

if (config.files) {
const storagePath = Path.resolve(config.files.local?.storagePath ?? './public/files');
await fs.mkdir(storagePath, { recursive: true });
await fs.symlink(storagePath, Path.join(publicDirectory, 'files'), 'junction');
await fs.symlink(
Path.relative(publicDirectory, storagePath),
Path.join(publicDirectory, 'files'),
'junction'
);
}

// Write out the files configured by the user
Expand Down

1 comment on commit 1172e18

@vercel
Copy link

@vercel vercel bot commented on 1172e18 Jul 22, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.