diff --git a/.gitignore b/.gitignore index 5beedde17..57a4c93ec 100644 --- a/.gitignore +++ b/.gitignore @@ -18,9 +18,9 @@ site/docs/generated/enums site/docs/generated/interfaces site/docs/generated/modules website/docs/generated/classes -website/docs/generated/enums -website/docs/generated/interfaces -website/docs/generated/modules +website/docs/generated/enums/*.md +website/docs/generated/interfaces/*.md +website/docs/generated/modules/*.md website/.yarn/ # testing coverage diff --git a/scripts/finalizeTypedocs.js b/scripts/finalizeTypedocs.js new file mode 100644 index 000000000..35f0888f1 --- /dev/null +++ b/scripts/finalizeTypedocs.js @@ -0,0 +1,40 @@ +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 (let 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) + } + + // Converts ugly names to clean names for example discordeno_types.ActionRow becomes ActionRow + const cleanForms = [{ ugly: 'discordeno_types.' }, { ugly: "discordeno_utils."}] + + for (const form of cleanForms) { + // Clean the file of the ugly forms + file = file.replace(new RegExp(form.ugly, 'gi'), form.clean || '') + const lastIndex = filepath.lastIndexOf("/") + // Clean the file name of the ugly forms + filepath = filepath.replace(new RegExp(form.ugly, 'gi'), form.clean || '') + } + + fs.writeFileSync(filepath, file, function (err, result) { + if (err) throw err + }) +} diff --git a/scripts/stripInternalInTypedocs.js b/scripts/stripInternalInTypedocs.js deleted file mode 100644 index c9638a9b2..000000000 --- a/scripts/stripInternalInTypedocs.js +++ /dev/null @@ -1,28 +0,0 @@ -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/website/docs/bigbot/_category_.json b/website/docs/bigbot/_category_.json index d00071685..b448253ac 100644 --- a/website/docs/bigbot/_category_.json +++ b/website/docs/bigbot/_category_.json @@ -1,6 +1,6 @@ { "label": "Big Bot Guide", - "position": 2, + "position": 3, "link": { "type": "generated-index", "description": "Learn the most important concepts and set up a base template for your bot." diff --git a/website/docs/generated/Docs.md b/website/docs/generated/Docs.md new file mode 100644 index 000000000..8b132e32e --- /dev/null +++ b/website/docs/generated/Docs.md @@ -0,0 +1,5 @@ +discordeno-monorepo / [Modules](modules.md) + +# Discordeno + +how to make this not reset? diff --git a/website/docs/generated/README.md b/website/docs/generated/README.md deleted file mode 100644 index 70d9a91ff..000000000 --- a/website/docs/generated/README.md +++ /dev/null @@ -1,5 +0,0 @@ -discordeno-monorepo / [Modules](modules.md) - -# Discordeno - -This documentation was generated automatically. If you see any mistakes, please contact us on discord/github. diff --git a/website/docs/generated/_category_.json b/website/docs/generated/_category_.json new file mode 100644 index 000000000..8aabd333f --- /dev/null +++ b/website/docs/generated/_category_.json @@ -0,0 +1,9 @@ +{ + "label": "Docs", + "position": 2, + "link": { + "type": "generated-index", + "description": "If you need any help, please contact us on [Discord](https://discord.gg/ddeno)." + } + } + \ No newline at end of file diff --git a/website/docs/generated/enums/_category_.json b/website/docs/generated/enums/_category_.json new file mode 100644 index 000000000..a7c3ef65c --- /dev/null +++ b/website/docs/generated/enums/_category_.json @@ -0,0 +1,9 @@ +{ + "label": "Enums", + "position": 1, + "link": { + "type": "generated-index", + "description": "All the enums available for use from the @discordeno/types package." + } + } + \ No newline at end of file diff --git a/website/docs/generated/interfaces/_category_.json b/website/docs/generated/interfaces/_category_.json new file mode 100644 index 000000000..424b13747 --- /dev/null +++ b/website/docs/generated/interfaces/_category_.json @@ -0,0 +1,9 @@ +{ + "label": "Interfaces", + "position": 2, + "link": { + "type": "generated-index", + "description": "All the interfaces available for use from the @discordeno/types package." + } + } + \ No newline at end of file diff --git a/website/docs/generated/modules.md b/website/docs/generated/modules.md deleted file mode 100644 index 38bb04544..000000000 --- a/website/docs/generated/modules.md +++ /dev/null @@ -1,10 +0,0 @@ -[discordeno-monorepo](README.md) / Modules - -# discordeno-monorepo - -## Table of contents - -### Modules - -- [@discordeno/types](modules/discordeno_types.md) -- [@discordeno/utils](modules/discordeno_utils.md) diff --git a/website/docs/generated/modules/_category_.json b/website/docs/generated/modules/_category_.json new file mode 100644 index 000000000..68a8c1f44 --- /dev/null +++ b/website/docs/generated/modules/_category_.json @@ -0,0 +1,9 @@ +{ + "label": "Modules", + "position": 3, + "link": { + "type": "generated-index", + "description": "All the modules(packages) available for use from @discordeno." + } + } + \ No newline at end of file diff --git a/website/docs/tutorial-extras/_category_.json b/website/docs/tutorial-extras/_category_.json index a8ffcc193..832c3d1ee 100644 --- a/website/docs/tutorial-extras/_category_.json +++ b/website/docs/tutorial-extras/_category_.json @@ -1,6 +1,6 @@ { "label": "Tutorial - Extras", - "position": 3, + "position": 4, "link": { "type": "generated-index" }