Local Verification Guide
This guide shows you how to run all the preview pipeline checks locally before committing and pushing to your remote branch.
📦 Prerequisites
The required tools are already included as devDependencies in package.json:
markdownlint-cli- Markdown lintingcspell- Spell checkingsvgo- SVG optimization
Install all dependencies:
npm install
# or
yarn install
After installation, you can run the tools using npx (no global installation needed).
Preview Pipeline Verification Steps
The '**' pipeline (Test on a PR) runs these checks in order:
1. ✅ Markdown Linting
What it checks: Markdown syntax violations (blank lines around lists, code block languages, etc.)
Run locally:
# Using npx (recommended - uses local devDependency)
npx markdownlint --ignore 'solutions/legacy' 'solutions/**/*.md*'
Quick fix: Use the automated fixer
node scripts/fix-markdown-linting.js --verbose
2. ✅ Spell Checking
What it checks: Spelling errors in markdown files using a custom dictionary
Run locally:
# Using npx (recommended - uses local devDependency)
npx cspell lint --no-progress --config ./cspell.json "solutions/**/*.md*"
Fix spelling errors:
- Fix typos in your content
- Add technical terms to
cspell.jsonif they're valid words:{
"words": [
"TOTP",
"FIPS",
"your-technical-term"
]
}
3. ✅ SVG Optimization
What it checks: Optimizes SVG files for better performance
Run locally:
# Using npx (recommended - uses local devDependency)
# On macOS/Linux with fd installed
brew install fd # or apt-get install fd-find on Linux
fd -e svg -0 | xargs -0 -P $(nproc) -n 10 npx svgo
# Alternative using find (works everywhere)
find . -name "*.svg" -type f -exec npx svgo {} \;
Note: This step modifies SVG files in place. Commit the optimized files.
4. ✅ Build the Site
What it checks: Ensures the Docusaurus site builds without errors
Run locally:
# Set Node memory limit (important for large builds)
export NODE_OPTIONS="--max-old-space-size=12288"
# Build the site
yarn build
# Or with npm
npm run build
Common build errors:
- Broken links
- Missing images
- Invalid front matter
- TypeScript errors in custom components
5. ✅ Search Index Generation
What it checks: Creates the search index for the site
Run locally:
# Generate search index
node scripts/build-search-index.js
Note: This creates build/search-index.json
6. ✅ Preview Environment Setup
What it checks: Creates fallback API responses for preview deployment
Run locally:
# Set up preview environment
node scripts/deploy-preview.js
Note: This creates files in build/api/ directory
🚀 Quick Verification Script
A verification script is included at scripts/local-verify.sh that runs all checks in sequence.
Usage:
# Make sure dependencies are installed first
npm install
# Run the verification script
./scripts/local-verify.sh
The script will:
- Check markdown linting
- Check spelling
- Optimize SVGs
- Build the site
- Generate search index
- Set up preview environment
All checks use the local devDependencies via npx, so no global installations are needed.
📋 Pre-Commit Checklist
Before committing and pushing:
- Run markdown linting:
markdownlint --ignore 'solutions/legacy' 'solutions/**/*.md*' - Run spell check:
cspell lint --no-progress --config ./cspell.json "solutions/**/*.md*" - Build the site:
yarn build - Check for TypeScript errors:
yarn typecheck(if applicable) - Test locally:
yarn startand verify your changes - Review git diff:
git diffto ensure only intended changes
🐛 Common Issues and Fixes
Issue: Markdown linting fails
Solution:
# Run the automated fixer
node scripts/fix-markdown-linting.js --verbose
# Then verify
npx markdownlint --ignore 'solutions/legacy' 'solutions/**/*.md*'
Issue: Spell check fails
Solution:
- Fix actual typos in your content
- Add technical terms to
cspell.json:{
"words": [
"Eyeglass",
"Cyberstorage",
"PowerScale",
"TOTP",
"FIPS"
]
}
Issue: Build fails with memory error
Solution:
# Increase Node memory limit
export NODE_OPTIONS="--max-old-space-size=16384"
yarn build
Issue: Build fails with broken links
Solution:
- Check file paths in your markdown
- Ensure linked files exist
- Use relative paths correctly
Issue: TypeScript errors
Solution:
# Run type checking
yarn typecheck
# Fix type errors in your code
🎯 Recommended Workflow
-
Install dependencies (first time only):
npm install -
Make your changes to documentation files
-
Fix markdown formatting:
node scripts/fix-markdown-linting.js -
Run quick checks:
npx markdownlint --ignore 'solutions/legacy' 'solutions/**/*.md*'
npx cspell lint --no-progress --config ./cspell.json "solutions/**/*.md*" -
Test build:
npm run build -
Preview locally:
npm start
# Open http://localhost:3000 and verify your changes -
Run full verification (optional but recommended):
./scripts/local-verify.sh -
Commit and push:
git add .
git commit -m "your commit message"
git push -
Check pipeline in Bitbucket to see preview URL
📚 Additional Commands
Serve production build locally
# Build first
yarn build
# Serve (macOS/Linux)
yarn serve
# Serve (Windows)
yarn serve-win
Generate sitemap
node scripts/generate-sitemap.js
Test client search
node scripts/test-client-search.js
Run with search indexing
npm run start-with-indexing
🔍 What the Pipeline Does NOT Check Locally
These steps only run in the Bitbucket pipeline:
- Firebase deployment - Requires credentials
- Preview URL generation - Handled by Firebase hosting
- Pipeline artifacts - Stored in Bitbucket
Everything else can be verified locally before pushing!