Skip to content

Commit

Permalink
Merge branch 'fb-sentry'
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesbartnik committed Dec 13, 2023
2 parents b61c02e + 5d1e67f commit 656b3b2
Show file tree
Hide file tree
Showing 5 changed files with 441 additions and 28 deletions.
4 changes: 3 additions & 1 deletion apps/sentry-client-desktop/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,6 @@ release
public/web
tsconfig.node.tsbuildinfo
vite.config.js
vite.config.d.ts
vite.config.d.ts
# Sentry Config File
.env.sentry-build-plugin
4 changes: 4 additions & 0 deletions apps/sentry-client-desktop/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@
"dependencies": {
"@radix-ui/react-tooltip": "^1.0.7",
"@sentry/core": "workspace:*",
"@sentry/electron": "^4.15.1",
"@sentry/integrations": "^7.87.0",
"@sentry/react": "^7.86.0",
"@sentry/ui": "workspace:*",
"@sentry/vite-plugin": "^2.10.2",
"@sentry/web-connect": "workspace:*",
"classnames": "^2.3.2",
"clsx": "^1.2.1",
Expand Down
38 changes: 37 additions & 1 deletion apps/sentry-client-desktop/src/main.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,46 @@
// main.tsx
import {StrictMode} from 'react'
import {StrictMode, useEffect} from 'react'
import ReactDOM from 'react-dom/client'
import {AppRoutes} from './features/router'
import * as Sentry from "@sentry/react";
import {HttpClient} from "@sentry/integrations";
import "./index.css";
import {createRoutesFromChildren, matchRoutes, useLocation, useNavigationType} from "react-router-dom";

const rootElement = document.getElementById('root')!

Sentry.init({
release: import.meta.env.APP_VERSION,
dsn: "https://a72bd57d284f8711761b36655e40b65e@o4506378569777152.ingest.sentry.io/4506378571612160",

integrations: [
new Sentry.BrowserTracing({
// See docs for support of different versions of variation of react router
// https://docs.sentry.io/platforms/javascript/guides/react/configuration/integrations/react-router/
routingInstrumentation: Sentry.reactRouterV6Instrumentation(
useEffect,
useLocation,
useNavigationType,
createRoutesFromChildren,
matchRoutes
),
}),
// Following are true by default: maskAllText: true, blockAllMedia: true,
new Sentry.Replay(),

new HttpClient()
],
// Performance Monitoring
tracesSampleRate: 0.1, // Capture 10% of the transactions
tracePropagationTargets: ["localhost", /^https:\/\/yourserver\.io\/api/], // Control for which URLs distributed tracing should be enabled

// Session Replay
replaysSessionSampleRate: 0.1, // Sample rate = 10%.
replaysOnErrorSampleRate: 1.0, // Sample rate= 100% where errors occur.

sendDefaultPii: true, // This option is required for capturing headers and cookies.
});

if (!rootElement.innerHTML) {
const root = ReactDOM.createRoot(rootElement)
root.render(
Expand Down
50 changes: 29 additions & 21 deletions apps/sentry-client-desktop/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { sentryVitePlugin } from "@sentry/vite-plugin";
import {defineConfig} from 'vite'
import path from 'node:path'
import electron from 'vite-plugin-electron/simple'
Expand All @@ -7,7 +8,7 @@ import tailwindcss from "tailwindcss";

// https://vitejs.dev/config/
export default defineConfig({
resolve: {
resolve: {
alias: [
{
find: "@",
Expand All @@ -19,33 +20,40 @@ export default defineConfig({
},
],
},
css: {

css: {
postcss: {
plugins: [
tailwindcss,
// autoprefixer({}) as any,
],
},
},
plugins: [
react(),
svgr(),
electron({
main: {
// Shortcut of `build.lib.entry`.
entry: 'electron/main.ts',
},
preload: {
// Shortcut of `build.rollupOptions.input`.
// Preload scripts may contain Web assets, so use the `build.rollupOptions.input` instead `build.lib.entry`.
input: path.join(__dirname, 'electron/preload.ts'),
},
// Ployfill the Electron and Node.js built-in modules for Renderer process.
// See 👉 https://github.com/electron-vite/vite-plugin-electron-renderer
renderer: {},
}),
],
define: {

plugins: [react(), svgr(), electron({
main: {
// Shortcut of `build.lib.entry`.
entry: 'electron/main.ts',
},
preload: {
// Shortcut of `build.rollupOptions.input`.
// Preload scripts may contain Web assets, so use the `build.rollupOptions.input` instead `build.lib.entry`.
input: path.join(__dirname, 'electron/preload.ts'),
},
// Ployfill the Electron and Node.js built-in modules for Renderer process.
// See 👉 https://github.com/electron-vite/vite-plugin-electron-renderer
renderer: {},
}), sentryVitePlugin({
org: "xai-foundation",
project: "javascript-react",
authToken: process.env.SENTRY_AUTH_TOKEN
})],

define: {
'import.meta.env.APP_VERSION': JSON.stringify(process.env.npm_package_version)
},

build: {
sourcemap: true
}
})
Loading

0 comments on commit 656b3b2

Please sign in to comment.