Skip to content

Commit

Permalink
[Lexical][Meta] Fix errors in intern meta static docs related to pack…
Browse files Browse the repository at this point in the history
…ages and apis related autogenerated docs
  • Loading branch information
Sahejkm committed Jun 12, 2024
1 parent 25ba423 commit 02f4797
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 41 deletions.
80 changes: 48 additions & 32 deletions packages/lexical-website/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -170,15 +172,20 @@ const sidebarItemsGenerator = async ({
/** @type {Partial<import('docusaurus-plugin-typedoc/dist/types').PluginOptions>} */
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',
Expand Down Expand Up @@ -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() {
Expand All @@ -260,7 +269,7 @@ const config = {
name: 'docusaurus-tailwindcss',
};
},
],
].filter((plugin) => plugin != null),

presets: [
[
Expand All @@ -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'),
Expand Down Expand Up @@ -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'},
{
Expand Down
24 changes: 15 additions & 9 deletions packages/lexical-website/sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit 02f4797

Please sign in to comment.