Skip to content

fix(generator): resolve kompendium.json symlink to an absolute path#9

Merged
adrianschmidt merged 1 commit into
limefrom
fix/kompendium-json-symlink-absolute-path
Jun 18, 2026
Merged

fix(generator): resolve kompendium.json symlink to an absolute path#9
adrianschmidt merged 1 commit into
limefrom
fix/kompendium-json-symlink-absolute-path

Conversation

@adrianschmidt

Copy link
Copy Markdown

What

In watch mode the docs 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:

await symlink(`${config.path}/kompendium.json`, `${config.publicPath}/kompendium.json`);
// symlink(".kompendium/kompendium.json", "www/kompendium.json")

A relative symlink target is resolved relative to the link's own directory (www/), not the cwd — so www/kompendium.json points to the nonexistent www/.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:

await symlink(resolve(source), target);

Keeps the native fs.symlink — does not reintroduce the lnkrimraf@2glob@7 dependency chain that was deliberately removed.

Background

The regression was introduced by the lnkfs.symlink swap in jgroth#183 (update-deps), which reached lime as 1359554 and shipped in published 1.2.0. Versions ≤ 1.1.2 used lnk(...) and were unaffected. The same one-line fix has also been pushed to the upstream update-deps branch (jgroth#183).

Verification

  • npm run build ✅ (generator compiles)
  • Confirmed empirically that an absolute www/kompendium.json symlink resolves to the 5 MB docs file, where the relative one was broken.

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>
@adrianschmidt adrianschmidt marked this pull request as ready for review June 18, 2026 10:17
@adrianschmidt adrianschmidt merged commit 39642bd into lime Jun 18, 2026
4 checks passed
@adrianschmidt adrianschmidt deleted the fix/kompendium-json-symlink-absolute-path branch June 18, 2026 10:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant