question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Allow to specify a custom `tsconfig` in packages mode for monorepos

See original GitHub issue

Search Terms

Monorepo, tsconfig, custom path

Problem

When operating in monorepo mode (multiple packages), each package may contain several tsconfig files. For instance, Nx generates 3 tsconfig files per TypeScript project:

  • tsconfig.json - base configuration, extends workspace’s root tsconfig;
  • tsconfig.lib.json - production code configuration, extends package’s tsconfig.json;
  • tsconfig.spec.json - tests configuration, extends package’s tsconfig.json.

When one generates documentation for several packages, TypeDoc uses tsconfig.json instead of desired tsconfig.lib.json without ability to override the file name (or location).

Suggested Solution

Allow to override package’s tsconfig file name (location) via package.json settings:

{
  "name": "@org/package-a",
  "typedoc": {
    "entryPoint": "./src/index.ts",
    "readmeFile": "./README.md",
    "tsconfig": "./tsconfig.lib.json"
  }
}

So that TypeDoc will be more monorepo-friendly and multi-config-friendly.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:8

github_iconTop GitHub Comments

1reaction
Gerrit0commented, Sep 29, 2022

The relevant code starts at https://github.com/TypeStrong/typedoc/blob/master/src/lib/utils/entry-point.ts#L323, seems reasonable to treat this option like the readmeFile is tested today

1reaction
avchugaevcommented, Sep 27, 2022

@avchugaev Hi!, i’m considering it, but haven’t tried yet. have you tried?

Yep, I managed to generate docs for all libraries from Nx workspace and deploy them to GitHub pages.

But to achieve this, I had to rename tsconfig* files in every library so that TypeDoc resolved the right tsconfig.json. So it pushed me to override default configs generated and maintained by Nx.

Read more comments on GitHub >

github_iconTop Results From Across the Web

The Ultimate Guide to TypeScript Monorepos
I've written a couple of posts about how to set up JavaScript and TypeScript Monorepos over the past three years (#1, #2, #3,...
Read more >
Custom tsconfig.json name #1251 - parcel-bundler ... - GitHub
Ideally, there should be a command line option to specify the name and path of the tsconfig.json file. Context. Compiling and bundling ...
Read more >
Setting up a monorepo with Lerna for a TypeScript project
Learn how to setup a monorepo with Lerna and configure it for ... Independent mode allows us to have different versions per package....
Read more >
How to set up a TypeScript monorepo and make Go ... - Medium
First thing's first, let's setup the monorepo. You can use Lerna or yarn workspaces to create the monorepo structure and symlink the packages...
Read more >
Monorepo Typescript how to build package together?
I have Pacakage 'A' And app 'B'. 'Package A' index.ts export default "foo". A's package.json main: index.ts types: index.ts. A's tsconfig.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found