diff --git a/package.json b/package.json index d47ec7e82..634040427 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 --out ./website/docs/generated/ && node scripts/stripInternalInTypedocs.js" + "build:doc": "typedoc --out ./website/docs/generated/ && node scripts/finalizeTypedocs.js" }, "devDependencies": { "eslint": "^8.28.0", diff --git a/scripts/finalizeTypedocs.js b/scripts/finalizeTypedocs.js index 35f0888f1..c1e823e1e 100644 --- a/scripts/finalizeTypedocs.js +++ b/scripts/finalizeTypedocs.js @@ -17,6 +17,32 @@ async function* walk(dir) { for await (let filepath of walk(typedocOutPath)) { let file = fs.readFileSync(filepath, 'utf-8') + // Removes the old file in case it had ugly name, will be recreated below + fs.rmSync(filepath); + + if (filepath.endsWith('generated/README.md')) { + file = [ + "discordeno-monorepo / [Modules](modules.md)", + "", + "# Discordeno", + "", + "Thank you for using Discordeno. These docs are generated automatically. If you see any issues please contact us on [Discord](https://discord.gg/ddeno)" + ].join('\n'); + filepath = filepath.replace("README", "Docs") + } + // These files should be simply deleted. + const filesToDelete = [ + // "README", + // "modules" + ]; + let deleted = false; + + for (const filename of filesToDelete) { + if (filepath.endsWith(`generated/${filename}.md`)) deleted = true; + } + // Skip the rest if this file should be deleted + if (deleted) continue; + // add all the words we need to replace here for invalid jsx errors const words = ['internal'] for (const word of words) {