Skip to content

Commit 4800dd8

Browse files
Jake Mahonclaude
authored andcommitted
Implement KB-only build option for memory optimization
- Add special case for DOCS_PRODUCT=kb to build only Knowledge Base - Drastically reduces memory usage by avoiding all product documentation - Prevents duplicate KB plugin when building KB exclusively - Should allow successful builds on memory-constrained environments 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent 9c18488 commit 4800dd8

File tree

2 files changed

+42
-17
lines changed

2 files changed

+42
-17
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"docusaurus": "npx docusaurus",
88
"start": "cross-env NODE_OPTIONS=--max-old-space-size=16384 CHOKIDAR_USEPOLLING=false npx docusaurus start --port=4500 --no-open",
99
"start-chok": "cross-env NODE_OPTIONS=--max-old-space-size=16384 CHOKIDAR_USEPOLLING=true npx docusaurus start --port=4500 --no-open",
10-
"build": "cross-env NODE_OPTIONS=\"--max-old-space-size=31744 --max_old_space_size=31744\" DOCS_PRODUCT=auditor npx docusaurus build",
10+
"build": "cross-env NODE_OPTIONS=\"--max-old-space-size=16384\" DOCS_PRODUCT=kb npx docusaurus build",
1111
"build-full": "cross-env NODE_OPTIONS=\"--max-old-space-size=31744 --max_old_space_size=31744\" npx docusaurus build",
1212
"swizzle": "npx docusaurus swizzle",
1313
"clear": "npx docusaurus clear",

src/config/products.js

Lines changed: 41 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -721,7 +721,30 @@ export function generateDocusaurusPlugins() {
721721

722722
// Filter products if DOCS_PRODUCT environment variable is set
723723
const targetProduct = process.env.DOCS_PRODUCT;
724-
const productsToProcess = targetProduct
724+
725+
// Special case: if DOCS_PRODUCT=kb, build only KB plugin
726+
if (targetProduct === 'kb') {
727+
// Add KB plugin for centralized Knowledge Base content
728+
plugins.push([
729+
'@docusaurus/plugin-content-docs',
730+
{
731+
id: 'kb',
732+
path: 'docs/kb',
733+
routeBasePath: 'docs/kb',
734+
sidebarPath: false, // KB uses individual sidebars in product plugins
735+
editUrl: 'https://github.com/netwrix/docs/tree/main/',
736+
exclude: ['**/CLAUDE.md', '**/docs-staging/**'],
737+
versions: {
738+
current: {
739+
label: 'Knowledge Base',
740+
},
741+
},
742+
},
743+
]);
744+
return plugins;
745+
}
746+
747+
const productsToProcess = targetProduct
725748
? PRODUCTS.filter(product => product.id === targetProduct)
726749
: PRODUCTS;
727750

@@ -753,23 +776,25 @@ export function generateDocusaurusPlugins() {
753776
});
754777
});
755778

756-
// Add KB plugin for centralized Knowledge Base content
757-
plugins.push([
758-
'@docusaurus/plugin-content-docs',
759-
{
760-
id: 'kb',
761-
path: 'docs/kb',
762-
routeBasePath: 'docs/kb',
763-
sidebarPath: false, // KB uses individual sidebars in product plugins
764-
editUrl: 'https://github.com/netwrix/docs/tree/main/',
765-
exclude: ['**/CLAUDE.md', '**/docs-staging/**'],
766-
versions: {
767-
current: {
768-
label: 'Knowledge Base',
779+
// Add KB plugin for centralized Knowledge Base content (only if not building KB exclusively)
780+
if (targetProduct !== 'kb') {
781+
plugins.push([
782+
'@docusaurus/plugin-content-docs',
783+
{
784+
id: 'kb',
785+
path: 'docs/kb',
786+
routeBasePath: 'docs/kb',
787+
sidebarPath: false, // KB uses individual sidebars in product plugins
788+
editUrl: 'https://github.com/netwrix/docs/tree/main/',
789+
exclude: ['**/CLAUDE.md', '**/docs-staging/**'],
790+
versions: {
791+
current: {
792+
label: 'Knowledge Base',
793+
},
769794
},
770795
},
771-
},
772-
]);
796+
]);
797+
}
773798

774799
return plugins;
775800
}

0 commit comments

Comments
 (0)