UNPKG

@casoon/auditmysite

Version:

A comprehensive command-line tool for automated accessibility, security, performance, and SEO testing using Playwright and pa11y, based on sitemap URLs

154 lines (121 loc) β€’ 5.39 kB
# Accessibility Test CLI - Source Structure This documentation describes the new structured folder organization of the Accessibility Test CLI. ## πŸ“ Ordnerstruktur ``` src/ β”œβ”€β”€ index.ts # Haupt-Einstiegspunkt β”œβ”€β”€ types.ts # TypeScript Typen und Interfaces β”œβ”€β”€ README.md # Diese Dokumentation β”œβ”€β”€ core/ # Kern-FunktionalitΓ€t β”‚ β”œβ”€β”€ index.ts # Core-Module Export β”‚ β”œβ”€β”€ accessibility-checker.ts β”‚ └── standard-pipeline.ts β”œβ”€β”€ parsers/ # Parser fΓΌr verschiedene Datenquellen β”‚ β”œβ”€β”€ index.ts # Parser-Module Export β”‚ └── sitemap-parser.ts β”œβ”€β”€ generators/ # Output-Generatoren β”‚ β”œβ”€β”€ index.ts # Generator-Module Export β”‚ └── output-generator.ts β”œβ”€β”€ reports/ # Report-Generatoren β”‚ β”œβ”€β”€ index.ts # Report-Module Export β”‚ └── detailed-report.ts └── tests/ # Accessibility-Test-Suite β”œβ”€β”€ index.ts # Test-Module Export β”œβ”€β”€ base-test.ts # Basis-Test-Klasse β”œβ”€β”€ test-manager.ts # Test-Manager β”œβ”€β”€ README.md # Test-Dokumentation β”œβ”€β”€ form/ # Formular-Tests β”œβ”€β”€ keyboard/ # Keyboard Navigation Tests β”œβ”€β”€ aria/ # ARIA Tests β”œβ”€β”€ semantic/ # Semantic HTML Tests β”œβ”€β”€ media/ # Media Accessibility Tests β”œβ”€β”€ language/ # Language & i18n Tests (geplant) β”œβ”€β”€ performance/ # Performance Tests (geplant) └── validation/ # Validation Tests (geplant) ``` ## πŸ—οΈ Module Organization ### **Core Module** (`src/core/`) Core functionality for accessibility testing: - **AccessibilityChecker**: Main test engine with Playwright and pa11y - **StandardPipeline**: Standardized test pipeline for automated execution ### **Parsers** (`src/parsers/`) Parsers for different data sources: - **SitemapParser**: XML sitemap parser with URL filtering and conversion ### **Generators** (`src/generators/`) Output generators for different formats: - **OutputGenerator**: Markdown, JSON, CSV, HTML output generation ### **Reports** (`src/reports/`) Specialized report generators: - **DetailedReportGenerator**: AI-optimized detailed error reports ### **Tests** (`src/tests/`) Modular accessibility test suite: - **BaseAccessibilityTest**: Base class for all tests - **TestManager**: Coordination and execution of tests - Categorized tests (form, keyboard, aria, semantic, media) ## πŸ”„ Import Structure ### **Index Files** Each folder has an `index.ts` file that exports all modules: ```typescript // src/core/index.ts export { AccessibilityChecker } from './accessibility-checker'; export { StandardPipeline } from './standard-pipeline'; // src/parsers/index.ts export { SitemapParser } from './sitemap-parser'; // src/generators/index.ts export { OutputGenerator } from './output-generator'; // src/reports/index.ts export { DetailedReportGenerator } from './detailed-report'; ``` ### **Import Examples** ```typescript // From core import { AccessibilityChecker, StandardPipeline } from './core'; // From parsers import { SitemapParser } from './parsers'; // From generators import { OutputGenerator } from './generators'; // From reports import { DetailedReportGenerator } from './reports'; // From tests import { TestManager, FormLabelTest } from './tests'; ``` ## 🎯 Benefits of the New Structure ### **Organization** - βœ… **Logical Grouping**: Similar functionality is grouped together - βœ… **Clear Responsibilities**: Each folder has a specific purpose - βœ… **Easy Navigation**: Intuitive folder structure ### **Maintainability** - βœ… **Modular Architecture**: Individual modules can be changed independently - βœ… **Index Files**: Central export points for easy imports - βœ… **Clear Dependencies**: Import paths show relationships ### **Extensibility** - βœ… **New Parsers**: Easy to add in `parsers/` - βœ… **New Generators**: Easy to add in `generators/` - βœ… **New Tests**: Easy to add in `tests/` - βœ… **New Reports**: Easy to add in `reports/` ### **Testability** - βœ… **Isolated Modules**: Each module can be tested independently - βœ… **Clear Interfaces**: Index files define public APIs - βœ… **Structured Tests**: Test suite is self-organized ## πŸš€ Migration The migration to the new structure was seamless: 1. **Files moved** to appropriate folders 2. **Index files created** for easy imports 3. **Import paths updated** in all files 4. **CLI paths adjusted** for the new structure ## πŸ“ˆ Next Steps The new structure enables easy extensions: 1. **New Parsers**: RSS, JSON, CSV parsers in `parsers/` 2. **New Generators**: PDF, Excel generators in `generators/` 3. **New Reports**: Compliance reports in `reports/` 4. **New Tests**: Color contrast, language tests in `tests/` ## πŸ”§ Development ### **Adding a New Module** 1. Create file in the appropriate folder 2. Export in `index.ts` 3. Import in other modules ### **Adding a New Test** 1. Create test class in appropriate `tests/` subfolder 2. Inherit from `BaseAccessibilityTest` 3. Register in `TestManager` 4. Export in `tests/index.ts`