Conversation
Add npm scripts to clean build artifacts before building. This prevents the glob-stream stack overflow error that occurs when the docs/ directory accumulates too many files from previous builds. - npm run clean: removes docs/ and .cache/ directories - npm run build:clean: cleans then builds in one command
✅ Deploy Preview for rp-cloud ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
📝 WalkthroughWalkthroughTwo npm scripts were added to Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
package.json (1)
9-9: Optional: Consider Antora's built-in--cleanflag as an alternative.The implementation correctly uses
&&to chain the clean and build steps. However, note that Antora has a built-in--cleanoption (visible ingulpfile.js:14). You could potentially use:"build:clean": "antora --to-dir docs --fetch --clean local-antora-playbook.yml"However, Antora's
--cleanflag may not remove the.cachedirectory, so the current approach of manually cleaning bothdocs/and.cache/before building provides more thorough cleanup and is likely the better solution for addressing the glob-stream stack overflow issue mentioned in the PR objectives.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@package.json` at line 9, The review suggests Antora's built-in --clean flag but notes it may not remove .cache; update the package.json "build:clean" script to either (a) switch to using "antora --clean" and also explicitly remove the .cache directory before running Antora, or (b) keep the current chained clean+build approach but add a short comment in package.json explaining that manual removal of docs/ and .cache is intentional to avoid the glob-stream stack overflow; reference the "build:clean" script, the "antora --clean" flag, and the ".cache" and "docs/" directories so the rationale and change are easy to find.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@package.json`:
- Line 7: The clean script in package.json uses the Unix-specific command "rm
-rf" which breaks on Windows; replace it with a cross-platform tool (e.g., add
rimraf or del-cli as a devDependency) and update the "clean" npm script to call
that tool (e.g., use "rimraf docs .cache" or "del-cli docs .cache") so the
"clean" script works on all platforms; ensure you add the chosen package to
devDependencies and update the "clean" entry in package.json accordingly.
- Around line 7-11: The clean script currently removes docs and .cache but not
the gulp default output, so update the "clean" npm script to also remove the
gulp output directory (./build/site) to keep build and start workflows
consistent; modify the "clean" value in package.json (referencing the "clean"
script) to delete docs, .cache and build/site so both npm run build and npm
start produce fresh outputs when preceded by npm run clean.
---
Nitpick comments:
In `@package.json`:
- Line 9: The review suggests Antora's built-in --clean flag but notes it may
not remove .cache; update the package.json "build:clean" script to either (a)
switch to using "antora --clean" and also explicitly remove the .cache directory
before running Antora, or (b) keep the current chained clean+build approach but
add a short comment in package.json explaining that manual removal of docs/ and
.cache is intentional to avoid the glob-stream stack overflow; reference the
"build:clean" script, the "antora --clean" flag, and the ".cache" and "docs/"
directories so the rationale and change are easy to find.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
| "description": "Redpanda documentation", | ||
| "license": "ISC", | ||
| "scripts": { | ||
| "clean": "rm -rf docs .cache", |
There was a problem hiding this comment.
Critical: Use a cross-platform solution for the clean script.
The rm -rf command is Unix/Linux/macOS specific and will fail on Windows, blocking Windows developers from using this script.
🔧 Proposed fix using rimraf for cross-platform compatibility
Install rimraf as a dev dependency:
npm install --save-dev rimrafThen update the script:
- "clean": "rm -rf docs .cache",
+ "clean": "rimraf docs .cache",Alternatively, use del-cli:
npm install --save-dev del-cli- "clean": "rm -rf docs .cache",
+ "clean": "del docs .cache",🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@package.json` at line 7, The clean script in package.json uses the
Unix-specific command "rm -rf" which breaks on Windows; replace it with a
cross-platform tool (e.g., add rimraf or del-cli as a devDependency) and update
the "clean" npm script to call that tool (e.g., use "rimraf docs .cache" or
"del-cli docs .cache") so the "clean" script works on all platforms; ensure you
add the chosen package to devDependencies and update the "clean" entry in
package.json accordingly.
| "clean": "rm -rf docs .cache", | ||
| "build": "antora --to-dir docs --fetch local-antora-playbook.yml", | ||
| "build:clean": "npm run clean && npm run build", | ||
| "serve": "wds --node-resolve --open / --watch --root-dir docs --port 5002", | ||
| "start": "cross-env-shell LIVERELOAD=true npx gulp" |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Description: Verify which directories are created by build vs. start scripts
# Check the playbook configuration
echo "=== Checking playbook configuration ==="
if [ -f "local-antora-playbook.yml" ]; then
echo "Playbook exists. Checking output.dir configuration:"
rg -A 2 "^output:" local-antora-playbook.yml || echo "No output.dir configured (defaults to ./build/site for gulp)"
else
echo "Playbook file not found"
fi
# Check what directories currently exist
echo -e "\n=== Current output directories ==="
ls -la | rg "^d.*(docs|build|\.cache)" || echo "No output directories found"
# Check gulpfile for confirmation
echo -e "\n=== Gulpfile output directory logic ==="
rg -A 1 "outputDir.*=.*playbook" gulpfile.jsRepository: redpanda-data/cloud-docs
Length of output: 480
Major: Inconsistent output directories between build and start workflows.
The clean script removes docs/ and .cache/, which aligns with the build script (Line 8: --to-dir docs). However, the start script (Line 11) uses gulp with the local-antora-playbook.yml configuration. Since the playbook does not set an explicit output.dir, gulp defaults to ./build/site. This means:
npm run clean && npm run build✅ works correctlynpm run clean && npm start❌ leaves stale files in./build/site
The clean script should be updated to remove both output directories:
Proposed fix
- "clean": "rm -rf docs .cache",
+ "clean": "rm -rf docs build .cache",📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| "clean": "rm -rf docs .cache", | |
| "build": "antora --to-dir docs --fetch local-antora-playbook.yml", | |
| "build:clean": "npm run clean && npm run build", | |
| "serve": "wds --node-resolve --open / --watch --root-dir docs --port 5002", | |
| "start": "cross-env-shell LIVERELOAD=true npx gulp" | |
| "clean": "rm -rf docs build .cache", | |
| "build": "antora --to-dir docs --fetch local-antora-playbook.yml", | |
| "build:clean": "npm run clean && npm run build", | |
| "serve": "wds --node-resolve --open / --watch --root-dir docs --port 5002", | |
| "start": "cross-env-shell LIVERELOAD=true npx gulp" |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@package.json` around lines 7 - 11, The clean script currently removes docs
and .cache but not the gulp default output, so update the "clean" npm script to
also remove the gulp output directory (./build/site) to keep build and start
workflows consistent; modify the "clean" value in package.json (referencing the
"clean" script) to delete docs, .cache and build/site so both npm run build and
npm start produce fresh outputs when preceded by npm run clean.
Summary
npm run cleanscript to removedocs/and.cache/directoriesnpm run build:cleanscript that cleans then builds in one commandThis prevents the glob-stream stack overflow error that occurs when the
docs/directory accumulates too many files from previous builds.Usage
When you encounter the stack overflow error during build:
Or manually clean first:
🤖 Generated with Claude Code