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

interface member @link bug #43

Closed
wants to merge 19 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# https://editorconfig.org

root = true

[*]
charset = utf-8
indent_style = space
indent_size = 4
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[package.json]
indent_size = 2
8 changes: 4 additions & 4 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2.0.0
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 16
node-version: 20

- name: Run
run: chmod +x run.sh && ./run.sh

- name: Upload Results
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: typedoc-output
path: docs
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
node_modules
docs
build
dist
docs
*.tsbuildinfo
docs-json
39 changes: 30 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,36 @@
# TypeDoc reproductions
# TypeDoc Packages Example

If you find a bug in TypeDoc and file an issue, it's helpful -- even necessary -- to create a minimal reproduction of the bug.
This monorepo provides an example of how TypeDoc's packages mode can be used to generate documentation
for multiple projects and combine it into a single site which contains all documented projects.

This link explains why we ask for a minimal reproduction. Thank you in advance!
https://gist.github.com/Rich-Harris/88c5fc2ac6dc941b22e7996af05d70ff
You can see the result of building this at <https://gerritbirkeland.com/typedoc-packages-example/index.html>

One way to do that is opening a pull-request on this repository with your reproduction. Github Actions will execute `./run.sh`.
## Building

You can put anything you want here: add/remove dependencies in `package.json`, change the commands in `run.sh`, change the code in `./src/index.ts`,
or add a hundred more `.ts` files.
```bash
git clone [email protected]:Gerrit0/typedoc-packages-example.git
npm install

Once your pull request is submitted here, link to it in your TypeDoc bug report.
# We need to build before building the docs so that `foo` can reference types from `bar`
# TypeDoc can't use TypeScript's build mode to do this for us because build mode may skip
# a project that needs documenting, or include packages that shouldn't be included in the docs
npm run build

Forked from the [ts-node-repros](https://github.com/TypeStrong/ts-node-repros) for TypeDoc.
# Now, we can run TypeDoc with packages mode to generate a single docs folder
npm run docs
```

## Building - Advanced

If your build system requires running with multiple versions of TypeDoc, you can instead manually
generate JSON files for each package, and then run TypeDoc on the generated JSON files.

```bash
# Cross-package links will be invalid during initial conversion, they will be validated when merging
for package in packages/*; do
npx typedoc --json docs-json/$(basename $package).json --options $package/typedoc.json --validation.invalidLink false
done

# Merge previously generated documentation together into a site
npx typedoc --entryPointStrategy merge "docs-json/*.json"
```
220 changes: 220 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 13 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
{
"name": "typedoc-repros",
"name": "typedoc-packages-example",
"version": "1.0.0",
"private": true,
"workspaces": [
"packages/*"
],
"scripts": {
"build": "tsc --build",
"docs": "typedoc",
"docs-all": "npm run docs --workspaces --if-present"
},
"dependencies": {
"typedoc": "latest",
"typescript": "latest"
"typedoc": "^0.26.3",
"typescript": "^5.5.2"
}
}
3 changes: 3 additions & 0 deletions packages/lib/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# lib

Simple package which is depended upon by the `wrapping-lib` package.
8 changes: 8 additions & 0 deletions packages/lib/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "@typedoc/lib",
"version": "0.0.1",
"exports": "./dist/index.js",
"scripts": {
"docs": "typedoc --out docs"
}
}
6 changes: 6 additions & 0 deletions packages/lib/src/func.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import type { LibInt } from "./intf";

export function libFunc(): LibInt {
console.log("Bar");
return { bar: true };
}
2 changes: 2 additions & 0 deletions packages/lib/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from "./func";
export type * from "./intf";
4 changes: 4 additions & 0 deletions packages/lib/src/intf.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export interface LibInt {
/** Assigned by {@link libFunc}. */
bar: true;
}
8 changes: 8 additions & 0 deletions packages/lib/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"rootDir": "src",
"outDir": "dist"
},
"include": ["src"]
}
4 changes: 4 additions & 0 deletions packages/lib/typedoc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"extends": ["../../typedoc.base.jsonc"],
"entryPoints": ["src/index.ts"]
}
7 changes: 7 additions & 0 deletions packages/shared-assets/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# README only package

This package only contains a readme file, without any entry points. This is intended to support
packages which don't export any JS, only shared assets. See [#2264](https://github.com/TypeStrong/typedoc/issues/2264).

This package also does not contain a `docs` script in its `package.json`, so `npm run docs-all` will not run TypeDoc
within it, and therefore not generate a docs folder here.
4 changes: 4 additions & 0 deletions packages/shared-assets/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "@typedoc/shared-assets",
"version": "0.0.1"
}
5 changes: 5 additions & 0 deletions packages/shared-assets/typedoc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"extends": ["../../typedoc.base.jsonc"],
// If not set, will result in a warning being printed since it's likely a misconfiguration
"entryPoints": []
}
Loading