website
git clone https://git.pyrossh.dev/website
木 Personal website of pyrossh. Built with astrojs, shiki, vite.
567b02d
— pyrossh
2024-02-22T13:46:48+05:30
fix sentry
Generated files not shown: package-lock.json
- .gitignore +3 -1
- package.json +1 -0
- src/hooks.client.js +21 -0
- src/hooks.server.js +12 -8
- src/routes/+layout.svelte +0 -4
- vite.config.js +14 -7
.gitignore
CHANGED
|
@@ -7,4 +7,6 @@ node_modules
|
|
|
7
7
|
.env.*
|
|
8
8
|
!.env.example
|
|
9
9
|
vite.config.js.timestamp-*
|
|
10
|
-
vite.config.ts.timestamp-*
|
|
10
|
+
vite.config.ts.timestamp-*
|
|
11
|
+
# Sentry Config File
|
|
12
|
+
.sentryclirc
|
package.json
CHANGED
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
"test:unit": "vitest"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
+
"@sentry/sveltekit": "^7.102.0",
|
|
19
20
|
"@unocss/reset": "^0.58.5"
|
|
20
21
|
},
|
|
21
22
|
"devDependencies": {
|
src/hooks.client.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { handleErrorWithSentry, replayIntegration } from '@sentry/sveltekit';
|
|
2
|
+
import * as Sentry from '@sentry/sveltekit';
|
|
3
|
+
|
|
4
|
+
Sentry.init({
|
|
5
|
+
dsn: 'https://c5d07f4181a8450fa2cface73930c4f2@o4504798400348160.ingest.sentry.io/4504798403624960',
|
|
6
|
+
tracesSampleRate: 1.0,
|
|
7
|
+
|
|
8
|
+
// This sets the sample rate to be 10%. You may want this to be 100% while
|
|
9
|
+
// in development and sample at a lower rate in production
|
|
10
|
+
replaysSessionSampleRate: 0.1,
|
|
11
|
+
|
|
12
|
+
// If the entire session is not sampled, use the below sample rate to sample
|
|
13
|
+
// sessions when an error occurs.
|
|
14
|
+
replaysOnErrorSampleRate: 1.0,
|
|
15
|
+
|
|
16
|
+
// If you don't want to use Session Replay, just remove the line below:
|
|
17
|
+
integrations: [replayIntegration()]
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
// If you have a custom error handler, pass it to `handleErrorWithSentry`
|
|
21
|
+
export const handleError = handleErrorWithSentry();
|
src/hooks.server.js
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
|
-
|
|
1
|
+
import { sequence } from '@sveltejs/kit/hooks';
|
|
2
|
+
import * as Sentry from '@sentry/sveltekit';
|
|
2
3
|
|
|
4
|
+
Sentry.init({
|
|
5
|
+
dsn: 'https://c5d07f4181a8450fa2cface73930c4f2@o4504798400348160.ingest.sentry.io/4504798403624960',
|
|
6
|
+
tracesSampleRate: 1
|
|
7
|
+
});
|
|
8
|
+
|
|
3
|
-
|
|
9
|
+
export const handleError = Sentry.handleErrorWithSentry();
|
|
10
|
+
|
|
4
|
-
export async function
|
|
11
|
+
export const handle = sequence(Sentry.sentryHandle(), async function _handle({ event, resolve }) {
|
|
5
12
|
const response = await resolve(event, {
|
|
6
13
|
transformPageChunk: ({ html }) =>
|
|
7
|
-
html.replace(
|
|
8
|
-
"%unocss-svelte-scoped.global%",
|
|
9
|
-
|
|
14
|
+
html.replace('%unocss-svelte-scoped.global%', 'unocss_svelte_scoped_global_styles')
|
|
10
|
-
),
|
|
11
15
|
});
|
|
12
16
|
return response;
|
|
13
|
-
}
|
|
17
|
+
});
|
src/routes/+layout.svelte
CHANGED
|
@@ -19,10 +19,6 @@
|
|
|
19
19
|
id="pirschjs"
|
|
20
20
|
data-code="fynEKPntFh9oUyUcIO76Tmcxzjkmwfjg"
|
|
21
21
|
></script>
|
|
22
|
-
<script
|
|
23
|
-
src="https://js.sentry-cdn.com/c5d07f4181a8450fa2cface73930c4f2.min.js"
|
|
24
|
-
crossorigin="anonymous"
|
|
25
|
-
></script>
|
|
26
22
|
</svelte:head>
|
|
27
23
|
<div
|
|
28
24
|
style="display: contents"
|
vite.config.js
CHANGED
|
@@ -1,15 +1,22 @@
|
|
|
1
|
+
import { sentrySvelteKit } from '@sentry/sveltekit';
|
|
1
|
-
import { sveltekit } from
|
|
2
|
+
import { sveltekit } from '@sveltejs/kit/vite';
|
|
2
|
-
import UnoCSS from
|
|
3
|
+
import UnoCSS from '@unocss/svelte-scoped/vite';
|
|
3
|
-
import { defineConfig } from
|
|
4
|
+
import { defineConfig } from 'vitest/config';
|
|
4
5
|
|
|
5
6
|
export default defineConfig({
|
|
6
7
|
plugins: [
|
|
8
|
+
sentrySvelteKit({
|
|
9
|
+
sourceMapsUploadOptions: {
|
|
10
|
+
org: 'pyrossh',
|
|
11
|
+
project: 'pyros-sh'
|
|
12
|
+
}
|
|
13
|
+
}),
|
|
7
14
|
sveltekit(),
|
|
8
15
|
UnoCSS({
|
|
9
|
-
injectReset:
|
|
16
|
+
injectReset: '@unocss/reset/tailwind.css'
|
|
10
|
-
})
|
|
17
|
+
})
|
|
11
18
|
],
|
|
12
19
|
test: {
|
|
13
|
-
include: [
|
|
20
|
+
include: ['src/**/*.{test,spec}.{js,ts}']
|
|
14
|
-
}
|
|
21
|
+
}
|
|
15
22
|
});
|