Skip to content

Commit 16e21ac

Browse files
JoeDibleyjtvioletclaudejames-s-anderson
authored
Single Product Builds (#193)
* added cross-env, simple per-product build * Update readme with new help info * Remove the start-product and start-product-chok as they are the same as start and start-chok * Add note about warning on first run 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> --------- Co-authored-by: Jordan Violet <8886650+jtviolet@users.noreply.github.com> Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: James Anderson <james.s.anderson@netwrix.com>
1 parent 46ef9fd commit 16e21ac

File tree

3 files changed

+30
-2
lines changed

3 files changed

+30
-2
lines changed

README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ npm run start
9191
```bash
9292
# Development
9393
npm run start # Start development server
94+
npm run start-chok # Start development server with polling (for network drives)
9495

9596
# Building & Testing
9697
npm run build # Full production build
@@ -100,6 +101,26 @@ npm run clear # Clear Docusaurus cache
100101
npm run serve # Serve production build after `npm run build`
101102
```
102103

104+
### Building/Running Specific Products
105+
106+
You can build or run the documentation for a single product using the `DOCS_PRODUCT` environment variable:
107+
108+
**Windows (PowerShell):**
109+
```powershell
110+
$ENV:DOCS_PRODUCT="pingcastle"
111+
npm run start
112+
```
113+
114+
**Unix/Linux/macOS:**
115+
```bash
116+
export DOCS_PRODUCT="pingcastle"
117+
npm run start
118+
```
119+
120+
This works with any command (`start`, `start-chok`, `build`) and speeds up development when working on a single product. Available product IDs can be found in `src/config/products.js`.
121+
122+
*Note: you may get a warning when you first run this. This warning doesn't seem to appear again and the site worked as expected*
123+
103124
### Development Workflow
104125

105126
The centralized system makes development simple:

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
"scripts": {
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",
9-
"build": "NODE_OPTIONS=--max-old-space-size=16384 npx docusaurus build",
9+
"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=16384 npx docusaurus build",
1011
"swizzle": "npx docusaurus swizzle",
1112
"clear": "npx docusaurus clear",
1213
"serve": "npx serve -s build -l 8080",

src/config/products.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -704,8 +704,14 @@ export function getDefaultProduct() {
704704
*/
705705
export function generateDocusaurusPlugins() {
706706
const plugins = [];
707+
708+
// Filter products if DOCS_PRODUCT environment variable is set
709+
const targetProduct = process.env.DOCS_PRODUCT;
710+
const productsToProcess = targetProduct
711+
? PRODUCTS.filter(product => product.id === targetProduct)
712+
: PRODUCTS;
707713

708-
PRODUCTS.forEach((product) => {
714+
productsToProcess.forEach((product) => {
709715
product.versions.forEach((version) => {
710716
const pluginId = generatePluginId(product.id, version.version);
711717
const routeBasePath = generateRouteBasePath(product.path, version.version);

0 commit comments

Comments
 (0)