Skip to content

Commit

Permalink
feat: Electron v5 changes (#591)
Browse files Browse the repository at this point in the history
  • Loading branch information
timfish authored Jun 17, 2024
1 parent db5fceb commit e65b18f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## Unreleased

- fix(step-wizards): Show correct URL when prompting DSN (#577)
- feat(electron): Update code examples for v5 (#591)

## 3.23.1

Expand Down
21 changes: 18 additions & 3 deletions lib/Steps/Integrations/Electron.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,22 @@ const MIN_ELECTRON_VERSION = parseInt(
10,
);

const CODE_EXAMPLE = `const Sentry = require('@sentry/electron');
const CODE_EXAMPLE_MAIN = `// ESM
import * as Sentry from '@sentry/electron/main';
// CommonJs
const Sentry = require('@sentry/electron/main');
Sentry.init({
dsn: '___DSN___',
});`;

const CODE_EXAMPLE_RENDERER = `// ESM
import * as Sentry from '@sentry/electron/renderer';
// CommonJs
const Sentry = require('@sentry/electron/renderer');
Sentry.init({});`;

let appPackage: any = {};

function printExample(example: string, title = ''): void {
Expand Down Expand Up @@ -61,8 +71,13 @@ export class Electron extends BaseIntegration {
nl();

printExample(
CODE_EXAMPLE.replace('___DSN___', dsn),
'Put these lines in to your main and renderer processes to setup Sentry:',
CODE_EXAMPLE_MAIN.replace('___DSN___', dsn),
'Add these lines in to your main process code to setup Sentry:',
);

printExample(
CODE_EXAMPLE_RENDERER,
'Add these lines in to your renderer processes code to setup Sentry:',
);

l('For more information, see https://docs.sentry.io/clients/electron/');
Expand Down

0 comments on commit e65b18f

Please sign in to comment.