diff --git a/packages/lexical-website/docusaurus.config.js b/packages/lexical-website/docusaurus.config.js index b830e4ce2..440865ffe 100644 --- a/packages/lexical-website/docusaurus.config.js +++ b/packages/lexical-website/docusaurus.config.js @@ -13,7 +13,9 @@ const {github: lightCodeTheme, dracula: darkCodeTheme} = require('prism-react-renderer').themes; const slugifyPlugin = require('./src/plugins/lexical-remark-slugify-anchors'); -const {packagesManager} = require('../../scripts/shared/packagesManager'); +const {packagesManager} = process.env.FB_INTERNAL + ? {} + : require('../../scripts/shared/packagesManager'); const path = require('node:path'); const TITLE = 'Lexical'; @@ -170,15 +172,20 @@ const sidebarItemsGenerator = async ({ /** @type {Partial} */ const docusaurusPluginTypedocConfig = { ...sourceLinkOptions(), - entryPoints: packagesManager - .getPublicPackages() - .flatMap((pkg) => - pkg - .getExportedNpmModuleEntries() - .map((entry) => [ - path.relative(__dirname, pkg.resolve('src', entry.sourceFileName)), - ]), - ), + entryPoints: process.env.FB_INTERNAL + ? [] + : packagesManager + .getPublicPackages() + .flatMap((pkg) => + pkg + .getExportedNpmModuleEntries() + .map((entry) => [ + path.relative( + __dirname, + pkg.resolve('src', entry.sourceFileName), + ), + ]), + ), excludeInternal: true, plugin: [ './src/plugins/lexical-typedoc-plugin-no-inherit', @@ -233,21 +240,23 @@ const config = { onBrokenMarkdownLinks: 'throw', organizationName: 'facebook', plugins: [ - [ - './plugins/package-docs', - /** @type {import('./plugins/package-docs').PackageDocsPluginOptions} */ - { - baseDir: path.resolve(__dirname, '..'), - editUrl: `${GITHUB_REPO_URL}/tree/main/packages/`, - packageFrontMatter: { - lexical: [ - 'sidebar_position: 1', - 'sidebar_label: lexical (core)', - ].join('\n'), - }, - targetDir: path.resolve(__dirname, 'docs/packages'), - }, - ], + process.env.FB_INTERNAL + ? null + : [ + './plugins/package-docs', + /** @type {import('./plugins/package-docs').PackageDocsPluginOptions} */ + { + baseDir: path.resolve(__dirname, '..'), + editUrl: `${GITHUB_REPO_URL}/tree/main/packages/`, + packageFrontMatter: { + lexical: [ + 'sidebar_position: 1', + 'sidebar_label: lexical (core)', + ].join('\n'), + }, + targetDir: path.resolve(__dirname, 'docs/packages'), + }, + ], './plugins/webpack-buffer', ['docusaurus-plugin-typedoc', docusaurusPluginTypedocConfig], async function tailwindcss() { @@ -260,7 +269,7 @@ const config = { name: 'docusaurus-tailwindcss', }; }, - ], + ].filter((plugin) => plugin != null), presets: [ [ @@ -274,6 +283,7 @@ const config = { docs: { beforeDefaultRemarkPlugins: [slugifyPlugin], editUrl: `${GITHUB_REPO_URL}/tree/main/packages/lexical-website/`, + exclude: ['/error'], path: 'docs', sidebarItemsGenerator, sidebarPath: require.resolve('./sidebars.js'), @@ -377,12 +387,18 @@ const config = { sidebarId: 'docs', type: 'docSidebar', }, - { - label: 'API', - position: 'left', - sidebarId: 'api', - type: 'docSidebar', - }, + process.env.FB_INTERNAL + ? { + href: 'https://lexical.dev/docs/api/', + label: 'API', + position: 'left', + } + : { + label: 'API', + position: 'left', + sidebarId: 'api', + type: 'docSidebar', + }, {label: 'Community', position: 'left', to: '/community'}, { diff --git a/packages/lexical-website/sidebars.js b/packages/lexical-website/sidebars.js index 7e05594b2..2aa36f7ba 100644 --- a/packages/lexical-website/sidebars.js +++ b/packages/lexical-website/sidebars.js @@ -53,16 +53,22 @@ const sidebars = { label: 'Concepts', type: 'category', }, - { - items: [ - { - dirName: 'packages', - type: 'autogenerated', + process.env.FB_INTERNAL + ? { + href: 'https://lexical.dev/docs/packages/lexical', + label: 'Packages', + type: 'link', + } + : { + items: [ + { + dirName: 'packages', + type: 'autogenerated', + }, + ], + label: 'Packages', + type: 'category', }, - ], - label: 'Packages', - type: 'category', - }, { items: [{dirName: 'react', type: 'autogenerated'}], label: 'React',