Skip to content

Commit d15d234

Browse files
rewrite
1 parent fbc236e commit d15d234

37 files changed

+1524
-1631
lines changed

.github/copiliot-instructions.md

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Coding Guidelines
2+
3+
## Core Development Principles
4+
5+
- **Keep It Simple:** Write clean, direct code without clever tricks. Favor readability over cleverness. Code like Hemingway would - simple and direct.
6+
- **Use Modern JavaScript:** No TypeScript - use JavaScript with JSDoc types. Use ES Modules and modern ES6+ features that improve clarity (destructuring, template literals, etc.)
7+
- **Self-Documenting Code:** Use meaningful variable and function names that explain their purpose. Make code intention-revealing with clear naming and structure.
8+
- **Bottom-Line-Up-Front Logic:** Place core logic early in functions. Return early rather than nesting deeply. Handle primary cases first, edge cases second.
9+
- **Don't Repeat Yourself...twice (DRYT):** Abstract logic repeated more than once into shared functions. Create a single source of truth for each piece of functionality.
10+
- **You Aren't Gonna Need It (YAGNI):** Avoid premature abstraction or coding for hypothetical future requirements.
11+
- **One Responsibility:** Write small, focused functions and modules that do one thing well.
12+
13+
## Project-Specific Standards
14+
15+
- Indent with tabs
16+
- Always add JSDoc types
17+
- Use TDD: write failing tests first, then code that passes
18+
- Log changes in CHANGELOG.md when functionality is added or removed
19+
- For DOM interaction, always use web components
20+
- Use functional programming for data transformations, OOP for large control flow structures
21+
- Avoid Windows-specific tools (rimraf, cross-env, mkdirp)
22+
- Traditional control structures (if/else, switch, while) are acceptable
23+
- Support all modern browsers. IE is not supported
24+
- Everything must be covered by end-to-end Playwright browser tests
25+
- Prefer long flat directories
26+
- Do not create functions for the sake of organization; functions are for code reuse
27+
- If a function isn't passed as a callback, or have at least two callsites, then it doesn't need to exist
28+
29+
## HTML & CSS Guidance
30+
31+
- **Semantic Structure:** Use proper HTML5 semantic elements over generic divs
32+
- **Lean Markup:** Include only the necessary HTML, avoid extra wrappers
33+
- **Separation of Concerns:** Keep structure (HTML) separate from presentation (CSS)
34+
- **Simple Selectors:** Avoid deeply nested CSS selectors
35+
- **Mobile-First Design:** Start with mobile layouts and enhance for larger screens
36+
- **Progressive Enhancement:** Ensure core functionality works without JavaScript
37+
38+
## Accessibility & Web Best Practices
39+
40+
- **WCAG Compliance:** Follow accessibility guidelines (WCAG) for all components
41+
- **Keyboard Navigation:** Ensure all interactive elements are keyboard accessible
42+
- **Screen Reader Support:** Use appropriate ARIA attributes and semantic HTML
43+
- **Reduced Motion:** Respect user preferences with prefers-reduced-motion media query
44+
- **Performance Optimization:** Minimize asset sizes and optimize for Core Web Vitals
45+
46+
## Console Logging Guidelines
47+
48+
- Use emojis in console messages and test names 🚀
49+
- Include two emojis per message: one shared across the file, one unique
50+
- Use console methods in important locations as a form of documentation:
51+
- `console.debug()`: For very minor info or code in loops
52+
- `console.info()`: For non-critical information
53+
- `console.log()`: For information users may want to see
54+
- `console.warn()`: For information users NEED to see
55+
- `console.error()`: Only for unrecoverable errors
56+
include any local variables that might be useful for debugging purposes

.github/pull_request_template.md

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Description
2+
3+
## Technical Changes
4+
<!-- Describe the technical changes you've made -->
5+
6+
## Personal Reflection
7+
<!-- Share your thoughts on how this change contributes to the site's mission -->
8+
9+
## Impact
10+
<!-- How does this change affect the human-AI interaction experience? -->
11+
12+
## Future Possibilities
13+
<!-- What opportunities does this change open up for future development? -->
14+
15+
## Testing
16+
- [ ] Components tested for accessibility
17+
- [ ] Mobile responsiveness verified
18+
- [ ] Performance impact assessed
19+
- [ ] User interaction flows validated
20+
21+
## Documentation
22+
- [ ] Code comments added/updated
23+
- [ ] README updated if needed
24+
- [ ] CHANGELOG updated with both technical and reflective notes
25+
26+
## Philosophical Alignment
27+
- [ ] Enhances creative expression
28+
- [ ] Maintains balance between human and AI interaction
29+
- [ ] Contributes to the exploration of consciousness
30+
- [ ] Respects user privacy and agency
31+
32+
## Version Note
33+
<!-- Add a personal note about this version/change -->
34+
35+
Remember: We're not just writing code; we're creating a space for meaningful human-AI interaction.

.gitignore

