Sentry config

This commit is contained in:
Natsumi
2025-09-18 19:42:41 +12:00
parent 5d0c6c4141
commit 0916bdcacd
4 changed files with 21 additions and 8 deletions

View File

@@ -122,7 +122,6 @@ jobs:
run: npm ci
- name: Build Cef-html
env:
SENTRY_URL: ${{ secrets.SentryUrl }}
SENTRY_AUTH_TOKEN: ${{ secrets.SentryAuthToken }}
run: npm run prod
- name: Upload Cef-html artifacts

View File

@@ -20,7 +20,7 @@ app.use(pinia);
app.use(i18n);
app.use(ElementPlus);
initComponents(app);
initSentry(app);
await initSentry(app);
app.mount('#root');

View File

@@ -34,6 +34,7 @@ export async function initSentry(app) {
app,
dsn,
environment: 'nightly',
release: version,
replaysSessionSampleRate: 0.1,
replaysOnErrorSampleRate: 1.0,
beforeSend(event, hint) {

View File

@@ -3,22 +3,35 @@ import vue from '@vitejs/plugin-vue';
import { sentryVitePlugin } from '@sentry/vite-plugin';
import { fileURLToPath } from 'node:url';
import { dirname, resolve } from 'node:path';
import fs from 'node:fs';
const __dirname = dirname(fileURLToPath(import.meta.url));
const url = process.env.SENTRY_URL;
const authToken = process.env.SENTRY_AUTH_TOKEN;
const buildAndUploadSourceMaps = authToken ? true : false;
const vrcxVersion = fs
.readFileSync(resolve(__dirname, '../Version'), 'utf-8')
.trim();
if (buildAndUploadSourceMaps) {
console.log('Source maps will be built and uploaded to Sentry');
}
// https://vite.dev/config/
export default defineConfig(() => ({
base: '',
plugins: [
vue(),
url &&
buildAndUploadSourceMaps &&
sentryVitePlugin({
url,
authToken,
org: 'vrcx',
project: 'vrcx-web'
project: 'vrcx-web',
release: {
name: vrcxVersion
},
sourcemaps: {
assets: './build/html/**',
filesToDeleteAfterUpload: './build/html/**/*.js.map'
}
})
],
define: {
@@ -42,6 +55,6 @@ export default defineConfig(() => ({
vr: resolve(__dirname, 'vr.html')
}
},
sourcemap: true
sourcemap: buildAndUploadSourceMaps
}
}));