Skip to content

Commit be5a9eb

Browse files
committed
docs(docusaurus.config): add "Typedoc" link
1 parent e0c0bc8 commit be5a9eb

File tree

6 files changed

+28
-4
lines changed

6 files changed

+28
-4
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,4 @@ coverage
4444
.nyc_output
4545
package-lock.json
4646
build
47-
typedoc
47+
typedoc_out

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,6 @@
5656
"readme:toc": "doctoc ./README.md",
5757
"postinstall": "husky install",
5858
"website": "yarn --cwd website/ run start",
59-
"typedoc": "typedoc packages/mongodb-memory-server-core/src/index.ts --out typedoc --tsconfig packages/mongodb-memory-server-core/tsconfig.build.json"
59+
"typedoc": "typedoc packages/mongodb-memory-server-core/src/index.ts --out typedoc_out --tsconfig packages/mongodb-memory-server-core/tsconfig.build.json"
6060
}
6161
}

scripts/ghPagesDeploy.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const path = require('node:path');
77
/* Constants / Config */
88

99
/** keep ".git", ".github", "website" and "scripts" */
10-
const keepRegex = /^(?:\.git|website|scripts|versions|typedoc)/;
10+
const keepRegex = /^(?:\.git|website|scripts|versions|typedoc_out)/;
1111
/** Regex to filter and get versions output from git ls-tree */
1212
const versionsFilter = /^versions\/(\d+\.x|beta)\/?$/;
1313
/** Which branch to deploy to */
@@ -98,7 +98,7 @@ function main() {
9898

9999
// move typedoc to "deployAs"
100100
{
101-
const from = 'typedoc';
101+
const from = 'typedoc_out';
102102
const to = path.join(deployInfo.deployPath, 'typedoc');
103103
console.log('rename', from, '->', to); // always log what is renamed
104104
fs.renameSync(from, to);

website/docusaurus.config.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,13 @@ module.exports = {
5959
label: 'API',
6060
position: 'right',
6161
},
62+
{
63+
type: 'custom-link',
64+
href: 'typedoc/index.html',
65+
prependBaseUrlToHref: true,
66+
label: 'Typedoc',
67+
position: 'right',
68+
},
6269
{
6370
href: 'https://github.com/nodkz/mongodb-memory-server/blob/master/CHANGELOG.md',
6471
label: 'Changelog',
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import React from 'react';
2+
import useBaseUrl from '@docusaurus/useBaseUrl';
3+
4+
// this is a workaround, because without this non-absolute links will be seen as routable links by react
5+
// see https://github.com/facebook/docusaurus/discussions/9376
6+
7+
export default function NavbarLinkNoReact({ href, label }) {
8+
const normalizedHref = useBaseUrl(href, { forcePrependBaseUrl: true });
9+
10+
return (
11+
<a href={normalizedHref} class="navbar__item navbar__link">
12+
{label}
13+
</a>
14+
);
15+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
import OriginalComponentTypes from '@theme-original/NavbarItem/ComponentTypes';
22
import NavbarVersionsSelector from '../../components/NavbarVersionsSelector';
33
import NavbarBetaNotice from '../../components/NavbarBetaNotice';
4+
import NavbarLinkNoReact from '../../components/NavbarExternalLink';
45

56
const ComponentTypes = {
67
...OriginalComponentTypes,
78
'custom-versions-selector': NavbarVersionsSelector,
89
'custom-beta-notice': NavbarBetaNotice,
10+
'custom-link': NavbarLinkNoReact,
911
};
1012
export default ComponentTypes;

0 commit comments

Comments
 (0)