forked from nodegui/nodegui
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfixdocs.js
More file actions
33 lines (28 loc) · 1.01 KB
/
fixdocs.js
File metadata and controls
33 lines (28 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
const fs = require('fs');
const path = require('path');
async function renameFile(oldPath, newPath) {
return new Promise((resolve, reject) => {
fs.rename(oldPath, newPath, (err) => (err ? reject(err) : resolve()));
});
}
async function writeFile(filePath, fileContent) {
return new Promise((resolve, reject) => {
fs.writeFile(filePath, fileContent, (err) => (err ? reject(err) : resolve()));
});
}
async function moveGeneratedSideBar() {
const src = path.resolve(__dirname, `../../../website/website/sidebars.js`);
const dest = path.resolve(__dirname, `../../../website/docs/api/sidebar-gen.js`);
await renameFile(src, dest);
}
async function emptyIndexMd() {
const src = path.resolve(__dirname, `../../../website/docs/api/generated/index.md`);
await writeFile(src, '');
}
async function fixDocs() {
console.log('Fixing Docs...');
// await moveGeneratedSideBar();
await emptyIndexMd();
console.log('Docs fixed successfully.');
}
fixDocs().catch(console.error);