diff --git a/package-lock.json b/package-lock.json index 8842844de..6f44149a3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -40,6 +40,7 @@ "sass-embedded": "^1.78.0", "three": "npm:@needle-tools/three@^0.162.10", "typedoc": "0.26.8", + "typedoc-plugin-coverage": "^3.3.0", "typedoc-plugin-extras": "3.1.0", "typedoc-plugin-inline-sources": "1.1.0", "typedoc-plugin-mdn-links": "3.3.2", @@ -15361,6 +15362,19 @@ "typescript": "4.6.x || 4.7.x || 4.8.x || 4.9.x || 5.0.x || 5.1.x || 5.2.x || 5.3.x || 5.4.x || 5.5.x || 5.6.x" } }, + "node_modules/typedoc-plugin-coverage": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/typedoc-plugin-coverage/-/typedoc-plugin-coverage-3.3.0.tgz", + "integrity": "sha512-wpywQ95tqGSD6IbYUPMXSKiwnSWboSKdx2y9X6SJQKzQvBqZoz5iiUyDJFixtW8v7+xmrqXFR/B6Wy37FNhVqA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 18" + }, + "peerDependencies": { + "typedoc": "0.25.x || 0.26.x" + } + }, "node_modules/typedoc-plugin-extras": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/typedoc-plugin-extras/-/typedoc-plugin-extras-3.1.0.tgz", diff --git a/package.json b/package.json index ed6209838..8d704c774 100644 --- a/package.json +++ b/package.json @@ -47,6 +47,7 @@ "sass-embedded": "^1.78.0", "three": "npm:@needle-tools/three@^0.162.10", "typedoc": "0.26.8", + "typedoc-plugin-coverage": "^3.3.0", "typedoc-plugin-extras": "3.1.0", "typedoc-plugin-inline-sources": "1.1.0", "typedoc-plugin-mdn-links": "3.3.2", diff --git a/tools/api-plugins/api-docs.css b/tools/api-plugins/api-docs.css index df3f50212..b903b8e1a 100644 --- a/tools/api-plugins/api-docs.css +++ b/tools/api-plugins/api-docs.css @@ -38,6 +38,7 @@ a.title { background-image: url("https://engine.needle.tools/docs/needle-logo-white.svg"); } +/* a.title::after { content: "API Reference"; color: initial; @@ -48,6 +49,7 @@ a.title::after { bottom: 1px; position: relative; } +*/ #tsd-search.has-focus { background-color: transparent; @@ -111,20 +113,26 @@ html[data-theme="dark"] a.title { } } +/* #tsd-search .field label { z-index: 10; overflow: visible; padding-left: calc(min(500px, 80%) - 40px); margin-right: 40px; } +*/ @media screen and (max-width: 440px) { + /* a.title::after { content: none; } + */ + /* #tsd-search .field label { padding-left: calc(80% - 80px); margin-right: 20px; } + */ } \ No newline at end of file diff --git a/tools/api-plugins/index.js b/tools/api-plugins/index.js index f9bc571d3..51658874e 100644 --- a/tools/api-plugins/index.js +++ b/tools/api-plugins/index.js @@ -6,6 +6,13 @@ import { Application, JSX, ParameterType, ReflectionKind } from "typedoc"; */ export function load(app) { + app.converter.on("createDeclaration", (context, refl) => { + if (refl.name.endsWith("/api")) { + console.log(refl.name + " - " + refl.getFullName()); + refl.name = refl.name.replace("/api", ""); + } + }); + app.converter.addUnknownSymbolResolver((declaration) => { const names = declaration.symbolReference?.path; if (!names) return; diff --git a/tools/build_api_docs.mjs b/tools/build_api_docs.mjs index ebb8ee9a0..0b33f0024 100644 --- a/tools/build_api_docs.mjs +++ b/tools/build_api_docs.mjs @@ -179,26 +179,13 @@ async function produceDocs(packageDir, outputDirectory) { const readmePath = packageDir + "/README.md"; - // copy the /api.ts files to /index.ts so that we get nicer paths - const files = [ - packageDir + "/src/engine/api.ts", - packageDir + "/src/engine-components/api.ts", - packageDir + "/src/engine-components-experimental/api.ts", - packageDir + "/src/engine-schemes/api.ts", - ] - - for (const file of files) { - const indexFile = file.replace(/\/([^/]+)\.ts$/, "/index.ts"); - fs.copyFileSync(file, indexFile); - } - const app = await TypeDoc.Application.bootstrapWithPlugins({ lang: "en", entryPoints: [ - packageDir + "/src/engine", - packageDir + "/src/engine-components", - packageDir + "/src/engine-components-experimental", - packageDir + "/src/engine-schemes", + packageDir + "/src/engine/api.ts", + packageDir + "/src/engine-components/api.ts", + packageDir + "/src/engine-components-experimental/api.ts", + packageDir + "/src/engine-schemes/api.ts", ], tsconfig: "./tools/api-plugins/tsconfig.json", // don't include references multiple times @@ -209,6 +196,20 @@ async function produceDocs(packageDir, outputDirectory) { // readme: "none", excludeExternals: true, + navigation: { + includeFolders: false, + includeCategories: true, + includeGroups: false, + }, + categorizeByGroup: false, + categoryOrder: ["*", "Other"], + navigationLinks: { + "API": "/", + "Docs": "https://engine.needle.tools/docs/", + "Samples": "https://engine.needle.tools/samples/", + "Pricing": "https://needle.tools/pricing/", + }, + skipErrorChecking: true, excludeInternal: true, excludeProtected: false, @@ -227,7 +228,6 @@ async function produceDocs(packageDir, outputDirectory) { name: "Needle Engine", readme: readmePath, - categorizeByGroup: true, "visibilityFilters": { "protected": false, @@ -235,13 +235,10 @@ async function produceDocs(packageDir, outputDirectory) { "@deprecated": false, }, - // plugin: "typedoc-neo-theme", - // theme: "./node_modules/typedoc-neo-theme/bin/default", - plugin: [ "typedoc-plugin-inline-sources", "typedoc-plugin-mdn-links", - // "typedoc-plugin-keywords", + "typedoc-plugin-coverage", "typedoc-plugin-extras", "./tools/api-plugins/index.js", "./tools/api-plugins/keywords/index.js",