From ffd35ed9ee96b74c7c5c7a942df25209133228aa Mon Sep 17 00:00:00 2001 From: ptaylor Date: Mon, 1 Feb 2021 06:37:08 -0600 Subject: [PATCH] add script to compile typedocs into one top-level docs folder --- .gitignore | 6 +++--- modules/cuda/typedoc.js | 2 +- modules/cudf/typedoc.js | 2 +- modules/cugraph/typedoc.js | 2 +- modules/deck.gl/typedoc.js | 2 +- modules/glfw/typedoc.js | 2 +- modules/rmm/typedoc.js | 2 +- modules/webgl/typedoc.js | 2 +- package.json | 3 ++- typedoc.js | 29 +++++++++++++++++++++++++++++ 10 files changed, 41 insertions(+), 11 deletions(-) create mode 100644 typedoc.js diff --git a/.gitignore b/.gitignore index 7d30ce798..588320fe8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,8 @@ **/z-* **/*.log +**/doc +**/lib +**/build **/.cache **/.clangd **/.ccache @@ -9,9 +12,6 @@ .env .cmake-js -modules/**/*/doc -modules/**/*/lib -modules/**/*/build modules/*/include/rmm modules/*/include/cudf modules/*/include/cuml diff --git a/modules/cuda/typedoc.js b/modules/cuda/typedoc.js index 507997456..3236ab1f3 100644 --- a/modules/cuda/typedoc.js +++ b/modules/cuda/typedoc.js @@ -1,5 +1,5 @@ module.exports = { - entryPoints: ['src'], + entryPoints: ['src/index.ts'], out: 'doc', name: '@nvidia/cuda', tsconfig: 'tsconfig.json', diff --git a/modules/cudf/typedoc.js b/modules/cudf/typedoc.js index 017e7cb66..86b033e5d 100644 --- a/modules/cudf/typedoc.js +++ b/modules/cudf/typedoc.js @@ -1,5 +1,5 @@ module.exports = { - entryPoints: ['src'], + entryPoints: ['src/index.ts'], out: 'doc', name: '@nvidia/cudf', tsconfig: 'tsconfig.json', diff --git a/modules/cugraph/typedoc.js b/modules/cugraph/typedoc.js index 194629abc..1d74ed083 100644 --- a/modules/cugraph/typedoc.js +++ b/modules/cugraph/typedoc.js @@ -1,5 +1,5 @@ module.exports = { - entryPoints: ['src'], + entryPoints: ['src/index.ts'], out: 'doc', name: '@nvidia/cugraph', tsconfig: 'tsconfig.json', diff --git a/modules/deck.gl/typedoc.js b/modules/deck.gl/typedoc.js index 3e36f8be3..693aaefd2 100644 --- a/modules/deck.gl/typedoc.js +++ b/modules/deck.gl/typedoc.js @@ -1,5 +1,5 @@ module.exports = { - entryPoints: ['src'], + entryPoints: ['src/index.ts'], out: 'doc', name: '@nvidia/deck.gl', tsconfig: 'tsconfig.json', diff --git a/modules/glfw/typedoc.js b/modules/glfw/typedoc.js index 1bb5aaf4e..0b7b2363d 100644 --- a/modules/glfw/typedoc.js +++ b/modules/glfw/typedoc.js @@ -1,5 +1,5 @@ module.exports = { - entryPoints: ['src'], + entryPoints: ['src/index.ts'], out: 'doc', name: '@nvidia/glfw', tsconfig: 'tsconfig.json', diff --git a/modules/rmm/typedoc.js b/modules/rmm/typedoc.js index 0496c9a5e..1527d9ac4 100644 --- a/modules/rmm/typedoc.js +++ b/modules/rmm/typedoc.js @@ -1,5 +1,5 @@ module.exports = { - entryPoints: ['src'], + entryPoints: ['src/index.ts'], out: 'doc', name: '@nvidia/rmm', tsconfig: 'tsconfig.json', diff --git a/modules/webgl/typedoc.js b/modules/webgl/typedoc.js index ff409b758..2a121a775 100644 --- a/modules/webgl/typedoc.js +++ b/modules/webgl/typedoc.js @@ -1,5 +1,5 @@ module.exports = { - entryPoints: ['src'], + entryPoints: ['src/index.ts'], out: 'doc', name: '@nvidia/webgl', tsconfig: 'tsconfig.json', diff --git a/package.json b/package.json index d0f3828cc..167fb6173 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,8 @@ ], "scripts": { "clean": "scripts/exec.js clean", - "doc": "scripts/exec.js run doc", + "doc": "rimraf doc && typedoc --options typedoc.js && npm run doc:packages", + "doc:packages": "scripts/exec.js run doc", "demo": "scripts/exec.js demo", "test": "scripts/exec.js test", "lint": "scripts/exec.js lint", diff --git a/typedoc.js b/typedoc.js new file mode 100644 index 000000000..7828ae84e --- /dev/null +++ b/typedoc.js @@ -0,0 +1,29 @@ +const Path = require('path'); +const loadOptions = (base) => { + const opts = require(Path.resolve(base, 'typedoc.js')); + opts.entryPoints = opts.entryPoints.map((entryPoint) => Path.resolve(base, entryPoint)); + return opts; +}; + +const mergeOptions = (...opts) => Object.assign({}, ...opts, { + entryPoints: opts.reduce((es, { entryPoints = [] }) => [...es, ...entryPoints], []) +}); + +module.exports = mergeOptions( + loadOptions('modules/cuda'), + loadOptions('modules/rmm'), + loadOptions('modules/cudf'), + loadOptions('modules/cugraph'), + loadOptions('modules/deck.gl'), + loadOptions('modules/glfw'), + loadOptions('modules/webgl'), + { + out: 'doc', + name: 'RAPIDS', + tsconfig: 'tsconfig.json', + hideGenerator: true, + excludePrivate: true, + excludeProtected: true, + excludeExternals: true, + } +);