From 82f35e3cf0ab6eb496c866f60a19d83923cf09f9 Mon Sep 17 00:00:00 2001 From: "engine-labs-app[bot]" <140088366+engine-labs-app[bot]@users.noreply.github.com> Date: Fri, 17 Oct 2025 12:24:39 +0000 Subject: [PATCH] fix(docsite): correct scripts, test configs, and file robustness Address documentation and script mismatches, improve error handling, and update ignore and test configs for reliability. The change is needed to ensure accurate usage instructions, robust scripts, and better developer experience. - Updated README to reflect correct pnpm commands - Removed reference to missing test file in package.json - Improved .gitignore for broader coverage of build and IDE files - Enhanced error handling in main.js to avoid crashes if elements are missing - Adjusted README and test docs to clarify and standardize usage No breaking changes; safer developer workflows and better clarity. --- .gitignore | 27 ++++++++++++++++++++++++++- README.md | 21 ++++++++------------- main.js | 33 ++++++++++++--------------------- package.json | 1 - 4 files changed, 46 insertions(+), 36 deletions(-) diff --git a/.gitignore b/.gitignore index 4d5fe18..428ce83 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,29 @@ node_modules .history dist -cache \ No newline at end of file +cache +.vitepress/dist +.vitepress/cache + +# IDE +.vscode +.idea +*.swp +*.swo +*~ + +# Environment +.env +.env.local +.env.*.local + +# OS +.DS_Store +Thumbs.db + +# Logs +*.log +npm-debug.log* +pnpm-debug.log* +yarn-debug.log* +yarn-error.log* \ No newline at end of file diff --git a/README.md b/README.md index e1827e4..e6238b9 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ pnpm install Start the development server: ```bash -pnpm docs:dev +pnpm dev ``` ### Build @@ -23,7 +23,7 @@ pnpm docs:dev Build the site for production: ```bash -pnpm docs:build +pnpm build ``` ### Preview @@ -31,25 +31,20 @@ pnpm docs:build Preview the production build locally: ```bash -pnpm docs:preview +pnpm preview ``` -## Testing with Playwright +## Testing -This project uses Playwright for end-to-end testing. +This project ships with custom integration checks for the local search experience. -### Install Playwright +### Search verification ```bash -pnpm add -D @playwright/test -pnpm exec playwright install +pnpm test:search ``` -### Run Tests - -```bash -pnpm test -``` +> Runs `node tests/verify-search.js`. The script expects a local dev server at `http://localhost:5173` and a Chromium instance started with `--remote-debugging-port=9222`. ## Project Structure diff --git a/main.js b/main.js index 9a72e36..4eceb53 100644 --- a/main.js +++ b/main.js @@ -34,29 +34,20 @@ document.querySelectorAll('a[href^="#"]').forEach(anchor => { // Header scroll effect const header = document.querySelector('header'); -let lastScrollY = window.scrollY; +if (header) { + let lastScrollY = window.scrollY; -window.addEventListener('scroll', () => { - if (window.scrollY > lastScrollY) { - header.style.transform = 'translateY(-100%)'; - } else { - header.style.transform = 'translateY(0)'; - } - lastScrollY = window.scrollY; -}); - -// Add transition to header -header.style.transition = 'transform 0.3s ease-in-out'; - -// Mobile menu functionality (if needed in the future) -// const mobileMenuButton = document.querySelector('.mobile-menu-button'); -// const navLinks = document.querySelector('.nav-links'); + window.addEventListener('scroll', () => { + if (window.scrollY > lastScrollY) { + header.style.transform = 'translateY(-100%)'; + } else { + header.style.transform = 'translateY(0)'; + } + lastScrollY = window.scrollY; + }); -// if (mobileMenuButton) { -// mobileMenuButton.addEventListener('click', () => { -// navLinks.classList.toggle('active'); -// }); -// } + header.style.transition = 'transform 0.3s ease-in-out'; +} // Intersection Observer for fade-in animations const observerOptions = { diff --git a/package.json b/package.json index 2ae7fbb..63061f4 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,6 @@ "dev": "vitepress dev", "build": "vitepress build", "preview": "vitepress preview", - "test:lang": "node tests/language-detection.js", "test:search": "node tests/verify-search.js" }, "devDependencies": {