-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathremove-deprecated.js
More file actions
24 lines (21 loc) · 895 Bytes
/
remove-deprecated.js
File metadata and controls
24 lines (21 loc) · 895 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
const fs = require('fs');
const path = require('path');
const removeFromSidebar = (type, name) => {
const sidebarContent = fs.readFileSync('./docs/graphql/sidebar-schema.js', 'utf-8')
const newSidebarContent = sidebarContent.split('\n').filter(line => !line.includes(`"graphql/${type}/${name}",`)).join('\n')
fs.writeFileSync('./docs/graphql/sidebar-schema.js', newSidebarContent)
}
const removeDeprecated = (type) => {
const basePath = `./docs/graphql/${type}`
const files = fs.readdirSync(basePath);
for (const fileName of files) {
const filePath = path.join(basePath, fileName);
const content = fs.readFileSync(filePath, 'utf8');
if (content.includes('DEPRECATED')) {
removeFromSidebar(type, path.parse(filePath).name)
fs.rmSync(filePath);
}
}
}
removeDeprecated('queries');
removeDeprecated('mutations');