const fs = require('fs') const path = require('path') const migrationLinksRecursive = (sidebarItems) => { const result = sidebarItems.map((sidebarItem) => { if (sidebarItem.type === 'category') { if (sidebarItem.label === 'How-To Guides' || sidebarItem.label === 'Tutorials') { return { type: 'link', href: sidebarItem.customProps.migration.href, label: sidebarItem.customProps.migration.label, } } return {...sidebarItem, items: migrationLinksRecursive(sidebarItem.items)} } if (sidebarItem.customProps?.migration?.href && sidebarItem.customProps?.migration?.label) { sidebarItem = { type: 'link', href: sidebarItem.customProps.migration.href, label: sidebarItem.customProps.migration.label, } } return sidebarItem }) return result } module.exports = async ({ defaultSidebarItemsGenerator, ...args }) => { if (args.version.contentPath.endsWith('docs')) { /** * Adds a custom class name to the "Tutorials" and "How-To Guides" index * pages, which we then use in the `/src/css/custom.scss` file to hide * the `