diff --git a/index.html b/index.html index c4078bf7..bea2c7b5 100644 --- a/index.html +++ b/index.html @@ -359,6 +359,7 @@

seed. zap. subscribe.

+ diff --git a/scripts/build-dist.mjs b/scripts/build-dist.mjs index 1aa36a6f..9438345b 100644 --- a/scripts/build-dist.mjs +++ b/scripts/build-dist.mjs @@ -171,14 +171,22 @@ function injectVersionInfo() { v: ${hash.slice(0, 8)} • ${date} `; - // Fallback search if whitespace differs - const taglineRegex = /(seed\. zap\. subscribe\.\s*<\/h2>)/; - if (taglineRegex.test(content)) { - content = content.replace(taglineRegex, '$1' + versionHtml); + // Robust replacement using explicit comment placeholder + const placeholder = ''; + if (content.includes(placeholder)) { + content = content.replace(placeholder, versionHtml); fs.writeFileSync(indexHtmlPath, content); console.log(`Injected version: ${hash.slice(0, 8)} • ${date}`); } else { - console.warn('Could not find tagline to inject version info.'); + // Fallback search if placeholder is missing (legacy behavior) + const taglineRegex = /(seed\. zap\. subscribe\.\s*<\/h2>)/; + if (taglineRegex.test(content)) { + content = content.replace(taglineRegex, '$1' + versionHtml); + fs.writeFileSync(indexHtmlPath, content); + console.log(`Injected version (via fallback regex): ${hash.slice(0, 8)} • ${date}`); + } else { + console.warn('Could not find placeholder or tagline to inject version info.'); + } } } } catch (error) { diff --git a/verification.png b/verification.png index fda37f88..d22ea829 100644 Binary files a/verification.png and b/verification.png differ diff --git a/verify_version.py b/verify_version.py index 0130aaff..1b4c5318 100644 --- a/verify_version.py +++ b/verify_version.py @@ -1,29 +1,33 @@ from playwright.sync_api import sync_playwright +import re def run(): with sync_playwright() as p: browser = p.chromium.launch() page = browser.new_page() - page.goto("http://localhost:3000") + try: + page.goto("http://localhost:8080") - # Locate the tagline - tagline = page.get_by_text("seed. zap. subscribe.") + # Pattern for version string + pattern = re.compile(r"v:\s+[a-f0-9]{8}\s+•\s+\d{4}-\d{2}-\d{2}") - # Locate the version info which should be nearby - # The tagline is an h2 inside a div. - container = tagline.locator("..") + locator = page.get_by_text(pattern) + locator.wait_for() - # Wait for fade-in to settle or just force visibility? - # The container has "fade-in" class. It might take time. - # I'll wait for the version text to be visible. - version_locator = container.locator("div.text-xs") - version_locator.wait_for() + # Scroll to element + locator.scroll_into_view_if_needed() - print("Version text found:", version_locator.inner_text()) + # Take a screenshot of the element specifically, plus some context + # Or just the page after scrolling + page.screenshot(path="verification.png") - # Screenshot the container - container.screenshot(path="verification.png") - browser.close() + content = locator.text_content() + print(f"Found version string: '{content.strip()}'") + + except Exception as e: + print(f"Error: {e}") + finally: + browser.close() if __name__ == "__main__": run()