Skip to content

Commit 0129cfd

Browse files
Fix JSDoc config for Read the Docs
Add a JS-based JSDoc config wrapper that reads `READTHEDOCS_CANONICAL_URL` and sets `opts.basePath` dynamically for hosted docs paths. Update `jsdoc.json` to use the current clean-jsdoc-theme option format (template dist path plus top-level custom JS/CSS, favicon, and menu settings), and point `generate-docs` to the new `jsdoc.config.js` entrypoint.
1 parent 0c33d59 commit 0129cfd

3 files changed

Lines changed: 30 additions & 25 deletions

File tree

jsdoc.config.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
const config = require("./jsdoc.json");
2+
3+
const canonicalUrl = process.env.READTHEDOCS_CANONICAL_URL;
4+
if (canonicalUrl) {
5+
config.opts.basePath = new URL(canonicalUrl).pathname;
6+
}
7+
8+
module.exports = config;

jsdoc.json

Lines changed: 21 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -11,30 +11,27 @@
1111
"destination": "./_readthedocs/html",
1212
"recurse": true,
1313
"verbose": true,
14-
"template": "node_modules/clean-jsdoc-theme",
15-
"theme_opts": {
16-
"add_scripts": "window.initCrowdIn('LizardByte-docs', null);",
17-
"default_theme": "fallback-dark",
18-
"favicon": "favicon.ico",
19-
"include_css": ["./node_modules/@lizardbyte/shared-web/dist/crowdin-clean-jsdoc-css.css"],
20-
"include_js": ["./node_modules/@lizardbyte/shared-web/dist/crowdin.js"],
21-
"menu": [
22-
{
23-
"title": "Gamepad Tester",
24-
"link": "https://app.lizardbyte.dev/gamepad-tester",
25-
"target": "_blank",
26-
"class": "",
27-
"id": "jekyll-sample"
28-
},
29-
{
30-
"title": "❤ Donate",
31-
"link": "https://app.lizardbyte.dev",
32-
"target": "_blank",
33-
"class": "",
34-
"id": "donate"
35-
}
36-
]
37-
}
14+
"template": "node_modules/clean-jsdoc-theme/dist",
15+
"customJs": "window.initCrowdIn('LizardByte-docs', null);",
16+
"customCssFile": ["./node_modules/@lizardbyte/shared-web/dist/crowdin-clean-jsdoc-css.css"],
17+
"customJsFile": ["./node_modules/@lizardbyte/shared-web/dist/crowdin.js"],
18+
"favicon": "./docs/static/favicon.ico",
19+
"menu": [
20+
{
21+
"title": "Gamepad Tester",
22+
"link": "https://app.lizardbyte.dev/gamepad-tester",
23+
"target": "_blank",
24+
"class": "",
25+
"id": "jekyll-sample"
26+
},
27+
{
28+
"title": "❤ Donate",
29+
"link": "https://app.lizardbyte.dev",
30+
"target": "_blank",
31+
"class": "",
32+
"id": "donate"
33+
}
34+
]
3835
},
3936
"markdown": {
4037
"hardwrap": false,

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
},
5353
"scripts": {
5454
"build": "cross-env NODE_ENV=production webpack",
55-
"generate-docs": "jsdoc --configure jsdoc.json --verbose",
55+
"generate-docs": "jsdoc --configure jsdoc.config.js --verbose",
5656
"start": "webpack serve",
5757
"test": "npm-run-all test:unit test:report test:lint",
5858
"test:unit": "jest --coverage",

0 commit comments

Comments
 (0)