Skip to content

Commit 0985616

Browse files
committed
Handle projects without tsconfig files
Resolves #2304
1 parent bcf3e04 commit 0985616

File tree

3 files changed

+11
-12
lines changed

3 files changed

+11
-12
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
- Added `stripYamlFrontmatter` config option to remove YAML frontmatter from README.md, #2381.
66
- Added `--excludeCategories` config option to remove reflections present in any excluded category, #1407.
7+
- If no tsconfig.json file is present, TypeDoc will now attempt to compile without setting any compiler options, #2304.
78
- Navigation is now written to a JS file and built dynamically, which significantly decreases document generation time
89
with large projects and also provides large space benefits. Themes may now override `DefaultTheme.buildNavigation`
910
to customize the displayed navigation tree, #2287.

src/lib/utils/entry-point.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ function getEntryPointsForPaths(
183183
logger: Logger,
184184
inputFiles: string[],
185185
options: Options,
186-
programs = getEntryPrograms(logger, options),
186+
programs = getEntryPrograms(inputFiles, logger, options),
187187
): DocumentationEntryPoint[] {
188188
const baseDir = options.getValue("basePath") || deriveRootDir(inputFiles);
189189
const entryPoints: DocumentationEntryPoint[] = [];
@@ -234,7 +234,7 @@ export function getExpandedEntryPointsForPaths(
234234
logger: Logger,
235235
inputFiles: string[],
236236
options: Options,
237-
programs = getEntryPrograms(logger, options),
237+
programs = getEntryPrograms(inputFiles, logger, options),
238238
): DocumentationEntryPoint[] {
239239
return getEntryPointsForPaths(
240240
logger,
@@ -284,9 +284,15 @@ function expandGlobs(inputFiles: string[], exclude: string[], logger: Logger) {
284284
return result;
285285
}
286286

287-
function getEntryPrograms(logger: Logger, options: Options) {
287+
function getEntryPrograms(
288+
inputFiles: string[],
289+
logger: Logger,
290+
options: Options,
291+
) {
288292
const rootProgram = ts.createProgram({
289-
rootNames: options.getFileNames(),
293+
rootNames: options.getFileNames().length
294+
? options.getFileNames()
295+
: inputFiles,
290296
options: options.getCompilerOptions(),
291297
projectReferences: options.getProjectReferences(),
292298
});

src/lib/utils/options/readers/tsconfig.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import {
2121
tsdocModifierTags,
2222
} from "../tsdoc-defaults";
2323
import { unique } from "../../array";
24-
import { EntryPointStrategy } from "../../entry-point";
2524
import { findTsConfigFile, readTsConfig } from "../../tsconfig";
2625

2726
function isSupportForTags(obj: unknown): obj is Record<`@${string}`, boolean> {
@@ -82,13 +81,6 @@ export class TSConfigReader implements OptionsReader {
8281
logger.error(
8382
`The tsconfig file ${nicePath(file)} does not exist`,
8483
);
85-
} else if (
86-
container.getValue("entryPointStrategy") !==
87-
EntryPointStrategy.Packages
88-
) {
89-
logger.warn(
90-
"No tsconfig file found, this will prevent TypeDoc from finding your entry points.",
91-
);
9284
}
9385
return;
9486
}

0 commit comments

Comments
 (0)