docusaurus-plugin-typedoc-api icon indicating copy to clipboard operation
docusaurus-plugin-typedoc-api copied to clipboard

Github domain(githubHost) is `undefined` in Vercel

Open UnschooledGamer opened this issue 10 months ago • 4 comments

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)

[email protected] /workspaces/poru/website
├── @docusaurus/[email protected]
├── @docusaurus/[email protected]
├── @docusaurus/[email protected]
├── @docusaurus/[email protected]
├── @docusaurus/[email protected]
├── @mdx-js/[email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
└── [email protected]
Docusaurus Config

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 /<baseUrl>/ pathname under which your site is served
  // For GitHub pages deployment, it is often '/<projectName>/'
  // 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 avatar Apr 08 '24 14:04 UnschooledGamer

@milesj Please have a eye here.

UnschooledGamer avatar May 04 '24 10:05 UnschooledGamer

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

milesj avatar May 04 '24 19:05 milesj

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

BartaG512 avatar Jun 26 '24 05:06 BartaG512

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.

UnschooledGamer avatar Jun 26 '24 05:06 UnschooledGamer