From 6191a5d883048b694404dbf42527caba395828ea Mon Sep 17 00:00:00 2001 From: ST-DDT Date: Mon, 1 Apr 2024 10:21:18 +0200 Subject: [PATCH] docs: rewrite api-docs generation using ts-morph (#2628) --- .github/renovate.json5 | 7 +- .prettierignore | 2 +- .../components/api-docs/method-parameters.vue | 4 +- docs/.vitepress/components/api-docs/method.ts | 18 +- .../.vitepress/components/api-docs/method.vue | 4 +- package.json | 9 +- pnpm-lock.yaml | 81 +- scripts/apidoc.ts | 7 - scripts/apidoc/faker-class.ts | 86 - scripts/apidoc/faker-utilities.ts | 40 - scripts/apidoc/generate.ts | 42 - scripts/apidoc/module-methods.ts | 122 -- scripts/apidoc/parameter-defaults.ts | 136 -- scripts/apidoc/signature.ts | 365 ---- scripts/apidoc/typedoc.ts | 421 ----- scripts/apidoc/utils.ts | 79 - scripts/apidoc/writer.ts | 249 --- scripts/apidocs.ts | 7 + scripts/{apidoc => apidocs}/diff.ts | 21 +- scripts/apidocs/generate.ts | 45 + scripts/apidocs/output/constants.ts | 1 + scripts/apidocs/output/diff-index.ts | 81 + scripts/apidocs/output/page-index.ts | 38 + scripts/apidocs/output/page.ts | 172 ++ scripts/apidocs/output/search-index.ts | 34 + scripts/apidocs/output/source-base-url.ts | 38 + scripts/apidocs/processing/class.ts | 223 +++ scripts/apidocs/processing/error.ts | 40 + scripts/apidocs/processing/jsdocs.ts | 91 + scripts/apidocs/processing/method.ts | 197 ++ scripts/apidocs/processing/parameter.ts | 203 ++ scripts/apidocs/processing/signature.ts | 158 ++ scripts/apidocs/processing/source.ts | 37 + scripts/apidocs/processing/type.ts | 231 +++ scripts/apidocs/project.ts | 9 + scripts/{apidoc => apidocs/utils}/format.ts | 2 +- scripts/{apidoc => apidocs/utils}/markdown.ts | 44 +- scripts/apidocs/utils/paths.ts | 24 + scripts/apidocs/utils/value-checks.ts | 69 + scripts/diff.ts | 8 +- scripts/generate-locales.ts | 2 +- .../apidoc/__snapshots__/module.spec.ts.snap | 54 - .../__snapshots__/signature.spec.ts.snap | 768 -------- test/scripts/apidoc/module.spec.ts | 26 - test/scripts/apidoc/signature.debug.ts | 17 - test/scripts/apidoc/signature.spec.ts | 26 - test/scripts/apidoc/utils.ts | 66 - test/scripts/apidoc/verify-jsdoc-tags.spec.ts | 315 ---- test/scripts/{apidoc => apidocs}/.gitignore | 0 .../apidocs/__snapshots__/class.spec.ts.snap | 75 + .../apidocs/__snapshots__/method.spec.ts.snap | 1671 +++++++++++++++++ .../class.example.ts} | 0 test/scripts/apidocs/class.spec.ts | 22 + .../method.example.ts} | 96 +- test/scripts/apidocs/method.spec.ts | 30 + test/scripts/apidocs/utils.ts | 38 + .../scripts/apidocs/verify-jsdoc-tags.spec.ts | 286 +++ tsconfig.json | 2 +- 58 files changed, 4012 insertions(+), 2927 deletions(-) delete mode 100644 scripts/apidoc.ts delete mode 100644 scripts/apidoc/faker-class.ts delete mode 100644 scripts/apidoc/faker-utilities.ts delete mode 100644 scripts/apidoc/generate.ts delete mode 100644 scripts/apidoc/module-methods.ts delete mode 100644 scripts/apidoc/parameter-defaults.ts delete mode 100644 scripts/apidoc/signature.ts delete mode 100644 scripts/apidoc/typedoc.ts delete mode 100644 scripts/apidoc/utils.ts delete mode 100644 scripts/apidoc/writer.ts create mode 100644 scripts/apidocs.ts rename scripts/{apidoc => apidocs}/diff.ts (80%) create mode 100644 scripts/apidocs/generate.ts create mode 100644 scripts/apidocs/output/constants.ts create mode 100644 scripts/apidocs/output/diff-index.ts create mode 100644 scripts/apidocs/output/page-index.ts create mode 100644 scripts/apidocs/output/page.ts create mode 100644 scripts/apidocs/output/search-index.ts create mode 100644 scripts/apidocs/output/source-base-url.ts create mode 100644 scripts/apidocs/processing/class.ts create mode 100644 scripts/apidocs/processing/error.ts create mode 100644 scripts/apidocs/processing/jsdocs.ts create mode 100644 scripts/apidocs/processing/method.ts create mode 100644 scripts/apidocs/processing/parameter.ts create mode 100644 scripts/apidocs/processing/signature.ts create mode 100644 scripts/apidocs/processing/source.ts create mode 100644 scripts/apidocs/processing/type.ts create mode 100644 scripts/apidocs/project.ts rename scripts/{apidoc => apidocs/utils}/format.ts (92%) rename scripts/{apidoc => apidocs/utils}/markdown.ts (62%) create mode 100644 scripts/apidocs/utils/paths.ts create mode 100644 scripts/apidocs/utils/value-checks.ts delete mode 100644 test/scripts/apidoc/__snapshots__/module.spec.ts.snap delete mode 100644 test/scripts/apidoc/__snapshots__/signature.spec.ts.snap delete mode 100644 test/scripts/apidoc/module.spec.ts delete mode 100644 test/scripts/apidoc/signature.debug.ts delete mode 100644 test/scripts/apidoc/signature.spec.ts delete mode 100644 test/scripts/apidoc/utils.ts delete mode 100644 test/scripts/apidoc/verify-jsdoc-tags.spec.ts rename test/scripts/{apidoc => apidocs}/.gitignore (100%) create mode 100644 test/scripts/apidocs/__snapshots__/class.spec.ts.snap create mode 100644 test/scripts/apidocs/__snapshots__/method.spec.ts.snap rename test/scripts/{apidoc/module.example.ts => apidocs/class.example.ts} (100%) create mode 100644 test/scripts/apidocs/class.spec.ts rename test/scripts/{apidoc/signature.example.ts => apidocs/method.example.ts} (86%) create mode 100644 test/scripts/apidocs/method.spec.ts create mode 100644 test/scripts/apidocs/utils.ts create mode 100644 test/scripts/apidocs/verify-jsdoc-tags.spec.ts diff --git a/.github/renovate.json5 b/.github/renovate.json5 index 3421abe792e..ac590676e1b 100644 --- a/.github/renovate.json5 +++ b/.github/renovate.json5 @@ -55,12 +55,7 @@ }, { "groupName": "doc-dependencies", - "matchPackageNames": [ - "@algolia/client-search", - "typedoc", - "typedoc-plugin-missing-exports", - "vitepress" - ] + "matchPackageNames": ["@algolia/client-search", "ts-morph", "vitepress"] } ], "vulnerabilityAlerts": { diff --git a/.prettierignore b/.prettierignore index 8997b865c9d..9c80acc2015 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,7 +1,7 @@ .pnpm-store/ coverage/ dist/ -test/scripts/apidoc/temp/ +test/scripts/apidocs/temp/ CHANGELOG.md CHANGELOG_old.md pnpm-lock.yaml diff --git a/docs/.vitepress/components/api-docs/method-parameters.vue b/docs/.vitepress/components/api-docs/method-parameters.vue index fbc28635f20..7b14133d1f5 100644 --- a/docs/.vitepress/components/api-docs/method-parameters.vue +++ b/docs/.vitepress/components/api-docs/method-parameters.vue @@ -1,7 +1,7 @@