Skip to content

Is it possible to read the options directly from tsconfig? #480

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

Closed
alexewerlof opened this issue Apr 16, 2017 · 1 comment
Closed

Is it possible to read the options directly from tsconfig? #480

alexewerlof opened this issue Apr 16, 2017 · 1 comment
Labels
question Question about functionality

Comments

@alexewerlof
Copy link

alexewerlof commented Apr 16, 2017

Given that most cli options are very similar to tsc, I usually end up require()ing tsconfig.json and manually map it to the typedoc options in typedoc.js. This procedure is tedious and error-prone. I was thinking if it's possible for typedoc to directly read the configs from a provided tsconfig file and take its options from there.
For example:

  • module (mode can initialize itself from module and isolatedModules tsc options)
  • target
  • includeDeclarations
  • exclude
  • include (why not?)

I'm using a couple of tsconfig files (that extend a base).

let tsconfigSrc = require('./src/tsconfig-src');
const packageJson = require('./package');


if (tsconfigSrc.extends) {
    // Error prone. This is not how extend works.
    Object.assign(require(tsconfigSrc.extends), tsconfigSrc);
}

exports.target = tsconfigSrc.compilerOptions.target;
exports.entryPoint = packageJson.main;
exports.name = `${packageJson.name} v${packageJson.version}`;
exports.mode = 'modules';
exports.module = tsconfigSrc.compilerOptions.
exports.includeDeclarations = tsconfigSrc.compilerOptions.declaration;
exports.includes = include;
exports.exclude = tsconfigSrc.exclude;
@alexewerlof
Copy link
Author

Re: #130 (comment)

This is supported but not documented. Took a while till I found it. Would be nice if the readme could be generated from "typedoc --help". 👍

--tsconfig Specify a js option file that should be loaded. If not specified TypeDoc will look for 'typedoc.js' in the current directory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Question about functionality
Projects
None yet
Development

No branches or pull requests

2 participants