Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Search is broken with typedoc 0.17.4 #8

Closed
WilliamJns opened this issue Apr 26, 2020 · 5 comments
Closed

Search is broken with typedoc 0.17.4 #8

WilliamJns opened this issue Apr 26, 2020 · 5 comments
Labels

Comments

@WilliamJns
Copy link

WilliamJns commented Apr 26, 2020

Thanks for this incredible library 👍

Search terms

Im using TypeDoc v0.17.3 with the latest version of the typedoc-plugin-pages in my project.

It seems that the typedoc-plugin-pages plugin is only compatible with TypeDoc v0.16.x and when version TypeDoc v0.17.x is used, due to a change in the structure of the search file by TypeDoc team, this library will encounter an error during build time.

/path/typedoc-plugin-pages/dist/plugin/search/search-manager.js:35
    throw new Error(`Failed to populate search index. ${e.message}`);
    ^
Error: Failed to populate search index. Failed to parse search index. Failed to read search.js file. ENOENT: no such file or directory, open '/Users/williamj/Works/Erpire/Erpire Panel Engine/docs/assets/js/search.js'
    at SearchManager.populateSearchIndex (/path/typedoc-plugin-pages/dist/plugin/search/search-manager.js:35:19)
    at PagesPlugin._renderEndEventHandler (/path/typedoc-plugin-pages/dist/plugin/plugin.js:98:29)
    at triggerEvents (/path/typedoc/dist/lib/utils/events.js:128:43)
    at triggerApi (/path/typedoc/dist/lib/utils/events.js:110:13)
    at eventsApi (/path/typedoc/dist/lib/utils/events.js:21:18)
    at Renderer.trigger (/path/typedoc/dist/lib/utils/events.js:264:13)
    at Renderer.render (/path/typedoc/dist/lib/output/renderer.js:39:18)
    at CliApplication.generateDocs (/path/typedoc/dist/lib/application.js:91:23)
    at CliApplication.bootstrap (/path/typedoc/dist/lib/cli.js:48:26)
    at Object.<anonymous> (/path/typedoc/bin/typedoc:5:

I will present the solution that I have found to solve this problem in a new pull request.

Expected Behavior

Handel both v0.16.x and v0.17.x by checking if search.json is founded on the docs/assets/js path.

Steps to reproduce the bug

  1. Install dependencies
npm install --save-dev typedoc@0.17.4 typedoc-plugin-pages@1.0.0 typedoc-plugin-external-module-name
  1. Config typedoc.json
{
  "name": "Compony name",
  "out": "docs",
  "target": "ES5",
  "mode": "file",
  "includeDeclarations": false,
  "ignoreCompilerErrors": true,
  "disableOutputCheck": true,
  "listInvalidSymbolLinks": false,
  "logger": "none",
  "hideGenerator": true,
  "inputFiles": ["./src"],
  "media": "guides/static",
  "readme": "guides/index.md",
  "theme": "node_modules/@compony/typedoc-theme/theme",
  "pages": "guides/pages.json"
}
  1. Config guides/pages.json
{
  "groups": [...],
  "listInvalidPageLinks": false,
  "output": "guides",
  "reflectionNavigationTitle": "Development API",
  "replaceGlobalsPage": true,
  "separatePluginNavigation": true,
  "source": "guides"
}
  1. Build using typedoc CLI
rm -rf docs && npm run typedoc

Environment

  • typedoc-plugin-pages version: 1.0.0
  • Typedoc version: 0.17.3
  • TypeScript version: 3.8.3
  • Node.js version: 12.16.1
  • OS: MacOS Catalina 10.15.4
@github-actions
Copy link

github-actions bot commented May 7, 2020

🎉 This issue has been resolved in version 1.0.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@mipatterson
Copy link
Owner

@WilliamJns, thanks for the PR. I ended up resolving this issue in a different way. I want to allow users to use this plugin with their own themes so instead of locking the plugin into the old way that TypeDoc generated search indexes (building them on the fly in the browser), I updated the plugin to dynamically detect the version of TypeDoc being used and use the new way (generating the index at doc build time) when the version is recent enough.

@andrevmatos
Copy link

Looks like search is broken again with current TypeDoc

@Caperious
Copy link

Can confirm, the issue occurs again with typedoc 0.20.36 and typedoc-plugin-pages 1.1.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants