feat: add support for monorepos with symlink folders #122
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #121
Details
This PR adds support for mono-repos that uses symlinks to link 'package dependencies'.
The current behaviour of
mkdocs-monorepo-plugin
is to resolve the!include
and*includes
folders to the absolute path by using theresolve()
path method. The side-effect is though that this method also resolves symlinks, which causes compatibility issues with mono-repos that utilise symlinks to link package dependencies. For examplepnpm
typescript / javascript mono-repos.By switching the path
.resolve()
method to.absolute()
the nav paths are still resolved to absolute folders in 'local' context without resolving the symlinks.How it was tested
Manual tested using the folder structure as outlined in #121
Impact
This is a small breaking change in the folder resolve behaviour, nav paths are still resolved absolute with the exception that links are not resolved to the final target anymore.
Based on the current plugin setup I expect the impact to be limited. The current plugin version now blocks compilation (given L175) if that final path resolves to a folder outside of the project directory. So I expect in practise a limited number of projects would be using symlinks today. If needed this could be put behind a plugin feature flag though.