Skip to content

Commit

Permalink
[web][doc] Use external-module-map and merge-modules typedoc plugins
Browse files Browse the repository at this point in the history
For a future integration with static site generators like Docusaurus or
Vitepress, this commit applies the necessary typedoc configuration and
plugins for a more reasonable output structure. Of course, it can (when
not must) be improved, but it's a good starting point for testing.

In short, this commit

  * Adjusts some typedoc options like sort, navigation, and others.
  * Uses the typedoc-plugin-external-module-map in ordert to avoid
    adding the "@module Whatever" at the beginning of each file
    manually.
  * Uses typedoc-plugin-merge-modules to group docs of the same module
    and category. Since it renames the default exports it makes
    typedoc-plugin-rename-defaults obsolete.
  * Separates client and component documentation processing tasks since
    their organizational structure differs slightly.
  * Creates a new task for running these two.

Despite not been included in this commit, typedoc-plugin-markdwon will
be needed for mentioned integration.

To know more,

  * https://typedoc.org/options/organization/
  * https://github.com/asgerjensen/typedoc-plugin-external-module-map
  * https://github.com/krisztianb/typedoc-plugin-merge-modules
  * https://github.com/tgreyuk/typedoc-plugin-markdown/tree/master/packages/typedoc-plugin-markdown
  * https://docusaurus.io/
  * https://vitepress.dev/
  • Loading branch information
dgdavid committed Jan 8, 2024
1 parent eb7fb12 commit 5e09032
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 34 deletions.
41 changes: 18 additions & 23 deletions web/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions web/package.json
Expand Up @@ -18,7 +18,9 @@
"stylelint": "stylelint 'src/**/*.{css,scss}'",
"stylelint:fix": "stylelint --fix 'src/**/*.{css,scss}'",
"check-types": "tsc --skipLibCheck",
"typedoc": "npx typedoc && echo Tip: && echo xdg-open jsdoc.out/index.html",
"typedoc": "npm run typedoc:client && npm run typedoc:components",
"typedoc:client": "npx typedoc --entryPoints src/client --out jsdoc.out/client",
"typedoc:components": "npx typedoc --entryPoints src/components --out jsdoc.out/components",
"test": "jest"
},
"engines": {
Expand Down Expand Up @@ -87,8 +89,9 @@
"ts-jest": "^29.0.3",
"tsconfig-paths-webpack-plugin": "^4.0.0",
"typedoc": "^0.25.4",
"typedoc-plugin-external-module-map": "^2.0.1",
"typedoc-plugin-merge-modules": "^5.1.0",
"typedoc-plugin-missing-exports": "^2.1.0",
"typedoc-plugin-rename-defaults": "^0.7.0",
"typescript": "^5.3.3",
"webpack": "^5.89.0",
"webpack-cli": "^5.1.4",
Expand Down
2 changes: 2 additions & 0 deletions web/src/App.jsx
Expand Up @@ -17,6 +17,8 @@
*
* To contact SUSE LLC about this file by physical or electronic mail, you may
* find current contact information at www.suse.com.
*
* ".*\/src\/components\/([\\w\\-_]+)\/",
*/

import React, { useEffect, useState } from "react";
Expand Down
24 changes: 15 additions & 9 deletions web/typedoc.json
@@ -1,23 +1,29 @@
{
"$schema": "https://typedoc.org/schema.json",
"name": "Agama Installer",
"entryPoints": [
"./src",
],
"entryPointStrategy": "expand",
"exclude": [
"./src/lib"
],
"excludeNotDocumented": true,
"out": "jsdoc.out",
"plugin": [
"typedoc-plugin-missing-exports",
"typedoc-plugin-rename-defaults"
"typedoc-plugin-external-module-map",
"typedoc-plugin-merge-modules",
],
"excludeReferences": true,
"mergeModulesMergeMode": "module-category",
"external-modulemap": [
".*\/src\/(client)\/",
".*\/src\/components\/([\\w\\-_]+)\/",
],
"sort": [
"source-order"
"alphabetical",
"visibility"
],
"categorizeByGroup": false,
"navigation": {
"includeCategories": true,
"includeGroups": true
},
"categorizeByGroup": true,
"navigationLinks": {
"GitHub": "https://github.com/openSUSE/agama"
},
Expand Down

0 comments on commit 5e09032

Please sign in to comment.