Skip to content

Fix Lychee bin entry point so npx/PATH invocations run - #2669

Merged
chalin merged 2 commits into
docsy:mainfrom
chalin:chalin-m24-lychee-bin-entrypoint-fix-2026-0629
Jun 29, 2026
Merged

chalin merged 2 commits into
docsy:mainfrom
chalin:chalin-m24-lychee-bin-entrypoint-fix-2026-0629

Conversation

@chalin

@chalin chalin commented Jun 29, 2026

Copy link
Copy Markdown
Collaborator
  • Fixes the entry-point guard in the lychee-norm-cache and refcache bins: import.meta.url === `file://${process.argv[1]}` never matches for symlinked bins (npm links bins as symlinks), so npx lychee-norm-cache silently skipped main() and exited 0 — the bins ran only via a direct node path/to/index.mjs, which is how docsy.dev and the unit tests invoke them, so it went unnoticed.
    • Compares real paths instead (realpathSync(argv[1]) vs fileURLToPath(import.meta.url)), so the bins work as the npx / PATH commands npm consumers invoke.
    • Adds a symlink regression test to each bin, skipped on Windows where bin shims are .cmd wrappers rather than symlinks.
  • Corrects scripts/lychee/README.md: the Hugo-module instruction pointed at a go list path with no scripts/; documents adding Docsy as a devDependency (from GitHub until it ships to npm) and running the bins with npx, and fixes the Git-submodule path.

chalin added 2 commits June 29, 2026 16:23
- Fixes the entry-point guard in the `lychee-norm-cache` and `refcache` bins: `import.meta.url === \`file://${process.argv[1]}\`` never matched for symlinked bins (npm links bins as symlinks), so `npx lychee-norm-cache` silently skipped `main()` and exited 0 — the bins ran only via a direct `node path/to/index.mjs`.
- Compares real paths instead (`realpathSync(argv[1])` vs `fileURLToPath(import.meta.url)`), so the bins work as the `npx` / PATH commands that npm consumers actually invoke.
- Adds a symlink regression test to each bin, skipped on Windows where bin shims are `.cmd` wrappers rather than symlinks.
- Replaces the broken Hugo-module instruction (`go list … github.com/google/docsy`, which resolves to a subtree with no `scripts/`): the bins live outside the theme's Hugo module, so Hugo-module sites add Docsy as a devDependency and run the bins with `npx`.
- Documents installing Docsy from GitHub (`github:google/docsy`) until it ships to the npm registry, and corrects the Git-submodule path to `themes/docsy/scripts/…`.
@chalin chalin added this to the 0.16.0 milestone Jun 29, 2026
@chalin chalin added the CI/infra CI & infrastructure label Jun 29, 2026
@chalin
chalin merged commit 394e86f into docsy:main Jun 29, 2026
16 checks passed
@chalin
chalin deleted the chalin-m24-lychee-bin-entrypoint-fix-2026-0629 branch June 29, 2026 20:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI/infra CI & infrastructure

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant