Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
PUBLIC_POSTHOG_API_KEY=
PUBLIC_POSTHOG_API_KEY=
PUBLIC_POSTHOG_ENABLED=false
Comment on lines +1 to +2
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Default-off toggle can back-fire if the variable is missing

In +layout.svelte analytics are enabled unless PUBLIC_POSTHOG_ENABLED === 'false'.
If this line is absent from a real .env file (easy to forget when onboarding or in CI) PostHog will be turned on unintentionally. Safer pattern:

-PUBLIC_POSTHOG_ENABLED=false
+# Explicitly opt-in. Any value other than “true” disables analytics.
+PUBLIC_POSTHOG_ENABLED=true

and flip the check in the Svelte file to === 'true'.

This prevents accidental PII leakage and makes the intent crystal-clear.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
PUBLIC_POSTHOG_API_KEY=
PUBLIC_POSTHOG_ENABLED=false
PUBLIC_POSTHOG_API_KEY=
# Explicitly opt-in. Any value other than “true” disables analytics.
PUBLIC_POSTHOG_ENABLED=true
🧰 Tools
🪛 dotenv-linter (3.3.0)

[warning] 2-2: [EndingBlankLine] No blank line at the end of the file

🤖 Prompt for AI Agents
In the .env.example file at lines 1 to 2, change the default value of
PUBLIC_POSTHOG_ENABLED from false to true or remove it so that the variable must
be explicitly set to 'true' to enable analytics. Then, update the check in
+layout.svelte to enable analytics only when PUBLIC_POSTHOG_ENABLED === 'true'.
This ensures analytics are off by default and only enabled intentionally.

32 changes: 32 additions & 0 deletions .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Playwright Tests
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
test:
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
- name: Install dependencies
run: bun install
- name: Install Playwright Browsers
run: bunx playwright install --with-deps
- name: Set environment variables
run: |
echo "PUBLIC_POSTHOG_ENABLED=false" >> $GITHUB_ENV
echo "PUBLIC_POSTHOG_API_KEY=null" >> $GITHUB_ENV
- name: Run Playwright tests
run: bunx playwright test
- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: playwright-report
path: playwright-report/
retention-days: 30
- name: Print SvelteKit logs
if: failure()
run: cat .svelte-kit/output/server/log.txt || true
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
test-results
.DS_Store
node_modules
/build
Expand All @@ -7,3 +8,4 @@ node_modules
.env.*
!.env.example
.vercel
playwright-report
55 changes: 41 additions & 14 deletions bun.lock

Large diffs are not rendered by default.

36 changes: 36 additions & 0 deletions e2e/around-the-world.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { expect, test } from '@playwright/test';

test('can load all pages', async ({ page }) => {
await page.goto('/');
await expect(page.locator('h1')).toBeVisible();

await page.goto('/blog');
await expect(page.locator('h1')).toBeVisible();

await page.goto('/blog/screenshot-maker');
await expect(page.locator('h1')).toBeVisible();

await page.goto('/blog/pagespeed-testing');
await expect(page.locator('h1')).toBeVisible();

await page.goto('/blog/github-repositories-viewer-app');
await expect(page.locator('h1')).toBeVisible();

await page.goto('/blog/git-branch-name-raycast-extension');
await expect(page.locator('h1')).toBeVisible();

await page.goto('/blog/i-made-an-extension');
await expect(page.locator('h1')).toBeVisible();

await page.goto('/blog/getting-started-as-a-web-developer-in-2022');
await expect(page.locator('h1')).toBeVisible();

await page.goto('/blog/set-up-some-aliases');
await expect(page.locator('h1')).toBeVisible();

await page.goto('/uses');
await expect(page.locator('h1')).toBeVisible();

await page.goto('/policies');
await expect(page.locator('h1')).toBeVisible();
});
14 changes: 9 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,25 @@
"lint": "prettier --check . && eslint . && prettier --check .",
"format": "prettier --write .",
"out": "bun outdated",
"preinstall": "npx only-allow bun"
"up": "bun update",
"preinstall": "npx only-allow bun",
"test:e2e": "playwright test",
"test": "npm run test:e2e"
},
"devDependencies": {
"@eslint/compat": "^1.3.0",
"@eslint/js": "^9.28.0",
"@eslint/js": "^9.29.0",
"@playwright/test": "^1.49.1",
"@sveltejs/adapter-vercel": "^5.7.2",
"@sveltejs/enhanced-img": "^0.6.0",
"@sveltejs/kit": "^2.21.4",
"@sveltejs/kit": "^2.21.5",
"@sveltejs/vite-plugin-svelte": "^5.1.0",
"@tailwindcss/postcss": "^4.1.10",
"@tailwindcss/typography": "^0.5.16",
"@tailwindcss/vite": "^4.1.10",
"@typescript-eslint/eslint-plugin": "^8.34.0",
"@typescript-eslint/parser": "^8.34.0",
"eslint": "^9.28.0",
"eslint": "^9.29.0",
"eslint-config-prettier": "^10.1.5",
"eslint-plugin-svelte": "^3.9.2",
"globals": "^16.2.0",
Expand All @@ -34,7 +38,7 @@
"prettier-plugin-svelte": "^3.4.0",
"prettier-plugin-tailwindcss": "^0.6.12",
"sharp": "^0.34.2",
"svelte": "^5.34.1",
"svelte": "^5.34.3",
"svelte-check": "^4.2.1",
"svelte-highlight": "^7.8.3",
"svelte-preprocess": "^6.0.3",
Expand Down
12 changes: 12 additions & 0 deletions playwright.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { defineConfig } from '@playwright/test';

export default defineConfig({
webServer: {
command: 'bun run build && bun run preview',
port: 4173,
timeout: 5 * 60 * 1000 // 5 minutes
},
testDir: 'e2e',
outputDir: 'playwright-report',
use: { baseURL: 'http://localhost:4173' }
});
1 change: 1 addition & 0 deletions postcss.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = {};
1 change: 0 additions & 1 deletion postcss.config.mjs

This file was deleted.

38 changes: 18 additions & 20 deletions src/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -24,34 +24,32 @@
::file-selector-button {
border-color: var(--color-gray-200, currentColor);
}
}

