Skip to content

Commit

Permalink
Handle projects without tsconfig files
Browse files Browse the repository at this point in the history
Resolves #2304
  • Loading branch information
Gerrit0 committed Sep 4, 2023
1 parent bcf3e04 commit 0985616
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

- Added `stripYamlFrontmatter` config option to remove YAML frontmatter from README.md, #2381.
- Added `--excludeCategories` config option to remove reflections present in any excluded category, #1407.
- If no tsconfig.json file is present, TypeDoc will now attempt to compile without setting any compiler options, #2304.
- Navigation is now written to a JS file and built dynamically, which significantly decreases document generation time
with large projects and also provides large space benefits. Themes may now override `DefaultTheme.buildNavigation`
to customize the displayed navigation tree, #2287.
Expand Down
14 changes: 10 additions & 4 deletions src/lib/utils/entry-point.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ function getEntryPointsForPaths(
logger: Logger,
inputFiles: string[],
options: Options,
programs = getEntryPrograms(logger, options),
programs = getEntryPrograms(inputFiles, logger, options),
): DocumentationEntryPoint[] {
const baseDir = options.getValue("basePath") || deriveRootDir(inputFiles);
const entryPoints: DocumentationEntryPoint[] = [];
Expand Down Expand Up @@ -234,7 +234,7 @@ export function getExpandedEntryPointsForPaths(
logger: Logger,
inputFiles: string[],
options: Options,
programs = getEntryPrograms(logger, options),
programs = getEntryPrograms(inputFiles, logger, options),
): DocumentationEntryPoint[] {
return getEntryPointsForPaths(
logger,
Expand Down Expand Up @@ -284,9 +284,15 @@ function expandGlobs(inputFiles: string[], exclude: string[], logger: Logger) {
return result;
}

function getEntryPrograms(logger: Logger, options: Options) {
function getEntryPrograms(
inputFiles: string[],
logger: Logger,
options: Options,
) {
const rootProgram = ts.createProgram({
rootNames: options.getFileNames(),
rootNames: options.getFileNames().length
? options.getFileNames()
: inputFiles,
options: options.getCompilerOptions(),
projectReferences: options.getProjectReferences(),
});
Expand Down
8 changes: 0 additions & 8 deletions src/lib/utils/options/readers/tsconfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import {
tsdocModifierTags,
} from "../tsdoc-defaults";
import { unique } from "../../array";
import { EntryPointStrategy } from "../../entry-point";
import { findTsConfigFile, readTsConfig } from "../../tsconfig";

function isSupportForTags(obj: unknown): obj is Record<`@${string}`, boolean> {
Expand Down Expand Up @@ -82,13 +81,6 @@ export class TSConfigReader implements OptionsReader {
logger.error(
`The tsconfig file ${nicePath(file)} does not exist`,
);
} else if (
container.getValue("entryPointStrategy") !==
EntryPointStrategy.Packages
) {
logger.warn(
"No tsconfig file found, this will prevent TypeDoc from finding your entry points.",
);
}
return;
}
Expand Down

0 comments on commit 0985616

Please sign in to comment.