fix: cleanup typedoc script

This commit is contained in:
Skillz
2023-02-25 02:16:41 -06:00
parent 63a0b381bc
commit b8c25357c7
2 changed files with 27 additions and 1 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 --out ./website/docs/generated/ && node scripts/stripInternalInTypedocs.js"
"build:doc": "typedoc --out ./website/docs/generated/ && node scripts/finalizeTypedocs.js"
},
"devDependencies": {
"eslint": "^8.28.0",

View File

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