marcj / typedoc-plugin-lerna-packages

A plugin for Typedoc that groups all Lerna packages into own TS module
MIT License
28 stars 15 forks source link

Supporting Typedoc v0.20.x #34

Open favna opened 3 years ago

favna commented 3 years ago

Typedoc did it once again, they released a new version that breaks this extremely useful plugin in many ways. To keep up to date with things it would be nice if this library would be updated to support the latest Typedoc.

For the migration guide for Typedoc see: https://github.com/TypeStrong/typedoc/releases/tag/v0.20.0

marcj commented 3 years ago

Uh, that's pretty big change for a minor version.

favna commented 3 years ago

Sadly... That's how semver works. Any minor version bump in the 0.x.y major version is basically the same as a major version bump starting 1.x.y.

jevonearth commented 3 years ago

Hi @marcj

Is v0.20.0 on the horizon?

efokschaner commented 3 years ago

Note there's also a discussion in the main project about potentially having core support for monorepos https://github.com/TypeStrong/typedoc/issues/1548 (I suggested via Yarn workspaces perhaps)

marcj commented 3 years ago

Yupp, it seems typedoc supports that now out of the box. The following command builds the docs correctly:

typedoc --packages 'packages/*
efokschaner commented 3 years ago

Also, if your root package.json defines your workspaces, you can pass the dir of the root package json, eg. typedoc --packages .

favna commented 3 years ago

I tried this in https://github.com/sapphiredev/utilities and it tried to build a file in node_modules which then failed because it couldn't find a matching tsconfig file.

Typedoc's solution also reads the "main" property in each workspace packages' package.json which will obviously go to the dist/index.js like file for publishing but that caused it to crash and burn hard because it wasn't reading source TS files anymore.

marcj commented 3 years ago

@Favna you have to build TS before using typedoc then.

marcj commented 3 years ago

@Favna I took a look in your repo, and there are a few errors:

favna commented 3 years ago

@marcj Thanks for looking into it. I've tried again but I can't get it to work quite yet. I've pushed my changes to a branch if you want to have another look: https://github.com/sapphiredev/utilities/tree/feat/upgrade-typedoc

I have removed all the tsconfig.json files from the src directories. The were there because of composite builds, but I moved all those properties to the each package's own tsconfig.json now.

Some observations:

Note if you're checking out the branch, to make it compile note the thing of typeRoots, what works for compiling is putting this in packages/discord-utilities/tsconfig.json:

{
    "extends": "../ts-config/src/tsconfig.json",
    "compilerOptions": {
        "target": "ES2020",
        "module": "ESNext",
        "rootDir": "src",
        "outDir": "dist",
        "tsBuildInfoFile": "dist/.tsbuildinfo",
        "composite": true
    },
    "include": ["src", "types"]
}