mirror of
https://github.com/vale981/tridactyl
synced 2025-03-05 09:31:41 -05:00
Migrate typedoc script to JS
Needed to do this to make the new theme, apparently
This commit is contained in:
parent
8ca6716643
commit
92c1563264
3 changed files with 48 additions and 2 deletions
|
@ -67,6 +67,7 @@
|
|||
"test": "yarn run build && web-ext build --source-dir ./build --overwrite-dest && jest --silent",
|
||||
"update-buildsystem": "rm -rf src/node_modules; yarn run clean",
|
||||
"watch": "echo 'watch is broken, use build instead'; exit 0;",
|
||||
"makedocs": "node scripts/make_docs.js",
|
||||
"install": "git config core.hookspath hooks/"
|
||||
},
|
||||
"author": "Colin Caine",
|
||||
|
|
45
scripts/make_docs.js
Normal file
45
scripts/make_docs.js
Normal file
|
@ -0,0 +1,45 @@
|
|||
const TypeDoc = require("typedoc");
|
||||
|
||||
|
||||
// Make the theme
|
||||
|
||||
// Theme docs: https://github.com/TypeStrong/typedoc/blob/master/internal-docs/custom-themes.md
|
||||
// Theme example: https://github.com/Gerrit0/typedoc-custom-theme-demo/blob/main/src/index.tsx
|
||||
function load(app) {
|
||||
app.renderer.defineTheme("tridactyl", TypeDoc.DefaultTheme);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Build the docs
|
||||
async function main() {
|
||||
const app = new TypeDoc.Application();
|
||||
// console.log(app.options);
|
||||
|
||||
// Load our theme
|
||||
load(app);
|
||||
|
||||
// Read the tsconfig.json
|
||||
app.options.addReader(new TypeDoc.TSConfigReader());
|
||||
|
||||
app.bootstrap({
|
||||
// typedoc options here
|
||||
entryPoints: ["src"],
|
||||
theme: "tridactyl",
|
||||
entryPointStrategy: "expand",
|
||||
skipErrorChecking: true,
|
||||
exclude: "src/**/?(test_utils|*.test).ts",
|
||||
});
|
||||
|
||||
const project = app.convert();
|
||||
|
||||
if (project) {
|
||||
// Project may not have converted correctly
|
||||
const outputDir = "generated/static/docs";
|
||||
|
||||
// Rendered docs
|
||||
await app.generateDocs(project, outputDir);
|
||||
}
|
||||
}
|
||||
|
||||
main().catch(console.error);
|
|
@ -1,5 +1,5 @@
|
|||
#!/bin/sh
|
||||
# nb this is also defined in the makedocs script
|
||||
dest=generated/static/docs
|
||||
"$(yarn bin)/typedoc" --entryPointStrategy expand --skipErrorChecking --exclude "src/**/?(test_utils|*.test).ts" --out $dest src
|
||||
#"$(yarn bin)/typedoc" --entryPointStrategy expand --skipErrorChecking --theme src/static/typedoc/ --exclude "src/**/?(test_utils|*.test).ts" --out $dest src
|
||||
yarn run makedocs
|
||||
cp -r $dest build/static/
|
||||
|
|
Loading…
Add table
Reference in a new issue