fix: some work hacking docs fix

This commit is contained in:
Skillz4Killz
2023-02-25 03:57:40 +00:00
parent cd65e8d5fe
commit a379022d03
6 changed files with 51 additions and 15 deletions

View File

@@ -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"
}
}

View File

@@ -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/<id> 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/<id> 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

View File

@@ -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 });
}

View File

@@ -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/"
}

View File

@@ -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)

View File

@@ -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"