Skip to content

Commit c6fa54a

Browse files
author
Adam Cronin
committed
Running prettier on the new example code
1 parent 1d10048 commit c6fa54a

3 files changed

Lines changed: 77 additions & 77 deletions

File tree

examples/plugin/vite/index.html

Lines changed: 46 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,50 @@
11
<!DOCTYPE html>
22
<html lang="en">
3-
<head>
4-
<meta charset="UTF-8" />
5-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6-
<title>Backtrace Vite Plugin Example</title>
7-
<link rel="preconnect" href="https://fonts.googleapis.com" />
8-
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
9-
<link href="https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;700&display=swap" rel="stylesheet" />
10-
<link rel="stylesheet" href="/src/index.css" />
11-
</head>
12-
<body>
13-
<div class="card center">
14-
<a href="https://www.saucelabs.com/">
15-
<img
16-
src="https://info.saucelabs.com/rs/468-XBT-687/images/SL%20logo%20horizontal%20color%2Bdark%402x.png"
17-
width="250"
18-
alt="Sauce Labs"
19-
class="center"
20-
/>
21-
</a>
22-
<br />
23-
<h1 class="card-header">Backtrace Vite Plugin Example</h1>
24-
<p style="text-align: center">Please pick one of the available options:</p>
25-
<br />
26-
<div class="action-container center">
27-
<div class="action-button center">
28-
<a class="text" id="send-error">Send an error</a>
3+
<head>
4+
<meta charset="UTF-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6+
<title>Backtrace Vite Plugin Example</title>
7+
<link rel="preconnect" href="https://fonts.googleapis.com" />
8+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
9+
<link href="https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;700&display=swap" rel="stylesheet" />
10+
<link rel="stylesheet" href="/src/index.css" />
11+
</head>
12+
<body>
13+
<div class="card center">
14+
<a href="https://www.saucelabs.com/">
15+
<img
16+
src="https://info.saucelabs.com/rs/468-XBT-687/images/SL%20logo%20horizontal%20color%2Bdark%402x.png"
17+
width="250"
18+
alt="Sauce Labs"
19+
class="center"
20+
/>
21+
</a>
22+
<br />
23+
<h1 class="card-header">Backtrace Vite Plugin Example</h1>
24+
<p style="text-align: center">Please pick one of the available options:</p>
25+
<br />
26+
<div class="action-container center">
27+
<div class="action-button center">
28+
<a class="text" id="send-error">Send an error</a>
29+
</div>
30+
<div class="action-button center">
31+
<a class="text" id="send-message">Send a message</a>
32+
</div>
33+
<div class="action-button center">
34+
<a class="text" id="send-unhandled-exception">Send an unhandled exception</a>
35+
</div>
36+
<div class="action-button center">
37+
<a class="text" id="send-promise-rejection">Send a promise rejection</a>
38+
</div>
39+
</div>
40+
<div class="summary-information">
41+
<p>If you have any questions or concerns, please contact us at</p>
42+
<a href="mailto:help@saucelabs.com">help@saucelabs.com</a>
43+
<br /><br />
44+
<p>Happy testing,</p>
45+
<p>The Sauce Labs Team</p>
46+
</div>
2947
</div>
30-
<div class="action-button center">
31-
<a class="text" id="send-message">Send a message</a>
32-
</div>
33-
<div class="action-button center">
34-
<a class="text" id="send-unhandled-exception">Send an unhandled exception</a>
35-
</div>
36-
<div class="action-button center">
37-
<a class="text" id="send-promise-rejection">Send a promise rejection</a>
38-
</div>
39-
</div>
40-
<div class="summary-information">
41-
<p>If you have any questions or concerns, please contact us at</p>
42-
<a href="mailto:help@saucelabs.com">help@saucelabs.com</a>
43-
<br /><br />
44-
<p>Happy testing,</p>
45-
<p>The Sauce Labs Team</p>
46-
</div>
47-
</div>
48-
<script type="module" src="/src/main.ts"></script>
49-
</body>
48+
<script type="module" src="/src/main.ts"></script>
49+
</body>
5050
</html>

examples/plugin/vite/src/main.ts

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,43 +5,43 @@ import { BacktraceClient, BacktraceStringAttachment } from '@backtrace/browser';
55
const submissionUrl = import.meta.env.VITE_BACKTRACE_SUBMISSION_URL;
66

77
const client = BacktraceClient.builder({
8-
url: submissionUrl,
9-
name: 'vite-plugin-example',
10-
version: '1.0.0',
8+
url: submissionUrl,
9+
name: 'vite-plugin-example',
10+
version: '1.0.0',
1111
}).build();
1212

1313
// Helper to trigger an error
1414
function parseNotExistingDomElement(): string {
15-
const element = document.getElementById('not-existing-id') as HTMLElement;
16-
return element.outerText.split('\n')[1].toString();
15+
const element = document.getElementById('not-existing-id') as HTMLElement;
16+
return element.outerText.split('\n')[1].toString();
1717
}
1818

1919
// 1. Send handled error
2020
document.getElementById('send-error')?.addEventListener('click', async () => {
21-
try {
22-
parseNotExistingDomElement();
23-
} catch (err) {
24-
await client.send(err as Error, { action: 'send-error' }, [
25-
new BacktraceStringAttachment('test.txt', 'sample attachment content'),
26-
]);
27-
}
21+
try {
22+
parseNotExistingDomElement();
23+
} catch (err) {
24+
await client.send(err as Error, { action: 'send-error' }, [
25+
new BacktraceStringAttachment('test.txt', 'sample attachment content'),
26+
]);
27+
}
2828
});
2929

3030
// 2. Send message
3131
document.getElementById('send-message')?.addEventListener('click', async () => {
32-
await client.send('test-message', { action: 'send-message' });
32+
await client.send('test-message', { action: 'send-message' });
3333
});
3434

3535
// 3. Send unhandled exception
3636
document.getElementById('send-unhandled-exception')?.addEventListener('click', () => {
37-
throw new Error('Unhandled exception from Vite plugin example');
37+
throw new Error('Unhandled exception from Vite plugin example');
3838
});
3939

4040
// 4. Send promise rejection
4141
document.getElementById('send-promise-rejection')?.addEventListener('click', () => {
42-
new Promise(() => {
43-
throw new Error('Promise rejection from Vite plugin example');
44-
});
42+
new Promise(() => {
43+
throw new Error('Promise rejection from Vite plugin example');
44+
});
4545
});
4646

4747
console.log('Backtrace Vite Plugin Example loaded');

examples/plugin/vite/vite.config.ts

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,20 @@ import { defineConfig, loadEnv } from 'vite';
22
import { BacktracePlugin } from '@backtrace/vite-plugin';
33

44
export default defineConfig(({ mode }) => {
5-
// Load env variables from .env file
6-
const env = loadEnv(mode, process.cwd(), '');
5+
// Load env variables from .env file
6+
const env = loadEnv(mode, process.cwd(), '');
77

8-
return {
9-
build: {
10-
sourcemap: true,
11-
},
12-
plugins: [
13-
BacktracePlugin({
14-
uploadUrl: env.BACKTRACE_UPLOAD_URL,
15-
uploadOptions: {
16-
includeSources: true,
8+
return {
9+
build: {
10+
sourcemap: true,
1711
},
18-
}),
19-
],
20-
};
12+
plugins: [
13+
BacktracePlugin({
14+
uploadUrl: env.BACKTRACE_UPLOAD_URL,
15+
uploadOptions: {
16+
includeSources: true,
17+
},
18+
}),
19+
],
20+
};
2121
});

0 commit comments

Comments
 (0)