fix(generator): resolve kompendium.json symlink to an absolute path#9
Merged
Merged
Conversation
In watch mode the generator symlinks the public `kompendium.json` (under `publicPath`, e.g. `www/`) to the real file in the config folder (under `path`, e.g. `.kompendium/`). The link was created with a relative source, which the OS resolves relative to the link's own directory (`publicPath`) rather than the cwd -- producing a broken link (`www/.kompendium/kompendium.json`) and a 404 for the docs data on every dev-server reload. Resolve the source to an absolute path so the link is valid regardless of its location. Keeps the native `fs.symlink` (no reintroduction of the removed `lnk`/`glob` dependency). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What
In watch mode the docs generator symlinks the public
kompendium.json(underpublicPath, e.g.www/) to the real file in the config folder (underpath, e.g..kompendium/). The link was created with a relative source:A relative symlink target is resolved relative to the link's own directory (
www/), not the cwd — sowww/kompendium.jsonpoints to the nonexistentwww/.kompendium/kompendium.json. The result is a broken link and a 404 for the docs data on every dev-server reload.Fix
Resolve the source to an absolute path so the link is valid regardless of its location:
Keeps the native
fs.symlink— does not reintroduce thelnk→rimraf@2→glob@7dependency chain that was deliberately removed.Background
The regression was introduced by the
lnk→fs.symlinkswap in jgroth#183 (update-deps), which reachedlimeas1359554and shipped in published 1.2.0. Versions ≤ 1.1.2 usedlnk(...)and were unaffected. The same one-line fix has also been pushed to the upstreamupdate-depsbranch (jgroth#183).Verification
npm run build✅ (generator compiles)www/kompendium.jsonsymlink resolves to the 5 MB docs file, where the relative one was broken.