Wiki Documentation Lifecycle Workflow
Complete guide for updating and deploying the PermitProof documentation wiki.
๐ Quick Referenceโ
Daily Workflow (Most Common)โ
# 1. Edit docs
vim docs/tdd/production-readiness.md
# 2. Commit
git commit -m "Update docs"
# 3. Smart deploy (auto-syncs + auto-detects rebuild)
./cli/sdlc/wiki/deploy-to-firebase-smart.sh # โก 10-40 sec
# Note: This script automatically syncs docs/ first, then builds if needed
When to Use Each Commandโ
| Command | When to Use | Time | What It Does |
|---|---|---|---|
deploy-to-firebase-smart.sh | โญ 99% of docs updates | ~10-40s | Auto-syncs + auto-detects if rebuild needed |
deploy-to-firebase.sh --skip-functions | Force rebuild | ~30-60s | Build + deploy hosting only |
deploy-to-firebase.sh (no flags) | Allowlist changes | ~3-4 min | Full deployment with functions |
rebuild-wiki.sh | โ ๏ธ Dependency issues ONLY | ~2-3 min | Clears node_modules + reinstalls (does NOT deploy) |
Important: rebuild-wiki.sh is NOT for regular deployments! It only refreshes dependencies when you have corruption or need to update packages. After running it, you still need to run a deploy command.
๐ Complete Lifecycleโ
Step 1: Edit Documentationโ
Edit any markdown files in the docs/ folder:
vim docs/tdd/production-readiness.md
# or create new
vim docs/new-feature-guide.md
Step 2: Commit Changes (Auto-Syncs)โ
git add docs/
git commit -m "Update production readiness documentation"
What happens automatically:
Post-commit hook runs
โ
Detects changes in docs/
โ
Runs sync-docs-to-wiki.sh
โ
rsync docs/ โ wiki/docs/
โ
Shows deployment reminder
Step 3: Deploy (Choose Your Speed)โ
โก Smart Deploy (Recommended for Docs Updates)โ
./cli/sdlc/wiki/deploy-to-firebase-smart.sh
Time: ~10-40 seconds (depending on if rebuild needed)
Smart features:
- ๐ Auto-syncs docs/ to wiki/docs/ first
- ๐ง Auto-detects if docs changed since last build
- โญ๏ธ Skips rebuild if docs unchanged (~10-20s)
- โ Rebuilds if docs changed (~30-40s)
- โญ๏ธ Always skips Cloud Functions
Use --force to force rebuild even if docs haven't changed.
๐ง Full Deploy (When Allowlist Changes)โ
./cli/sdlc/wiki/deploy-to-firebase.sh
Time: ~3-4 minutes
Includes everything:
- โ Cloud Functions TypeScript compile
- โ Cloud Functions deployment
- โ Docusaurus build
- โ Firebase Hosting deployment
Use when you've modified:
wiki/functions/src/index.ts(allowlist changes)wiki/src/theme/Root.tsx(auth logic changes)
โก Performance Optimizationsโ
1. Docusaurus Build Cachingโ
Docusaurus automatically caches builds in .docusaurus/ folder:
- First build: ~10-15 seconds
- Incremental builds: ~5-8 seconds (only changed files)
- Clean build: Delete
.docusaurus/to force full rebuild
# Force clean build (rarely needed)
cd wiki
rm -rf .docusaurus
npm run build
2. Skip Functions for Speedโ
99% of the time, you're just updating documentation, not the allowlist.
Use --skip-functions to save 2-3 minutes:
# Before (slow)
./cli/sdlc/wiki/deploy-to-firebase.sh # 3-4 minutes
# After (fast)
./cli/sdlc/wiki/deploy-to-firebase.sh --skip-functions # 30-60 seconds
3. Skip Build for Hotfixesโ
If you've already built and just need to redeploy:
./cli/sdlc/wiki/deploy-to-firebase.sh --skip-build --skip-functions # ~10-20s
๐ Auto-Deploy Optionsโ
Manual Deploy (Default - Recommended)โ
# Commit syncs docs
git commit -m "Update docs"
# Deploy manually when ready
./cli/sdlc/wiki/deploy-to-firebase.sh --skip-functions
Pros:
- โ Control over what gets published
- โ Can preview locally before deploying
- โ Batch multiple commits before deploying
Auto-Deploy (Optional)โ
Enable in your shell profile (~/.bashrc or ~/.zshrc):
export AUTO_DEPLOY_FIREBASE=true
Then every commit to docs/ automatically:
- Syncs to wiki
- Builds Docusaurus
- Deploys to Firebase
Pros:
- โ Hands-free, always up-to-date
- โ No manual deployment step
Cons:
- โ ๏ธ Every commit goes live immediately
- โ ๏ธ Can't preview before publishing
๐ Deployment Time Breakdownโ
Full Deployment (~3-4 minutes)โ
Cloud Functions build: ~30s
Cloud Functions deploy: ~2-3 min โ Slowest part
Docusaurus build: ~30-40s
Firebase Hosting deploy: ~10-20s
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Total: ~3-4 min
Fast Deployment (~30-60 seconds)โ
Cloud Functions: SKIPPED โ Saves 2-3 min!
Docusaurus build: ~30-40s
Firebase Hosting deploy: ~10-20s
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Total: ~30-60s
๐ฏ Recommended Workflowsโ
For Different Use Casesโ
Regular Doc Updates (95% of commits):
git commit -m "Update docs"
./cli/sdlc/wiki/deploy-to-firebase.sh --skip-functions # โก Fast
Adding Users to Allowlist:
# Edit wiki/functions/src/index.ts
git commit -m "Add user to wiki allowlist"
./cli/sdlc/wiki/deploy-to-firebase.sh # ๐ง Full (no flags)
Urgent Hotfix (Already Built):
# Fix typo directly in wiki/docs/
./cli/sdlc/wiki/deploy-to-firebase.sh --skip-build --skip-functions # โกโก Super fast
Preview Before Deploy:
git commit -m "Update docs"
cd wiki && npm start # Preview at localhost:3000
# If looks good:
./cli/sdlc/wiki/deploy-to-firebase.sh --skip-functions
๐ Command Referenceโ
# Deployment (Daily Use)
./cli/sdlc/wiki/deploy-to-firebase-smart.sh # โญ RECOMMENDED: Smart deploy (auto-sync + auto-build)
./cli/sdlc/wiki/deploy-to-firebase-smart.sh --force # Force rebuild even if docs unchanged
./cli/sdlc/wiki/deploy-to-firebase.sh --skip-functions # Fast deploy (force rebuild)
./cli/sdlc/wiki/deploy-to-firebase.sh # Full deploy (with functions)
./cli/sdlc/wiki/deploy-to-firebase.sh --skip-build # Skip Docusaurus build
./cli/sdlc/wiki/deploy-to-firebase.sh --help # Show all options
# Manual sync (without commit)
./cli/sdlc/wiki/sync-docs-to-wiki.sh # Syncs docs/ to wiki/docs/ with MDX escaping
# Local preview
cd wiki && npm start # Opens localhost:3000
# Dependency Management (Rarely Needed!)
./cli/sdlc/wiki/rebuild-wiki.sh # โ ๏ธ ONLY for dependency issues
# Deletes node_modules + reinstalls
# Does NOT sync docs or deploy!
When to use rebuild-wiki.sh:
- โ NOT for regular doc updates
- โ NOT when docs change
- โ ONLY when you have npm dependency corruption
- โ
ONLY when you need to update
package.jsondependencies - โ ONLY when Docusaurus build fails with module errors
After running rebuild-wiki.sh, you still need to run a deployment command!
๐ก Pro Tipsโ
- Use
--skip-functionsby default - Only deploy functions when allowlist changes - Preview locally first - Run
npm startto check changes before deploying - Batch commits - Make several doc updates, then deploy once
- Check build cache -
.docusaurus/makes incremental builds fast - Monitor deployment - Firebase shows progress and completion status
๐ Troubleshootingโ
Deployment taking too long?โ
# Use smart deploy (recommended) - only rebuilds if docs changed
./cli/sdlc/wiki/deploy-to-firebase-smart.sh
# Or skip functions for docs-only updates
./cli/sdlc/wiki/deploy-to-firebase.sh --skip-functions
Build is slow?โ
Docusaurus caches builds automatically. First build is slow, subsequent builds are faster.
# Check cache exists
ls -la wiki/.docusaurus/
# If corrupted, delete and rebuild
rm -rf wiki/.docusaurus
npm run build
Module/dependency errors?โ
Symptoms:
Module not founderrorsCannot find packageerrors- Build fails with npm/node errors
Solution:
# 1. Rebuild dependencies (deletes node_modules and reinstalls)
./cli/sdlc/wiki/rebuild-wiki.sh
# 2. Then deploy normally
./cli/sdlc/wiki/deploy-to-firebase-smart.sh
MDX syntax errors (like {variable} is not defined)?โ
Symptoms:
- Wiki page shows "This page crashed"
- Browser console shows
{file_id} is not definedor similar
Cause: Curly braces in docs are treated as JSX variables by MDX
Solution: The sync-docs-to-wiki.sh script automatically escapes these. If you see this error:
# 1. The escape script was already updated to handle {variable} patterns
# 2. Just redeploy - it will auto-escape
./cli/sdlc/wiki/deploy-to-firebase-smart.sh
The script escapes patterns like {file_id}, {projectId}, etc. to \{file_id\}, \{projectId\} automatically.
Functions failing to deploy?โ
Functions rarely change. If deployment fails:
# Deploy functions separately
cd wiki/functions
npm run build
firebase deploy --only functions:checkWikiAccess --project construction-code-expert-dev
๐ Expected Performanceโ
Build Times (With Cache)โ
| Build Type | Time | When |
|---|---|---|
| First build | ~10-15s | After npm install or cache clear |
| Incremental | ~5-8s | Normal docs updates |
| No changes | ~3-5s | Rebuild same content |
Deployment Timesโ
| Type | Time | Frequency |
|---|---|---|
| Functions | ~2-3 min | Rare (allowlist changes only) |
| Hosting | ~10-20s | Every docs update |
| Total (full) | ~3-4 min | Initial + allowlist changes |
| Total (fast) | ~30-60s | Regular docs updates |
๐ฏ TL;DR - The Playbookโ
For 99% of doc updates:
# 1. Edit & commit (IDE or terminal)
git commit -m "Update docs"
# 2. Smart deploy (auto-detects changes)
./cli/sdlc/wiki/deploy-to-firebase-smart.sh
# Done! โ
Live in 10-40 seconds
For allowlist updates:
# Edit wiki/functions/src/index.ts
git commit -m "Add user to allowlist"
./cli/sdlc/wiki/deploy-to-firebase.sh # Full deploy
Simple as that! ๐