Project Name is a web application that
- User Experience: Creating intuitive and accessible interfaces
- Performance: Ensuring fast load times and smooth interactions
- Modularity: Building components that are reusable and maintainable
- Testing: Thoroughly testing all features before deployment
- Documentation: Providing clear and comprehensive documentation
/
βββ www/ # Web assets
β βββ components/ # Web components
β β βββ site-footer.css
β β βββ site-footer.js
β β βββ site-header.css
β β βββ site-header.js
β βββ scripts/ # JavaScript files
β β βββ async.js
β β βββ index.js
β βββ styles/ # CSS files
β β βββ all.css
β β βββ light.css
β β βββ print.css
β β βββ wide.css
β βββ icon/ # PWA icons
β βββ 192.png
β βββ 512.png
βββ test/ # Test files
β βββ index.spec.js
βββ bin/ # Build scripts and utilities
βββ netlify/ # Netlify configuration
β βββ functions/ # Serverless functions
- Component Structure: [Describe your component architecture]
- State Management: [Describe your state management approach]
- Routing: [Describe your routing system]
- Frontend: HTML/CSS/JavaScript with [framework/library]
- State Management: [Your state management solution]
- Storage: [Your storage solution]
- Testing: Playwright for end-to-end testing
- Module System: ES modules for direct imports
- Web Components: Custom elements for modular UI components
- Progressive Enhancement: Features that work without JavaScript when possible
- Offline-First: Core functionality available offline
- Test-Driven Development: Red/green testing approach for all new features
- Indentation: Use tabs for indentation, not spaces
- File Organization: Group related functionality together
- Component Structure: Each component should serve a singular purpose
- Files: Use kebab-case for filenames (
component-name.js
, notcomponentName.js
) - Components: Use PascalCase for component names (
ComponentName
, notcomponentName
) - Functions: Use camelCase for function names (
handleEvent
, nothandle_event
) - CSS Classes: Use kebab-case for CSS classes (
.component-wrapper
, not.componentWrapper
) - Constants: Use UPPER_SNAKE_CASE for constants (
MAXIMUM_ITEMS
, notmaximumItems
) - Test Files: Use the same naming as the page they test with
.spec.js
suffix (page-name.spec.js
)
- ES Modules: Use ES modules exclusively for imports/exports
- Modern JavaScript: Embrace template literals, destructuring, and other modern features
- Function Creation: Only create new functions for code reuse (at least two call sites)
- JSDoc Comments: Include JSDoc type annotations to ensure code clarity
- Selectors: Use simple, shallow selectors to target elements efficiently
- Variables: Define CSS custom properties at the :root level for consistent theming
- Nesting: Avoid deeply nested CSS rules for better performance
- Use two emojis per console messageβone representing the file's domain, one for the specific message
- Suggested emoji domains:
- βοΈ UI interactions
- π§ Form handling
- π Search functionality
- π Data management
- π§ͺ Testing infrastructure
- Console methods:
console.debug()
: Minor information, loop iterations, internal workingsconsole.info()
: Useful but non-critical messagesconsole.log()
: General information useful for developmentconsole.warn()
: Important notices or potential issuesconsole.error()
: Only for unrecoverable errors; always include relevant debugging information
:root {
--color-primary: #3498db;
--color-secondary: #2ecc71;
--color-accent: #e74c3c;
--color-text: #333333;
--color-text-light: #777777;
--color-background: #ffffff;
--color-background-alt: #f8f8f8;
--color-border: #dddddd;
--color-success: #2ecc71;
--color-warning: #f39c12;
--color-error: #e74c3c;
--shadow-default: 0 2px 5px rgba(0, 0, 0, 0.1);
--shadow-hover: 0 5px 15px rgba(0, 0, 0, 0.1);
}
- Headings: [Your heading font] (fallback: sans-serif)
- Body Text: [Your body font] (system-ui, sans-serif)
- Monospace: [Your monospace font] (monospace fallback)
- Font Sizes: Use relative units (rem) with a base size of 16px
- Line Heights: 1.5 for body text, 1.2 for headings
IMPORTANT: When creating tests with GitHub Copilot, include this file as context to ensure adherence to these guidelines.
- End-to-End Focus: Tests must interact with actual HTML pages through the user interface
- User-Centric: Focus on what real users would see and interact with
- No Mocks: Avoid mock objects, unit tests, or test fixtures
- Browser Compatibility: Ensure tests run on all modern browsers
- Test Files: Correspond to actual pages in the
/www
directory - Test Naming: Use descriptive names that reflect the user journey or interaction being tested
- URL Format: Use relative URLs without the
/www/
prefix in test navigation (e.g.,/index.html
not/www/index.html
)
- Red Tests First: Always begin with a failing test that defines expected functionality
- Green Implementation: Then implement just enough code to make the test pass
- User-Focused Testing: Tests should reflect actual user interactions and experiences
- Accessibility Testing: Ensure all tests interact with the page in ways that support screen readers
- Test Organization: Group related tests in logical describe blocks
- Test Naming: Tests should clearly describe the expected behavior being verified
This example demonstrates how to test a page load with Playwright:
/**
* @file Page load test example
* @module tests/page-load
*/
import { test, expect } from '@playwright/test';
test.describe('Page Load Test βοΈ', () => {
// Shared emoji for this file domain
const fileEmoji = 'βοΈ';
test('should display the correct title and elements', async ({ page }) => {
// Navigate to the page
await page.goto('/index.html');
// Check the page title
await expect(page).toHaveTitle('Project Name');
// Check for the presence of a key element
const mainHeading = page.locator('h1');
await expect(mainHeading).toBeVisible();
// Check accessibility elements
const mainContent = page.locator('[role="main"]');
await expect(mainContent).toBeVisible();
// Log the successful test
console.info(`${fileEmoji} β
Page loaded successfully.`);
});
});
# Clone the repository
git clone https://github.com/username/project-name.git
# Navigate to the project directory
cd project-name
# Install dependencies
npm install
# Start development server
npm run dev
# Run tests
npm test
# Build for production
npm run build
- README.md - Project overview and roadmap
- CHANGELOG.md - Update history
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
- Ensure all tests pass
- Update documentation as needed
- Get approval from at least one reviewer
- Merge once approved