From 94a7922b30214089fb6db388066acb88531ff745 Mon Sep 17 00:00:00 2001
From: adilallo <39313955+adilallo@users.noreply.github.com>
Date: Mon, 26 Jan 2026 15:41:25 -0700
Subject: [PATCH] Project cleanup and reorganization
---
.gitea/workflows/ci.yaml | 2 +-
.gitignore | 4 +
.lighthouserc.json | 23 --
README.md | 56 ++--
config.yaml => config/gitea-runner.yaml | 0
lighthouserc.json => config/lighthouse.json | 0
.../performance-budgets.json | 0
.../runner-config.yaml | 0
docs/README.md | 104 ++-----
docs/TESTING_QUICK_REFERENCE.md | 275 ------------------
.../content-creation.md} | 0
.../performance.md} | 0
docs/{ => guides}/testing-framework.md | 0
docs/{ => guides}/testing-quick-reference.md | 4 +-
TESTING_STRATEGY.md => docs/guides/testing.md | 0
.../visual-regression.md} | 3 +-
gitea-runner.plist | 2 +-
package.json | 6 +-
scripts/bundle-analyzer.js | 2 +-
scripts/performance-monitor.js | 2 +-
start-runner.sh => scripts/start-runner.sh | 8 +-
status-runner.sh => scripts/status-runner.sh | 4 +-
stop-runner.sh => scripts/stop-runner.sh | 0
scripts/test-lhci.js | 8 +-
24 files changed, 83 insertions(+), 420 deletions(-)
delete mode 100644 .lighthouserc.json
rename config.yaml => config/gitea-runner.yaml (100%)
rename lighthouserc.json => config/lighthouse.json (100%)
rename performance-budgets.json => config/performance-budgets.json (100%)
rename runner-config.yaml => config/runner-config.yaml (100%)
delete mode 100644 docs/TESTING_QUICK_REFERENCE.md
rename docs/{CONTENT_CREATION_GUIDE.md => guides/content-creation.md} (100%)
rename docs/{performance-optimization-guide.md => guides/performance.md} (100%)
rename docs/{ => guides}/testing-framework.md (100%)
rename docs/{ => guides}/testing-quick-reference.md (98%)
rename TESTING_STRATEGY.md => docs/guides/testing.md (100%)
rename docs/{visual-regression-guide.md => guides/visual-regression.md} (98%)
rename start-runner.sh => scripts/start-runner.sh (79%)
rename status-runner.sh => scripts/status-runner.sh (83%)
rename stop-runner.sh => scripts/stop-runner.sh (100%)
diff --git a/.gitea/workflows/ci.yaml b/.gitea/workflows/ci.yaml
index 3a5f2ce..67d5aa8 100644
--- a/.gitea/workflows/ci.yaml
+++ b/.gitea/workflows/ci.yaml
@@ -453,7 +453,7 @@ jobs:
# Run LHCI with arm64 Node + arm64 Chrome
# Test homepage and blog pages using config file
- npx lhci autorun --chrome-path="$CHROME_PATH"
+ npx lhci autorun --config=config/lighthouse.json --chrome-path="$CHROME_PATH"
kill "$SVPID" 2>/dev/null || true
env:
diff --git a/.gitignore b/.gitignore
index 0ca83f5..c0c5716 100644
--- a/.gitignore
+++ b/.gitignore
@@ -17,6 +17,9 @@
/test-results/
/playwright-report/
+# Lighthouse CI results
+/lhci-results/
+
# Ignore other image files (but not visual regression snapshots)
*.png
*.jpg
@@ -57,6 +60,7 @@ yarn-error.log*
# typescript
*.tsbuildinfo
+tsconfig.tsbuildinfo
next-env.d.ts
*storybook.log
diff --git a/.lighthouserc.json b/.lighthouserc.json
deleted file mode 100644
index 2a28412..0000000
--- a/.lighthouserc.json
+++ /dev/null
@@ -1,23 +0,0 @@
-{
- "ci": {
- "collect": {
- "url": ["http://127.0.0.1:3010/"],
- "numberOfRuns": 3,
- "settings": {
- "chromeFlags": "--no-sandbox --disable-dev-shm-usage --disable-gpu --headless"
- }
- },
- "assert": {
- "assertions": {
- "categories:performance": ["warn", { "minScore": 0.8 }],
- "categories:accessibility": ["warn", { "minScore": 0.8 }],
- "first-contentful-paint": ["warn", { "maxNumericValue": 3000 }],
- "interactive": ["warn", { "maxNumericValue": 5000 }]
- }
- },
- "upload": {
- "target": "filesystem",
- "outputDir": "lhci-results"
- }
- }
-}
diff --git a/README.md b/README.md
index 36bad6d..67888aa 100644
--- a/README.md
+++ b/README.md
@@ -56,7 +56,7 @@ npm run monitor:all # All monitoring tools
- **Performance monitoring**
- **Code coverage reporting**
-📖 **For detailed testing documentation, see [docs/TESTING.md](docs/TESTING.md)**
+📖 **For detailed testing documentation, see [docs/README.md](docs/README.md)**
## ⚡ Performance Optimizations
@@ -167,18 +167,35 @@ The Storybook configuration automatically detects the environment:
community-rule/
├── app/ # Next.js app directory
│ ├── components/ # React components
-│ ├── layout.js # Root layout
-│ └── page.js # Homepage
-├── tests/ # Test files
-│ ├── unit/ # Unit tests (8 components)
+│ ├── hooks/ # Custom React hooks
+│ ├── layout.tsx # Root layout
+│ └── page.tsx # Homepage
+├── config/ # Application configuration files
+│ ├── lighthouse.json # Lighthouse CI configuration
+│ ├── performance-budgets.json # Performance budgets
+│ └── gitea-runner.yaml # Gitea runner configuration
+├── docs/ # Documentation
+│ ├── README.md # Documentation index
+│ └── guides/ # Comprehensive guides
+│ ├── testing.md # Testing strategy
+│ ├── testing-framework.md # Testing framework details
+│ ├── testing-quick-reference.md # Quick reference
+│ ├── performance.md # Performance optimization
+│ ├── visual-regression.md # Visual testing
+│ └── content-creation.md # Content guidelines
+├── scripts/ # Utility scripts
+│ ├── start-runner.sh # Start Gitea runner
+│ ├── status-runner.sh # Check runner status
+│ └── stop-runner.sh # Stop Gitea runner
+├── tests/ # Test files
+│ ├── unit/ # Unit tests
│ ├── integration/ # Integration tests
-│ └── e2e/ # E2E tests (4 test suites)
-├── docs/ # Documentation
-│ └── TESTING.md # Comprehensive testing guide
+│ ├── e2e/ # E2E tests
+│ └── accessibility/ # Accessibility tests
├── .storybook/ # Storybook configuration
├── .gitea/ # Gitea Actions workflows
│ └── workflows/
-│ └── ci.yml # CI/CD pipeline
+│ └── ci.yaml # CI/CD pipeline
└── public/ # Static assets
```
@@ -193,15 +210,17 @@ community-rule/
## 📖 Documentation
-- **[Testing Framework](docs/TESTING.md)** - Comprehensive testing guide
+- **[Documentation Index](docs/README.md)** - Complete documentation guide
+- **[Testing Guides](docs/guides/)** - Testing strategy, framework, and quick reference
+- **[Performance Guide](docs/guides/performance.md)** - Performance optimization guide
+- **[Visual Regression Guide](docs/guides/visual-regression.md)** - Visual testing guide
- **[Storybook](http://localhost:6006)** - Component documentation (local)
-- **[GitHub Pages Storybook](https://your-username.github.io/communityrulestorybook/)** - Public component docs
## 🤝 Contributing
1. **Fork the repository**
2. **Create a feature branch**: `git checkout -b feature/amazing-feature`
-3. **Write tests first** (see [Testing Guide](docs/TESTING.md))
+3. **Write tests first** (see [Testing Guide](docs/guides/testing.md))
4. **Make your changes**
5. **Run tests**: `npm test && npm run e2e`
6. **Commit changes**: `git commit -m "feat: add amazing feature"`
@@ -219,16 +238,3 @@ community-rule/
## 📄 License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
-<<<<<<< HEAD
-
-# Test from working commit
-
-=======
-
-# Test trigger
-
-> > > > > > > bead0c737303fb7e83b3be0c5dbd121b00351b90
-
-# Test new runner
-
-# Test host mode
diff --git a/config.yaml b/config/gitea-runner.yaml
similarity index 100%
rename from config.yaml
rename to config/gitea-runner.yaml
diff --git a/lighthouserc.json b/config/lighthouse.json
similarity index 100%
rename from lighthouserc.json
rename to config/lighthouse.json
diff --git a/performance-budgets.json b/config/performance-budgets.json
similarity index 100%
rename from performance-budgets.json
rename to config/performance-budgets.json
diff --git a/runner-config.yaml b/config/runner-config.yaml
similarity index 100%
rename from runner-config.yaml
rename to config/runner-config.yaml
diff --git a/docs/README.md b/docs/README.md
index 1e05f24..2a9bd7d 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -1,86 +1,42 @@
-# Testing Documentation
+# Documentation Index
-This directory contains comprehensive testing documentation for the CommunityRule platform.
+This directory contains all project documentation organized by topic.
## 📚 Documentation Structure
-### 1. [testing-framework.md](./testing-framework.md) - **Main Guide**
+### Guides (`guides/`)
-**Complete testing framework documentation** covering all aspects of testing:
+Comprehensive guides for different aspects of the project:
-- Testing architecture and philosophy
-- Unit, integration, and E2E testing
-- Visual regression testing
-- Accessibility testing
-- Performance testing
-- CI/CD pipeline
-- Development workflow
-- Best practices and troubleshooting
+#### Testing
+- **[testing.md](./guides/testing.md)** - Complete testing strategy and philosophy
+- **[testing-framework.md](./guides/testing-framework.md)** - Detailed testing framework documentation
+- **[testing-quick-reference.md](./guides/testing-quick-reference.md)** - Quick reference for daily development
+- **[visual-regression.md](./guides/visual-regression.md)** - Visual regression testing guide
-**Use this for**: Learning the testing framework, understanding architecture, comprehensive reference
+#### Performance
+- **[performance.md](./guides/performance.md)** - Performance optimization and monitoring guide
-### 2. [testing-quick-reference.md](./testing-quick-reference.md) - **Quick Reference**
+#### Content
+- **[content-creation.md](./guides/content-creation.md)** - Content creation guidelines
-**Essential commands and quick troubleshooting** for daily development:
-
-- Essential test commands
-- Current test status and metrics
-- Common test patterns
-- Troubleshooting solutions
-- Performance budgets
-- CI/CD pipeline overview
-
-**Use this for**: Daily development, quick commands, troubleshooting, reference
-
-### 3. [visual-regression-guide.md](./visual-regression-guide.md) - **Visual Testing Guide**
-
-**Focused guide for visual regression testing**:
-
-- Visual regression workflow
-- Snapshot management
-- Configuration and best practices
-- Troubleshooting visual test issues
-- CI/CD integration for visual tests
-
-**Use this for**: Visual regression testing, snapshot management, visual test troubleshooting
-
-### 4. [performance-optimization-guide.md](./performance-optimization-guide.md) - **Performance Guide**
-
-**Comprehensive performance optimization documentation**:
-
-- Performance targets and metrics
-- Frontend optimizations (React.memo, code splitting, image optimization)
-- Performance monitoring and bundle analysis
-- Web Vitals tracking and dashboard
-- Performance testing and troubleshooting
-- Best practices and optimization strategies
-
-**Use this for**: Performance optimization, monitoring, bundle analysis, Web Vitals tracking
-
-## 🎯 How to Use These Documents
+## 🎯 Quick Navigation
### For New Team Members
-
-1. Start with **testing-framework.md** to understand the complete testing strategy
-2. Use **testing-quick-reference.md** for daily development
-3. Reference **visual-regression-guide.md** when working with visual tests
-4. Review **performance-optimization-guide.md** for performance optimization
+1. Start with **[testing.md](./guides/testing.md)** to understand the testing strategy
+2. Use **[testing-quick-reference.md](./guides/testing-quick-reference.md)** for daily development
+3. Reference **[performance.md](./guides/performance.md)** for performance optimization
### For Daily Development
+- **[testing-quick-reference.md](./guides/testing-quick-reference.md)** - Essential commands and troubleshooting
+- **[testing-framework.md](./guides/testing-framework.md)** - Detailed testing explanations
-1. Use **testing-quick-reference.md** for commands and troubleshooting
-2. Reference **testing-framework.md** for detailed explanations
-3. Use **visual-regression-guide.md** for visual test workflows
-4. Use **performance-optimization-guide.md** for performance monitoring
+### For Specific Topics
+- **Visual Testing**: [visual-regression.md](./guides/visual-regression.md)
+- **Performance**: [performance.md](./guides/performance.md)
+- **Content**: [content-creation.md](./guides/content-creation.md)
-### For Troubleshooting
-
-1. Check **testing-quick-reference.md** for common solutions
-2. Use **testing-framework.md** for detailed troubleshooting
-3. Reference **visual-regression-guide.md** for visual test issues
-4. Use **performance-optimization-guide.md** for performance issues
-
-## 📊 Current Testing Status
+## 📊 Current Project Status
- **Unit Tests**: 94.88% coverage (exceeds 85% target)
- **Integration Tests**: 5 comprehensive test suites
@@ -90,17 +46,10 @@ This directory contains comprehensive testing documentation for the CommunityRul
- **Performance**: Lighthouse CI with budgets
- **Bundle Analysis**: Real-time monitoring with budgets
- **Web Vitals Tracking**: Core Web Vitals collection
-- **Performance Optimization**: React.memo + code splitting
## 🔄 Documentation Updates
-This documentation is maintained by the CommunityRule development team and updated regularly to reflect:
-
-- Current testing framework status
-- Best practices and patterns
-- Troubleshooting solutions
-- CI/CD pipeline changes
-- New testing features
+This documentation is maintained by the CommunityRule development team and updated regularly.
## 📚 Additional Resources
@@ -108,8 +57,9 @@ This documentation is maintained by the CommunityRule development team and updat
- **Playwright Documentation**: https://playwright.dev/
- **React Testing Library**: https://testing-library.com/
- **Lighthouse CI**: https://github.com/GoogleChrome/lighthouse-ci
+- **Next.js Documentation**: https://nextjs.org/docs
---
-**Last Updated**: December 2024
+**Last Updated**: January 2025
**Maintained by**: CommunityRule Development Team
diff --git a/docs/TESTING_QUICK_REFERENCE.md b/docs/TESTING_QUICK_REFERENCE.md
deleted file mode 100644
index c51f7cc..0000000
--- a/docs/TESTING_QUICK_REFERENCE.md
+++ /dev/null
@@ -1,275 +0,0 @@
-# Testing Quick Reference
-
-## 🚀 Essential Commands
-
-### Daily Development
-
-```bash
-# Run all tests
-npm test
-
-# Watch mode (during development)
-npm run test:watch
-
-# E2E tests
-npm run e2e
-
-# Performance check
-npm run lhci
-```
-
-### Manual Runner Management
-
-```bash
-# Start runner (before creating PR)
-./start-runner.sh
-
-# Check runner status
-./status-runner.sh
-
-# Stop runner (after PR complete)
-./stop-runner.sh
-```
-
-### Visual Regression
-
-```bash
-# Update baselines after intentional changes
-npx playwright test tests/e2e/visual-regression.spec.ts --update-snapshots
-
-# Check for visual changes
-npx playwright test tests/e2e/visual-regression.spec.ts
-```
-
-### Debugging
-
-```bash
-# Debug unit tests
-npm run test:ui
-
-# Debug E2E tests
-npm run e2e:ui
-
-# Debug with browser
-npx playwright test --debug
-```
-
-## 📝 Writing Tests
-
-### Unit Test Template
-
-```jsx
-// tests/unit/Component.test.jsx
-import { render, screen } from "@testing-library/react";
-import { describe, test, expect, afterEach } from "vitest";
-import { cleanup } from "@testing-library/react";
-import Component from "../../app/components/Component";
-
-describe("Component", () => {
- afterEach(() => cleanup());
-
- test("renders correctly", () => {
- render(