Skip to content

Commit

Permalink
fix: Fix electron version names in Sentry (#633)
Browse files Browse the repository at this point in the history
Currently, we see git SHAs as version names in Sentry for the Electron
project. This fix should give us semver versions instead.
  • Loading branch information
BYK authored Dec 14, 2024
1 parent 09d3179 commit 9251c8c
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
8 changes: 6 additions & 2 deletions packages/electron/electron.vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,18 @@ export default defineConfig(({ mode }) => {
env = loadEnv(mode);
}
return {
define: {
'process.env.NODE_ENV': '"production"',
'process.env.npm_package_version': JSON.stringify(process.env.npm_package_version),
},
main: {
plugins: [
sentryVitePlugin({
org: env.MAIN_VITE_SENTRY_ORG,
project: env.MAIN_VITE_SENTRY_PROJECT,
authToken: env.MAIN_VITE_SENTRY_AUTH_TOKEN,
release: {
name: `spotlight@${process.env.npm_package_version}`,
name: process.env.npm_package_version,
},
}),
],
Expand All @@ -41,7 +45,7 @@ export default defineConfig(({ mode }) => {
project: env.MAIN_VITE_SENTRY_PROJECT,
authToken: env.MAIN_VITE_SENTRY_AUTH_TOKEN,
release: {
name: `spotlight@${process.env.npm_package_version}`,
name: process.env.npm_package_version,
},
}),
],
Expand Down
3 changes: 2 additions & 1 deletion packages/electron/src/electron/main/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ const store = new Store();
Sentry.init({
dsn: 'https://[email protected]/4506400311934976',
tracesSampleRate: 1.0,
release: `spotlight@${process.env.npm_package_version}`,
environment: process.env.NODE_ENV,
release: process.env.npm_package_version,
beforeSend: askForPermissionToSendToSentry,
});

Expand Down
2 changes: 2 additions & 0 deletions packages/electron/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import * as Spotlight from '@spotlightjs/overlay';

Sentry.init({
dsn: 'https://[email protected]/4506400311934976',
environment: process.env.NODE_ENV,
release: process.env.npm_package_version,
integrations: [
Sentry.browserTracingIntegration(),
Sentry.replayIntegration({
Expand Down
2 changes: 1 addition & 1 deletion packages/spotlight/vite.overlay.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { defineConfig } from 'vite';

export default defineConfig({
define: {
'process.env.NODE_ENV': "'production'",
'process.env.NODE_ENV': '"production"',
'process.env.npm_package_version': JSON.stringify(process.env.npm_package_version),
},
build: {
Expand Down

0 comments on commit 9251c8c

Please sign in to comment.