Merge pull request #95 from bartvdbraak/refactor/web-vitals

This commit is contained in:
Bart van der Braak 2023-08-07 00:18:48 +02:00 committed by GitHub
commit 49f5cf7d3e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 23 additions and 21 deletions

View file

@ -4,6 +4,5 @@
"trailingComma": "none",
"printWidth": 100,
"plugins": ["prettier-plugin-svelte"],
"pluginSearchDirs": ["."],
"overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }]
}

View file

@ -1,5 +1,5 @@
<div align="center">
<h1 align="center">hellob.art</h1>
<a href="https://hellob.art"><h1 align="center">hellob.art</h1></a>
<h5>personal website built with Svelte</h5>
</div>

3
lintstagedrc.cjs Normal file
View file

@ -0,0 +1,3 @@
module.exports = {
'**/*.{js,ts,cjs,svelte,tsx}': [() => 'tsc -p tsconfig.json --noEmit', 'eslint --fix', 'prettier --write']
};

View file

@ -8,8 +8,8 @@
"preview": "vite preview",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
"lint": "prettier --plugin-search-dir . --check . && eslint .",
"format": "prettier --plugin-search-dir . --write .",
"lint": "prettier --check . && eslint .",
"format": "prettier --write .",
"prepare": "npx husky install"
},
"devDependencies": {
@ -25,7 +25,7 @@
"lint-staged": "^13.2.3",
"postcss": "^8.4.24",
"postcss-load-config": "^4.0.1",
"prettier": "^2.8.0",
"prettier": "^3.0.1",
"prettier-plugin-svelte": "^3.0.0",
"svelte": "^4.0.5",
"svelte-check": "^3.4.3",

View file

@ -62,11 +62,11 @@ devDependencies:
specifier: ^4.0.1
version: 4.0.1(postcss@8.4.26)
prettier:
specifier: ^2.8.0
version: 2.8.8
specifier: ^3.0.1
version: 3.0.1
prettier-plugin-svelte:
specifier: ^3.0.0
version: 3.0.3(prettier@2.8.8)(svelte@4.1.0)
version: 3.0.3(prettier@3.0.1)(svelte@4.1.0)
svelte:
specifier: ^4.0.5
version: 4.1.0
@ -2037,19 +2037,19 @@ packages:
engines: {node: '>= 0.8.0'}
dev: true
/prettier-plugin-svelte@3.0.3(prettier@2.8.8)(svelte@4.1.0):
/prettier-plugin-svelte@3.0.3(prettier@3.0.1)(svelte@4.1.0):
resolution: {integrity: sha512-dLhieh4obJEK1hnZ6koxF+tMUrZbV5YGvRpf2+OADyanjya5j0z1Llo8iGwiHmFWZVG/hLEw/AJD5chXd9r3XA==}
peerDependencies:
prettier: ^3.0.0
svelte: ^3.2.0 || ^4.0.0-next.0
dependencies:
prettier: 2.8.8
prettier: 3.0.1
svelte: 4.1.0
dev: true
/prettier@2.8.8:
resolution: {integrity: sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==}
engines: {node: '>=10.13.0'}
/prettier@3.0.1:
resolution: {integrity: sha512-fcOWSnnpCrovBsmFZIGIy9UqK2FaI7Hqax+DIO0A9UxeVoY4iweyaFjS5TavZN97Hfehph0nhsZnjlVKzEQSrQ==}
engines: {node: '>=14'}
hasBin: true
dev: true

View file

@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />

View file

@ -1,5 +1,5 @@
import type { Metric } from 'web-vitals';
import { getCLS, getFCP, getFID, getLCP, getTTFB } from 'web-vitals';
import { onCLS, onFCP, onFID, onLCP, onTTFB } from 'web-vitals';
const vitalsUrl = 'https://vitals.vercel-analytics.com/v1/vitals';
@ -75,11 +75,11 @@ export function webVitals(options: {
debug: boolean;
}) {
try {
getFID((metric) => sendToAnalytics(metric, options));
getTTFB((metric) => sendToAnalytics(metric, options));
getLCP((metric) => sendToAnalytics(metric, options));
getCLS((metric) => sendToAnalytics(metric, options));
getFCP((metric) => sendToAnalytics(metric, options));
onFID((metric) => sendToAnalytics(metric, options));
onTTFB((metric) => sendToAnalytics(metric, options));
onLCP((metric) => sendToAnalytics(metric, options));
onCLS((metric) => sendToAnalytics(metric, options));
onFCP((metric) => sendToAnalytics(metric, options));
} catch (err) {
console.error('[Web Vitals]', err);
}

View file

@ -44,7 +44,7 @@
overall robustness and stability of our cloud infrastructure.
</p>
<div class="max-h-80">
<div class="h-72">
<Canvas>
<T.PerspectiveCamera makeDefault position={[-10, 15, 20]} fov={10}>
<OrbitControls