typedoc2md / typedoc-plugin-markdown

A plugin for TypeDoc that enables TypeScript API documentation to be generated in Markdown.
https://typedoc-plugin-markdown.org
MIT License
689 stars 172 forks source link

Error: The docs folder does not exist when the `out` folder does not exists #641

Closed axel7083 closed 2 days ago

axel7083 commented 3 days ago

What package is the bug related to?

typedoc-plugin-markdown

Describe the issue

Our pipeline started failing when migrating from 0.25.13 to 0.26.3 so I tried locally to update to typedoc-plugin-markdown version 4.1.X as recommended in the compatibility matrix https://typedoc-plugin-markdown.org/docs/versioning#compatibility-table.

However when the api folder, where the markdown should be generated does not exist (folder not created before running docusaurus build we are getting the following error

$ docusaurus build
[INFO] [en] Creating an optimized production build...

[ERROR] Error: Unable to build website for locale en.
    at tryToBuildLocale (~\podman-desktop\node_modules\@docusaurus\core\lib\commands\build.js:54:19)
    at async ~\node_modules\@docusaurus\core\lib\commands\build.js:65:9
    at async mapAsyncSequential (~\podman-desktop\node_modules\@docusaurus\utils\lib\jsUtils.js:20:24)
    at async Command.build (~\podman-desktop\node_modules\@docusaurus\core\lib\commands\build.js:63:5) {
  [cause]: Error: The docs folder does not exist for version "current". A docs folder is expected to be found at api.

This can be fixed by making mkdir api && docusaurus build but this seems to be a regression as we were not needed this before

TypeDoc configuration

[
      'docusaurus-plugin-typedoc',
      {
        id: 'api',
        plugin: ['typedoc-plugin-markdown'],
        entryPoints: [resolve('../packages/extension-api/src/extension-api.d.ts')],
        out: 'api',
        hideBreadcrumbs: true,
        readme: 'none',
        tsconfig: resolve('../packages/extension-api/tsconfig.json'),
        hideGenerator: true,
      },
    ],

Expected behavior

The out folder should be created by the plugin before docusaurus get mad that it does not exists

tgreyuk commented 2 days ago

This has been caused by some updates in TypeDoc 0.26 causing the lifecycle to run before TypeDoc has finished generating files. To fix for now the directory will be created if it doesn't exist. Available in docusaurus-plugin-typedoc@1.0.2

axel7083 commented 2 days ago

Fixes the issue 👍