From e4d75f8b479434463b523229c4ee2aa2a2a1f501 Mon Sep 17 00:00:00 2001 From: Manoah Tervoort <149895ja@gmail.com> Date: Fri, 6 Dec 2024 08:56:35 +0100 Subject: [PATCH] chore: correctly set sentry version --- quasar.config.js | 45 +++++++++++++++-------------------- src-electron/electron-main.ts | 6 ++--- src/boot/sentry.ts | 9 +++---- src/constants/sentry.ts | 2 ++ 4 files changed, 29 insertions(+), 33 deletions(-) create mode 100644 src/constants/sentry.ts diff --git a/quasar.config.js b/quasar.config.js index b6f8164533..879295b564 100644 --- a/quasar.config.js +++ b/quasar.config.js @@ -16,6 +16,10 @@ const { mergeConfig } = require('vite'); // use mergeConfig helper to avoid over const { repository, version } = require('./package.json'); +const SENTRY_ORG = 'jw-projects'; +const SENTRY_PROJECT = 'mmm-v2'; +const SENTRY_VERSION = `meeting-media-manager@${version}`; + module.exports = configure(function (ctx) { return { // https://v2.quasar.dev/quasar-cli-vite/prefetch-feature @@ -34,25 +38,18 @@ module.exports = configure(function (ctx) { }, extendViteConf(viteConf) { viteConf.optimizeDeps = mergeConfig(viteConf, { - esbuildOptions: { - define: { - global: 'window', - }, - }, + esbuildOptions: { define: { global: 'window' } }, }); - if (ctx.prod && !ctx.debug) { - viteConf.build = mergeConfig(viteConf.build, { - sourcemap: true, - }); + if (ctx.prod && !ctx.debug && process.env.SENTRY_AUTH_TOKEN) { + if (!viteConf.build) viteConf.build = {}; + viteConf.build.sourcemap = true; if (!viteConf.plugins) viteConf.plugins = []; viteConf.plugins.push( sentryVitePlugin({ authToken: process.env.SENTRY_AUTH_TOKEN, - org: 'jw-projects', - project: 'mmm-v2', - release: { - name: version, - }, + org: SENTRY_ORG, + project: SENTRY_PROJECT, + release: { name: SENTRY_VERSION }, telemetry: false, }), ); @@ -137,34 +134,30 @@ module.exports = configure(function (ctx) { }, bundler: 'builder', // 'packager' or 'builder' extendElectronMainConf: (esbuildConf) => { - if (ctx.prod && !ctx.debug) { + if (ctx.prod && !ctx.debug && process.env.SENTRY_AUTH_TOKEN) { esbuildConf.sourcemap = true; if (!esbuildConf.plugins) esbuildConf.plugins = []; esbuildConf.plugins.push( sentryEsbuildPlugin({ authToken: process.env.SENTRY_AUTH_TOKEN, - org: 'jw-projects', - project: 'mmm-v2', - release: { - name: version, - }, + org: SENTRY_ORG, + project: SENTRY_PROJECT, + release: { name: SENTRY_VERSION }, telemetry: false, }), ); } }, extendElectronPreloadConf: (esbuildConf) => { - if (ctx.prod && !ctx.debug) { + if (ctx.prod && !ctx.debug && process.env.SENTRY_AUTH_TOKEN) { esbuildConf.sourcemap = true; if (!esbuildConf.plugins) esbuildConf.plugins = []; esbuildConf.plugins.push( sentryEsbuildPlugin({ authToken: process.env.SENTRY_AUTH_TOKEN, - org: 'jw-projects', - project: 'mmm-v2', - release: { - name: version, - }, + org: SENTRY_ORG, + project: SENTRY_PROJECT, + release: { name: SENTRY_VERSION }, telemetry: false, }), ); diff --git a/src-electron/electron-main.ts b/src-electron/electron-main.ts index ee18b4b30b..2a5c228e74 100644 --- a/src-electron/electron-main.ts +++ b/src-electron/electron-main.ts @@ -11,6 +11,7 @@ import { type MenuItemConstructorOptions, shell, } from 'electron'; +import { SENTRY_DSN } from 'src/constants/sentry'; import { join } from 'upath'; import { PLATFORM } from './constants'; @@ -45,10 +46,9 @@ if (process.env.PORTABLE_EXECUTABLE_DIR) { } initSentry({ - debug: true, - dsn: 'https://0f2ab1c7ddfb118d25704c85957b8188@o1401005.ingest.us.sentry.io/4507449197920256', + dsn: SENTRY_DSN, environment: process.env.NODE_ENV, - release: version, + release: `meeting-media-manager@${version}`, tracesSampleRate: 1.0, }); diff --git a/src/boot/sentry.ts b/src/boot/sentry.ts index c1b43e41bd..3e809923c9 100644 --- a/src/boot/sentry.ts +++ b/src/boot/sentry.ts @@ -6,31 +6,32 @@ import { } from '@sentry/vue'; import { boot } from 'quasar/wrappers'; import { IS_DEV } from 'src/constants/general'; +import { SENTRY_DSN } from 'src/constants/sentry'; import { errorCatcher } from 'src/helpers/error-catcher'; import { version } from '../../package.json'; export default boot(({ app, router }) => { try { - if (!IS_DEV) + if (!IS_DEV) { init( { // @ts-expect-error: app does not exist on Sentry renderer, but it does on Sentry vue app, - debug: true, - dsn: 'https://0f2ab1c7ddfb118d25704c85957b8188@o1401005.ingest.us.sentry.io/4507449197920256', + dsn: SENTRY_DSN, integrations: [ vueIntegration({ app }), browserTracingIntegration({ router }), replayIntegration(), ], - release: version, + release: `meeting-media-manager@${version}`, replaysOnErrorSampleRate: 1.0, replaysSessionSampleRate: 0, tracesSampleRate: 1.0, }, initVue, ); + } } catch (error) { errorCatcher(error); } diff --git a/src/constants/sentry.ts b/src/constants/sentry.ts new file mode 100644 index 0000000000..d27efcfe61 --- /dev/null +++ b/src/constants/sentry.ts @@ -0,0 +1,2 @@ +export const SENTRY_DSN = + 'https://0f2ab1c7ddfb118d25704c85957b8188@o1401005.ingest.us.sentry.io/4507449197920256';