@layer base {
html {
@apply bg-linear-to-tr from-indigo-100 to-gray-400 bg-fixed;
}
}

@media screen and (prefers-color-scheme: dark) {
html {
@apply bg-linear-to-tr from-gray-700 to-gray-900 bg-fixed;
@media screen and (prefers-color-scheme: dark) {
html {
@apply bg-linear-to-tr from-gray-700 to-gray-900 bg-fixed;
}
}
}

.mb-scrollable::-webkit-scrollbar {
width: 10px;
margin-left: 20px;
}
.mb-scrollable::-webkit-scrollbar {
width: 10px;
margin-left: 20px;
}

.mb-scrollable::-webkit-scrollbar-track {
background: rgba(0, 0, 0, 0.2);
}
.mb-scrollable::-webkit-scrollbar-track {
background: rgba(0, 0, 0, 0.2);
}

.mb-scrollable::-webkit-scrollbar-thumb {
background: rgba(0, 0, 0, 0.8);
border-radius: 10px;
}
.mb-scrollable::-webkit-scrollbar-thumb {
background: rgba(0, 0, 0, 0.8);
border-radius: 10px;
}

.mb-scrollable::-webkit-scrollbar-thumb:hover {
background: rgba(0, 0, 0, 0.6);
.mb-scrollable::-webkit-scrollbar-thumb:hover {
background: rgba(0, 0, 0, 0.6);
}
}
4 changes: 2 additions & 2 deletions src/routes/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import { browser } from '$app/environment';
import { afterNavigate, beforeNavigate } from '$app/navigation';
import { page } from '$app/state';
import { PUBLIC_POSTHOG_API_KEY } from '$env/static/public';
import { PUBLIC_POSTHOG_API_KEY, PUBLIC_POSTHOG_ENABLED } from '$env/static/public';
import { partytownSnippet } from '@qwik.dev/partytown/integration';
import posthog from 'posthog-js';
import { onDestroy, onMount } from 'svelte';
Expand Down Expand Up @@ -35,7 +35,7 @@
clearInterval(interval);
});

if (browser) {
if (PUBLIC_POSTHOG_ENABLED !== 'false' && browser) {
posthog.init(PUBLIC_POSTHOG_API_KEY, {
api_host: '/ingest',
capture_pageleave: false,
Expand Down
28 changes: 20 additions & 8 deletions static/sitemap.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,51 +17,63 @@
<priority>0.7</priority>
<lastmod>2022-01-27T23:19:59.711Z</lastmod>
</url>
<url>
<loc>https://michaelbonner.dev/blog/screenshot-maker</loc>
<changefreq>weekly</changefreq>
<priority>0.7</priority>
<lastmod>2025-05-14T16:46:00.845Z</lastmod>
</url>
<url>
<loc>https://michaelbonner.dev/blog/pagespeed-testing</loc>
<changefreq>weekly</changefreq>
<priority>0.7</priority>
<lastmod>2025-04-09T16:00:00.000Z</lastmod>
</url>
<url>
<loc>https://michaelbonner.dev/blog/github-repositories-viewer-app</loc>
<changefreq>daily</changefreq>
<changefreq>weekly</changefreq>
<priority>0.7</priority>
<lastmod>2023-09-14T23:19:59.711Z</lastmod>
</url>
<url>
<loc>https://michaelbonner.dev/blog/git-branch-name-raycast-extension</loc>
<changefreq>daily</changefreq>
<changefreq>weekly</changefreq>
<priority>0.7</priority>
<lastmod>2023-01-17T23:19:59.711Z</lastmod>
</url>
<url>
<loc>https://michaelbonner.dev/blog/i-made-an-extension</loc>
<changefreq>daily</changefreq>
<changefreq>weekly</changefreq>
<priority>0.7</priority>
<lastmod>2022-05-01T23:19:59.711Z</lastmod>
</url>
<url>
<loc>https://michaelbonner.dev/blog/getting-started-as-a-web-developer-in-2022</loc>
<changefreq>daily</changefreq>
<changefreq>weekly</changefreq>
<priority>0.7</priority>
<lastmod>2022-12-18T23:19:59.711Z</lastmod>
</url>
<url>
<loc>https://michaelbonner.dev/blog/set-up-some-aliases</loc>
<changefreq>daily</changefreq>
<changefreq>weekly</changefreq>
<priority>0.7</priority>
<lastmod>2022-01-27T23:19:59.711Z</lastmod>
</url>
<url>
<loc>https://michaelbonner.dev/uses</loc>
<changefreq>daily</changefreq>
<changefreq>weekly</changefreq>
<priority>0.7</priority>
<lastmod>2022-01-27T23:19:59.711Z</lastmod>
</url>
<url>
<loc>https://michaelbonner.dev/policies</loc>
<changefreq>daily</changefreq>
<changefreq>weekly</changefreq>
<priority>0.5</priority>
<lastmod>2022-01-27T23:19:59.711Z</lastmod>
</url>
<url>
<loc>https://michaelbonner.dev/ellie</loc>
<changefreq>daily</changefreq>
<changefreq>weekly</changefreq>
<priority>0.5</priority>
<lastmod>2024-06-25T16:12:21.010Z</lastmod>
</url>
Expand Down
Loading