diff --git a/package.json b/package.json index b82e69eb1..d47ec7e82 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ "test:test-type": "turbo run test:test-type", "format": "prettier --write \"**/*.{ts,tsx,md}\"", "prepare": "husky install", - "build:doc": "typedoc --plugin typedoc-plugin-markdown --out ./website/docs/generated/ " + "build:doc": "typedoc --out ./website/docs/generated/ && node scripts/stripInternalInTypedocs.js" }, "devDependencies": { "eslint": "^8.28.0", @@ -44,5 +44,8 @@ "eslint --fix --config ./packages/eslint-config-discordeno/index.js --resolve-plugins-relative-to ." ] }, - "packageManager": "yarn@3.3.0" + "packageManager": "yarn@3.3.0", + "dependencies": { + "typedoc-plugin-missing-exports": "^1.0.0" + } } diff --git a/packages/types/src/discord.ts b/packages/types/src/discord.ts index e589ec471..045df04fc 100644 --- a/packages/types/src/discord.ts +++ b/packages/types/src/discord.ts @@ -563,9 +563,9 @@ export interface DiscordGuild { premium_subscription_count?: number /** The maximum amount of users in a video channel */ max_video_channel_users?: number - /** Approximate number of members in this guild, returned from the GET /guilds/ endpoint when with_counts is true */ + /** Approximate number of members in this guild, returned from the GET /guilds/id endpoint when with_counts is true */ approximate_member_count?: number - /** Approximate number of non-offline members in this guild, returned from the GET /guilds/ endpoint when with_counts is true */ + /** Approximate number of non-offline members in this guild, returned from the GET /guilds/id endpoint when with_counts is true */ approximate_presence_count?: number /** Guild NSFW level */ nsfw_level: GuildNsfwLevel diff --git a/scripts/stripInternalInTypedocs.js b/scripts/stripInternalInTypedocs.js new file mode 100644 index 000000000..c9638a9b2 --- /dev/null +++ b/scripts/stripInternalInTypedocs.js @@ -0,0 +1,28 @@ +import fs from 'node:fs' +import path from 'node:path' + +// these two paths may vary depending on where you place this script, and your project structure including where typedoc generates its output files. +const typedocOutPath = await import('../typedoc.json', { + assert: { type: 'json' }, +}).then((module) => module.default.out) + +async function* walk(dir) { + for await (const d of await fs.promises.opendir(dir)) { + const entry = path.join(dir, d.name); + if (d.isDirectory()) yield* walk(entry); + else if (d.isFile()) yield entry; + } +} + +for await (const filepath of walk(typedocOutPath)) { + let file = fs.readFileSync(filepath, 'utf-8') + + // add all the words we need to replace here for invalid jsx errors + const words = ["internal"]; + for (const word of words) { + file = file.replace(new RegExp(`<${word}>`, 'gi'), word); + } + + fs.writeFileSync(filepath, file, function (err, result) { if (err) throw err }); +} + diff --git a/typedoc.json b/typedoc.json index 916176cc1..49f5d79ba 100644 --- a/typedoc.json +++ b/typedoc.json @@ -1,12 +1,12 @@ { "entryPointStrategy": "packages", "entryPoints": [ - "packages/bot", - "packages/client", - "packages/discordeno", - "packages/gateway", - "packages/rest", "packages/types", "packages/utils" - ] + ], + "logger": "console", + "skipErrorChecking": true, + "cleanOutputDir": true, + "excludeNotDocumented": true, + "out": "./website/docs/generated/" } diff --git a/website/docs/generated/modules.md b/website/docs/generated/modules.md index 2947394b8..38bb04544 100644 --- a/website/docs/generated/modules.md +++ b/website/docs/generated/modules.md @@ -6,10 +6,5 @@ ### Modules -- [@discordeno/bot](modules/discordeno_bot.md) -- [@discordeno/client](modules/discordeno_client.md) -- [@discordeno/gateway](modules/discordeno_gateway.md) -- [@discordeno/rest](modules/discordeno_rest.md) - [@discordeno/types](modules/discordeno_types.md) - [@discordeno/utils](modules/discordeno_utils.md) -- [discordeno](modules/discordeno.md) diff --git a/yarn.lock b/yarn.lock index 8370c9e8f..38ab1fa3d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1692,6 +1692,7 @@ __metadata: turbo: ^1.6.3 typedoc: ^0.23.21 typedoc-plugin-markdown: ^3.13.6 + typedoc-plugin-missing-exports: ^1.0.0 typescript: ^4.9.3 languageName: unknown linkType: soft @@ -5323,6 +5324,15 @@ __metadata: languageName: node linkType: hard +"typedoc-plugin-missing-exports@npm:^1.0.0": + version: 1.0.0 + resolution: "typedoc-plugin-missing-exports@npm:1.0.0" + peerDependencies: + typedoc: 0.22.x || 0.23.x + checksum: 11ef3ba347a88924397f2f2f84216e5d41f9714baba671e4f9a86dd4de22d5e5e47477a295776c4f489be91065a152fedcbfa9aa6cba90499894e6670441ce31 + languageName: node + linkType: hard + "typedoc@npm:^0.23.21": version: 0.23.23 resolution: "typedoc@npm:0.23.23"