-
-
Notifications
You must be signed in to change notification settings - Fork 750
Description
Search terms
composite, json, resolveJsonModule
Expected Behavior
Running typedoc on my project with npx typedoc --json docs/apidoc.json should generate a JSON file.
Actual Behavior
Typedoc fails with an error:
Using TypeScript 3.9.5 from /Users/jason/Temp/intern/intern/node_modules/.pnpm/typescript@3.9.5/node_modules/typescript/lib
Error: /Users/jason/Temp/intern/intern/packages/digdug/src/SeleniumTunnel.ts(11)
File '/Users/jason/Temp/intern/intern/packages/digdug/src/webdrivers.json' is not listed within the file list of project '/Users/jason/Temp/intern/intern/packages/digdug/tsconfig.json'. Projects must list all files or use an 'include' pattern.
The tsconfig.json file did incluede the file in question:
{
"extends": "@theintern-dev/tsconfig",
"compilerOptions": {
"lib": ["es2015"],
"outDir": "./dist",
"rootDir": "src",
"typeRoots": ["./node_modules/@types", "./types"]
},
"references": [{ "path": "../common" }],
"include": ["./src/**/*.ts", "./src/webdrivers.json"]
}The issue is that the include list isn't being passed directly to the TS compiler. The set of input files is processed by Application.expandInputFiles before being sent to the TS compiler, and expandInputFiles doesn't include JSON files in its expansion. In a composite project, the TS compiler will fail if if the set of input files doesn't include every file that's part of the build (including JSON files). Manually adding the JSON file to the result of expandInputFiles in CliApplication.bootstrap causes the doc build to run successfully.
Steps to reproduce the bug
- Create a composite TS project in which one module imports a JSON file
- Try to build with typedoc (e.g.,
typedoc --json docs/apidoc.json)
Environment
- Typedoc version: 0.17.7
- TypeScript version: 3.9.5
- Node.js version: 14.4.0
- OS: macOS 10.15.4