Skip to content

Commit ae4f98a

Browse files
build(typedoc): migrate to tsdown
1 parent 9d61cf8 commit ae4f98a

File tree

14 files changed

+62
-49
lines changed

14 files changed

+62
-49
lines changed

.changeset/giant-drinks-wish.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@tanstack/typedoc-config': patch
3+
---
4+
5+
build: migrate to tsdown

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
"publint": "catalog:",
5050
"sherif": "catalog:",
5151
"tinyglobby": "catalog:",
52+
"tsdown": "catalog:",
5253
"typescript": "catalog:",
5354
"typescript-eslint": "catalog:"
5455
}

packages/eslint-config/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,7 @@
5353
},
5454
"devDependencies": {
5555
"@types/eslint": "catalog:",
56-
"eslint": "catalog:",
57-
"tsdown": "catalog:"
56+
"eslint": "catalog:"
5857
},
5958
"peerDependencies": {
6059
"eslint": "^8.0.0 || ^9.0.0"

packages/eslint-config/tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"extends": "../../tsconfig.json",
33
"compilerOptions": {
4+
"allowImportingTsExtensions": true,
45
"isolatedDeclarations": true
56
},
67
"include": ["src"]

packages/typedoc-config/package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,21 @@
1717
"scripts": {
1818
"test:types": "tsc",
1919
"test:eslint": "eslint --concurrency=auto ./src",
20-
"test:build": "publint --strict"
20+
"build": "tsdown"
2121
},
2222
"type": "module",
23+
"main": "./dist/index.js",
24+
"module": "./dist/index.js",
25+
"types": "./dist/index.d.ts",
2326
"exports": {
24-
".": {
25-
"import": {
26-
"types": "./src/index.d.ts",
27-
"default": "./src/index.js"
28-
}
29-
},
27+
".": "./dist/index.js",
28+
"./typedoc-custom-settings": "./dist/typedoc-custom-settings.js",
3029
"./package.json": "./package.json"
3130
},
3231
"preferGlobal": false,
3332
"sideEffects": false,
3433
"files": [
34+
"dist",
3535
"src"
3636
],
3737
"engines": {
Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,12 @@ import { resolve } from 'node:path'
22
import { fileURLToPath } from 'node:url'
33
import { mkdir, rm } from 'node:fs/promises'
44
import * as TypeDoc from 'typedoc'
5+
import type { PluginOptions } from 'typedoc-plugin-markdown'
6+
import type { Options } from './types.ts'
57

68
const __dirname = fileURLToPath(new URL('.', import.meta.url))
79

8-
/**
9-
* @type {Partial<import("typedoc").TypeDocOptions & import("typedoc-plugin-markdown").PluginOptions>}
10-
*/
11-
const settings = {
10+
const settings: Partial<TypeDoc.TypeDocOptions & PluginOptions> = {
1211
plugin: [
1312
'typedoc-plugin-markdown',
1413
'typedoc-plugin-frontmatter',
@@ -23,11 +22,9 @@ const settings = {
2322
excludePrivate: true,
2423
}
2524

26-
/**
27-
* @param {import('./index.js').Options} options
28-
* @returns {Promise<void>}
29-
*/
30-
export const generateReferenceDocs = async (options) => {
25+
export const generateReferenceDocs = async (
26+
options: Options,
27+
): Promise<void> => {
3128
for (const pkg of options.packages) {
3229
// Clean and recreate the output directories
3330
try {

packages/typedoc-config/src/typedoc-custom-settings.js

Lines changed: 0 additions & 20 deletions
This file was deleted.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { MarkdownPageEvent } from 'typedoc-plugin-markdown'
2+
import type { MarkdownApplication } from 'typedoc-plugin-markdown'
3+
4+
export function load(app: MarkdownApplication): void {
5+
// Add `id` and `title` to frontmatter
6+
app.renderer.on(MarkdownPageEvent.BEGIN, (page: MarkdownPageEvent) => {
7+
page.frontmatter = {
8+
id: page.model.name,
9+
title: page.model.name,
10+
}
11+
page.contents =
12+
'<!-- DO NOT EDIT: this page is autogenerated from the type comments -->\n\n'
13+
})
14+
}
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,3 @@ export type Options = {
1212
/** Override branch for GitHub links */
1313
gitBranch?: string
1414
}
15-
16-
export function generateReferenceDocs(config: Options): Promise<void>
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
22
"extends": "../../tsconfig.json",
33
"compilerOptions": {
4-
"checkJs": true
4+
"allowImportingTsExtensions": true,
5+
"isolatedDeclarations": true
56
},
6-
"include": ["src", "*.config.*"]
7+
"include": ["src"]
78
}

0 commit comments

Comments
 (0)