milesj / docusaurus-plugin-typedoc-api

Docusaurus plugin that provides source code API documentation powered by TypeDoc.
69 stars 25 forks source link

Github domain(githubHost) is `undefined` in Vercel #140

Open UnschooledGamer opened 4 months ago

UnschooledGamer commented 4 months ago

I'm hosting an api docs at vercel and noticed that go to source code link has Github Domain(githubHost) is displayed as undefined, the url it gave: https://undefined/parasop/poru/blob/main/src/Player/Connection.ts#L61. Whereas it works completely fine locally.

While searching in the source code of this repo, I found this.

Do I need to provide the githubHost in the docusaurus config? I did not provide it as the docusaurus docs said:

The hostname of your server. Useful if you are using GitHub Enterprise. You don't need this if you are not using the docusaurus deploy command.

Versions(via npm list)

website@0.0.0 /workspaces/poru/website
├── @docusaurus/core@3.2.1
├── @docusaurus/module-type-aliases@3.2.1
├── @docusaurus/preset-classic@3.2.1
├── @docusaurus/tsconfig@3.2.1
├── @docusaurus/types@3.2.1
├── @mdx-js/react@3.0.1
├── clsx@2.1.0
├── docusaurus-plugin-typedoc-api@4.2.0
├── prism-react-renderer@2.3.1
├── react-dom@18.2.0
├── react@18.2.0
└── typescript@5.2.2
Docusaurus Config

```ts import {themes as prismThemes} from 'prism-react-renderer'; import type {Config} from '@docusaurus/types'; import type * as Preset from '@docusaurus/preset-classic'; import path from 'path'; const config: Config = { title: 'Poru', tagline: 'A stable and powerful Lavalink client with some best features', favicon: 'img/poru.png', trailingSlash: false, // Set the production url of your site here url: 'https://your-docusaurus-site.example.com', // Set the // pathname under which your site is served // For GitHub pages deployment, it is often '//' // Check if it's running inside github actions environment or locally baseUrl: process.env.previewBaseURL ? process.env.previewBaseURL : ((!process.env.GITHUB_ACTIONS || !process.env.CI) ? '/' : '/poru'), // GitHub pages deployment config. // If you aren't using GitHub pages, you don't need these. organizationName: 'parasop', // Usually your GitHub org/user name. projectName: 'poru', // Usually your repo name. onBrokenLinks: 'throw', onBrokenMarkdownLinks: 'warn', // Even if you don't use internationalization, you can use this field to set // useful metadata like html lang. For example, if your site is Chinese, you // may want to replace "en" with "zh-Hans". i18n: { defaultLocale: 'en', locales: ['en'], }, plugins: [ [ 'docusaurus-plugin-typedoc-api', { projectRoot: path.join(__dirname, '..'), packages: [{ path: ".", entry: { index: "index.ts", } }], gitRefName: 'main', readmes: true, // minimal: , debug: true, // typedocOptions: { // entryPoints: ['../../index.ts'], // } sidebarCollapsed: false, }, ], ], presets: [ [ 'classic', { docs: { sidebarPath: './sidebars.ts', // Please change this to your repo. // Remove this to remove the "edit this page" links. // sidebarCollapsed: false, sidebarCollapsible: false, }, blog: false, // not used for this project theme: { customCss: './src/css/custom.css', }, } satisfies Preset.Options, ], ], themeConfig: { // Replace with your project's social card image: 'img/poru.png', colorMode: { defaultMode: 'dark', respectPrefersColorScheme: true }, navbar: { title: 'Poru', logo: { alt: 'Poru Logo', src: 'img/poru.png', }, items: [ { href: 'https://github.com/parasop/poru', label: 'GitHub', position: 'right', }, { to: 'api', label: 'API', position: 'left', sidebarId: 'apiSidebar', // type: "autogenerated", }, ], }, docs: { sidebar: { autoCollapseCategories: false, }, }, footer: { style: 'dark', links: [ { title: 'Docs', items: [ { label: 'Overview', to: '/api', }, { label: 'Poru Music (Example)', to: 'https://github.com/parasop/poru-example', }, ], }, { title: 'Community', items: [ { label: 'Npm', href: 'https://www.npmjs.com/package/poru', }, { label: 'Discord', href: 'https://discord.com/invite/Zmmc47Nrh8', }, { label: 'GitHub', href: 'https://github.com/parasop/poru', }, ], }, { title: 'More', items: [ { label: 'Donate', href: 'https://ko-fi.com/parasop', }, ], }, ], copyright: `Copyright © ${new Date().getFullYear()} Poru. Built with Docusaurus. Configured By UnschooledGamer`, }, prism: { theme: prismThemes.github, darkTheme: prismThemes.dracula, }, } satisfies Preset.ThemeConfig, }; export default config; ```

Thanks.

UnschooledGamer commented 4 months ago

@milesj Please have a eye here.

milesj commented 4 months ago

I'm not entirely sure what the correct fix is here.

BartaG512 commented 2 months ago

As I have found Typedoc has its own logic, handling other hosts than github. url handling

UnschooledGamer commented 2 months ago

As I have found Typedoc has its own logic, handling other hosts than github. url handling

That logic probably modifies and returns undefined, I just fixed it by providing githubHost explicitly.