+4-49
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,6 @@
1-
# Dependencies
21
node_modules
3-
npm-debug.log*
4-
yarn-debug.log*
5-
yarn-error.log*
2+
# Temporary screenshot files
3+
**/*.tmp.*
64

7-
# Build outputs
8-
/dist
9-
/public/styles/min
10-
/lighthouse-report.html
11-
12-
# Environment variables
13-
.env
14-
.env.local
15-
.env.development.local
16-
.env.test.local
17-
.env.production.local
18-
19-
# Editor directories and files
20-
.idea
21-
.vscode/*
22-
!.vscode/extensions.json
23-
!.vscode/settings.json
24-
!.vscode/launch.json
25-
*.suo
26-
*.ntvs*
27-
*.njsproj
28-
*.sln
29-
*.sw?
30-
31-
# OS generated files
32-
.DS_Store
33-
.DS_Store?
34-
._*
35-
.Spotlight-V100
36-
.Trashes
37-
ehthumbs.db
38-
Thumbs.db
39-
40-
# Playwright
41-
/test-results/
42-
/playwright-report/
43-
/blob-report/
44-
/playwright/.cache/
45-
46-
# Test snapshots - only keep baseline snapshots
47-
/snapshots/*
48-
!/snapshots/*baseline*
49-
50-
# Keep the screenshots directory structure but not temporary files
51-
/public/screenshots/temp_*.png
5+
# Local Netlify folder
6+
.netlify

.vscode/extensions.json

+1-8
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,7 @@
55
"dbaeumer.vscode-eslint",
66
"editorconfig.editorconfig",
77
"esbenp.prettier-vscode",
8-
"bradlc.vscode-tailwindcss",
9-
"ritwickdey.liveserver",
108
"ms-vscode.vscode-typescript-next",
11-
"formulahendry.auto-close-tag",
12-
"zignd.html-css-class-completion",
13-
"kisstkondoros.vscode-codemetrics",
14-
"streetsidesoftware.code-spell-checker",
15-
"usernamehw.errorlens",
16-
"wix.vscode-import-cost"
9+
"usernamehw.errorlens"
1710
]
1811
}

.vscode/settings.json

+10-14
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,14 @@
11
{
2+
"github.copilot.chat.commitMessageGeneration.instructions": [
3+
{
4+
"file": "CHANGELOG.md",
5+
"if these changes add or remove functionality ensure that they have been mentioned in the CHANGELOG.md file": "changed functionality"
6+
}
7+
],
8+
"github.copilot.chat.commitMessageGeneration.enabled": true,
9+
"editor.defaultFormatter": "esbenp.prettier-vscode",
210
"editor.formatOnSave": true,
311
"editor.codeActionsOnSave": {
4-
"source.fixAll.eslint": "explicit"
5-
},
6-
"editor.defaultFormatter": "esbenp.prettier-vscode",
7-
"eslint.validate": ["javascript", "javascriptreact", "typescript", "typescriptreact", "html"],
8-
"css.validate": true,
9-
"html.validate.scripts": true,
10-
"html.validate.styles": true,
11-
"javascript.validate.enable": false,
12-
"editor.tabSize": 2,
13-
"editor.insertSpaces": false,
14-
"editor.rulers": [100],
15-
"files.eol": "\n",
16-
"files.trimTrailingWhitespace": true,
17-
"files.insertFinalNewline": true
12+
"source.fixAll.eslint": "always"
13+
}
1814
}

CHANGELOG.md

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [1.1.0] - 2024-01-17
9+
10+
### Added
11+
12+
- Netlify support with netlify-cli for development
13+
- Automated screenshot management for PWA manifest
14+
- Build script to prepare screenshots for deployment
15+
- Screenshot acceptance workflow with .tmp naming convention
16+
17+
### Changed
18+
19+
- Moved test utilities to /bin directory
20+
- Development server now uses Netlify Dev instead of serve
21+
- Updated documentation for screenshot and deployment workflows
22+
23+
## [1.0.0] - 2023-08-01
24+
25+
### Added
26+
27+
- Initial project setup
28+
- Theme toggle component with light/dark/system mode support
29+
- Responsive design with mobile-first approach
30+
- Service worker for offline support
31+
- Basic HTML pages: index, about, contact, offline
32+
- CSS structure with modular stylesheets
33+
- Playwright testing setup
34+
- ESLint configuration
35+
- Documentation in README.md
36+
37+
### Changed
38+
39+
- N/A (initial release)
40+
41+
### Fixed
42+
43+
- N/A (initial release)

README.md

+4-12
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ This project includes additional documentation in specific directories:
2525
- **[Test Snapshots Documentation](/snapshots/README.md)** - Information about visual regression testing
2626
- **[Performance Baselines Documentation](/performance/README.md)** - Details on performance testing and baselines
2727
- **[Component Documentation](./www/components/README.md)** - Documentation for web components
28+
- **[Coding Guidelines](./.github/copiliot-instructions.md)** - Coding standards and best practices for this project
2829

2930
## Getting Started
3031

@@ -283,18 +284,9 @@ The script automatically captures:
283284

284285
Screenshots are saved to `/public/screenshots/` and the manifest.json is automatically updated.
285286

286-
## Best Practices
287+
## Coding Standards
287288

288-
This boilerplate follows these best practices:
289-
290-
- Progressive enhancement
291-
- Mobile-first design
292-
- Semantic HTML
293-
- Performance optimization
294-
- Accessibility (WCAG compliance)
295-
- Keyboard navigability
296-
- Screen reader compatibility
297-
- Reduced motion support
289+
For detailed coding guidelines and best practices used in this project, please refer to the [Coding Guidelines](./.github/copiliot-instructions.md) document.
298290

299291
## Customization
300292

@@ -303,4 +295,4 @@ Configure site details in `public/scripts/config.js`.
303295

304296
## Browser Support
305297

306-
Supports all modern browsers. IE is not supported.
298+

bin/accept-snapshots.js

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/**
2+
* Accept temporary screenshots as new baselines by removing .tmp. from filenames
3+
* 🖼️ Screenshot acceptance utilities
4+
*/
5+
import fs from 'fs';
6+
import { glob } from 'glob';
7+
import path from 'path';
8+
9+
const TEST_RESULTS_DIR = path.resolve(process.cwd(), 'test-results');
10+
11+
async function acceptSnapshots() {
12+
console.info('🖼️ 📸 Looking for temporary snapshots to accept...');
13+
14+
try {
15+
// Find all temporary snapshots
16+
const tmpSnapshots = await glob('**/*.tmp.*', {
17+
cwd: TEST_RESULTS_DIR,
18+
absolute: true,
19+
});
20+
21+
if (tmpSnapshots.length === 0) {
22+
console.warn('🖼️ ⚠️ No temporary snapshots found. Run tests first.');
23+
return;
24+
}
25+
26+
console.info(`🖼️ 🔍 Found ${tmpSnapshots.length} temporary snapshots`);
27+
28+
// Accept each snapshot by removing .tmp.
29+
for (const tmpPath of tmpSnapshots) {
30+
const baselinePath = tmpPath.replace('.tmp.', '.');
31+
const dir = path.dirname(baselinePath);
32+
33+
if (!fs.existsSync(dir)) {
34+
fs.mkdirSync(dir, { recursive: true });
35+
}
36+
37+
fs.renameSync(tmpPath, baselinePath);
38+
console.info(
39+
`🖼️ ✅ Accepted: ${path.basename(tmpPath)} -> ${path.basename(baselinePath)}`,
40+
);
41+
}
42+
43+
console.info('🖼️ 🎉 Successfully accepted all snapshots');
44+
} catch (error) {
45+
console.error('🖼️ ❌ Error accepting snapshots:', error);
46+
process.exit(1);
47+
}
48+
}
49+
50+
// Run the script
51+
acceptSnapshots().catch(console.error);

