Docs update script (#312)

* fix build issues

* Fix docs script
This commit is contained in:
Atul R
2019-12-29 10:45:40 +05:30
committed by GitHub
parent 9fada0e168
commit 7680c0e6ed
11 changed files with 518 additions and 8 deletions
+33
View File
@@ -0,0 +1,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);