Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSON files are removed from the input files list #1323

Closed
jason0x43 opened this issue Jun 22, 2020 · 1 comment
Closed

JSON files are removed from the input files list #1323

jason0x43 opened this issue Jun 22, 2020 · 1 comment
Labels
bug Functionality does not match expectation

Comments

@jason0x43
Copy link
Contributor

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

  1. Create a composite TS project in which one module imports a JSON file
  2. 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
@jason0x43 jason0x43 added the bug Functionality does not match expectation label Jun 22, 2020
@Gerrit0
Copy link
Collaborator

Gerrit0 commented Jun 29, 2020

Fix released in 0.17.8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Functionality does not match expectation
Projects
None yet
Development

No branches or pull requests

2 participants