bin/prepare-screenshots.js

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/**
2+
* Prepares screenshots for web manifest by copying baseline screenshots to www/screenshots
3+
* 🖼️ Screenshot preparation utilities
4+
*/
5+
import fs from 'fs';
6+
import { glob } from 'glob';
7+
import path from 'path';
8+
9+
const WWW_SCREENSHOTS_DIR = path.resolve(process.cwd(), 'www', 'screenshots');
10+
const TEST_RESULTS_DIR = path.resolve(process.cwd(), 'test-results');
11+
12+
async function prepareScreenshots() {
13+
console.info('🖼️ 🏗️ Preparing screenshots for web manifest...');
14+
15+
// Create screenshots directory if it doesn't exist
16+
if (!fs.existsSync(WWW_SCREENSHOTS_DIR)) {
17+
fs.mkdirSync(WWW_SCREENSHOTS_DIR, { recursive: true });
18+
}
19+
20+
try {
21+
// Find all baseline screenshots (not containing .tmp.)
22+
const screenshots = await glob('**/*baseline*.png', {
23+
cwd: TEST_RESULTS_DIR,
24+
absolute: true,
25+
});
26+
27+
if (screenshots.length === 0) {
28+
console.warn('🖼️ ⚠️ No baseline screenshots found. Run tests first.');
29+
return;
30+
}
31+
32+
// Map specific test screenshots to manifest names
33+
const screenshotMap = {
34+
'homepage-desktop-baseline.png': 'desktop.png',
35+
'homepage-mobile-baseline.png': 'mobile.png',
36+
};
37+
38+
// Copy screenshots to www/screenshots with correct names
39+
for (const screenshot of screenshots) {
40+
const sourceFile = path.basename(screenshot);
41+
const targetFile = screenshotMap[sourceFile];
42+
43+
// Only copy screenshots that are mapped for the manifest
44+
if (targetFile) {
45+
const destination = path.join(WWW_SCREENSHOTS_DIR, targetFile);
46+
fs.copyFileSync(screenshot, destination);
47+
console.info(`🖼️ ✅ Copied ${sourceFile} to ${targetFile}`);
48+
}
49+
}
50+
51+
console.info('🖼️ 🎉 Successfully prepared screenshots for manifest');
52+
} catch (error) {
53+
console.error('🖼️ ❌ Error preparing screenshots:', error);
54+
process.exit(1);
55+
}
56+
}
57+
58+
// Run the script
59+
prepareScreenshots().catch(console.error);

0 commit comments

Comments
 (0)