Skip to content

Entry point is not parsed correctly when entryPointStrategy is packages #2043

@Losses

Description

@Losses

Search terms

entryPointStrategy, packages

Expected Behavior

The package.json should be parsed correctly

Actual Behavior

An error appeared:

error Unable to find any entry points. Make sure TypeDoc can find your tsconfig

Steps to reproduce the bug

  1. My document is placed in packages/documents;
  2. Other packages are placed in packages/a, packages/b, packages/c;
  3. Entry point is setted to:
{
  entryPoints: ['../a', '../b', '../c']
}
  1. The package parsing call stack is:
    a. getEntryPointsForPackages , With the following code:
    const expandedPackages = expandPackages(
        logger,
        ".",
        packageGlobPaths,
        exclude
    );

The second parameter packageJsonDir is ., this may assume that the package we want to generate documentation for is a subdirectory of the current directory, but in some cases this assumption does not hold, the following call stack proofed this:

b. expandPackages: It is to trying to parse a glob pattern:

        const globbedPackageJsonPaths = glob(
            resolve(packageJsonDir, workspace, "package.json"),
            resolve(packageJsonDir)
        );

The first parameter of this glob is:

ROOT_PATH_OF_THE_PROJECT\packages\a\package.json

The second parameter of this glob is:

ROOT_PATH_OF_THE_PROJECT\packages\documents

The home-made glob function simply won't return anything, and caused the parsing work failed.

Environment

  • Typedoc version: typedoc@npm:0.23.11
  • TypeScript version: typescript@npm:4.6.4
  • Node.js version: v16.15.0
  • OS: Windows 11

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions