Skip to content

Commit 33b45c2

Browse files
feat(wizard): Add react wizard variants - (#6497)
1 parent 5a544a9 commit 33b45c2

File tree

7 files changed

+231
-2
lines changed

7 files changed

+231
-2
lines changed

bin/lint-docs.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ type Violation = {
1313
context: string;
1414
};
1515

16-
const hasWizardContent = (platformName, guideName = null) => {
16+
const hasWizardContent = (platformName: string, guideName = null) => {
1717
const path = guideName
1818
? `src/wizard/${platformName}/${guideName}.md`
1919
: `src/wizard/${platformName}/index.md`;
@@ -42,6 +42,7 @@ const testConfig = config => {
4242
const main = async () => {
4343
const platformRegistry = new PlatformRegistry();
4444
await platformRegistry.init();
45+
4546

4647
const violations: Violation[] = [];
4748
platformRegistry.platforms.forEach(platform => {

src/gatsby/onPostBuild.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,30 @@ const parsePathSlug = (slug: string) => {
9393
? `${product}-onboarding-${step}`
9494
: `${sub_platform}-${product}-onboarding-${step}`;
9595

96+
9697
return {
9798
platform,
9899
sub,
99100
};
100101
}
102+
103+
if (slug.includes("/react/") && slug !== "/javascript/react/") {
104+
105+
const pathMatch = slug.match(
106+
/^\/(?<platform>[^/]+)\/(?<sub_platform>[^/]+)\/(?<product>index|with-error-monitoring|with-error-monitoring-and-performance|with-error-monitoring-and-replay|with-error-monitoring-performance-and-replay)\/$/
107+
);
108+
109+
if (!pathMatch) {
110+
throw new Error(`Unable to parse react doc paths from slug: ${slug}`);
111+
}
112+
113+
const { platform, product, sub_platform } = pathMatch.groups;
114+
115+
return {
116+
platform,
117+
sub: `${sub_platform}-${product}`
118+
}
119+
}
101120

102121
const pathMatch = slug.match(/^\/([^/]+)(?:\/([^/]+))?\/$/);
103122
if (!pathMatch) throw new Error("cant identify language");
@@ -126,6 +145,7 @@ const writeJson = async (
126145
return;
127146
}
128147
const key = sub ? `${main}.${sub}` : `${main}`;
148+
129149
const data = {
130150
key,
131151
type: node.frontmatter.type,

src/wizard/javascript/react.md renamed to src/wizard/javascript/react/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,4 @@ return <button onClick={() => methodDoesNotExist()}>Break the world</button>;
5656
## Next Steps
5757
- [Source Maps](https://docs.sentry.io/platforms/javascript/guides/react/sourcemaps/): Learn how to enable readable stack traces in your Sentry errors.
5858
- [React Features](https://docs.sentry.io/platforms/javascript/guides/react/features/): Learn about our first class integration with the React framework.
59-
- [Session Replay](https://docs.sentry.io/platforms/javascript/guides/react/session-replay/): Get to the root cause of an error or latency issue faster by seeing all the technical details related to that issue in one visual replay on your web application.
59+
- [Session Replay](https://docs.sentry.io/platforms/javascript/guides/react/session-replay/): Get to the root cause of an error or latency issue faster by seeing all the technical details related to that issue in one visual replay on your web application.
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
---
2+
name: React
3+
doc_link: https://docs.sentry.io/platforms/javascript/guides/react/
4+
support_level: production
5+
type: framework
6+
7+
---
8+
9+
## Install
10+
Sentry captures data by using an SDK within your application’s runtime.
11+
12+
```bash
13+
# Using yarn
14+
yarn add @sentry/react @sentry/tracing
15+
16+
# Using npm
17+
npm install --save @sentry/react @sentry/tracing
18+
```
19+
20+
## Configure
21+
Initialize Sentry as early as possible in your application's lifecycle.
22+
23+
```javascript
24+
import { createRoot } React from "react-dom/client";
25+
import React from "react";
26+
import * as Sentry from "@sentry/react";
27+
import { BrowserTracing } from "@sentry/tracing";
28+
import App from "./App";
29+
30+
Sentry.init({
31+
dsn: "___PUBLIC_DSN___",
32+
integrations: [new BrowserTracing()],
33+
// Performance Monitoring
34+
tracesSampleRate: 1.0, // Capture 100% of the transactions, reduce in production!
35+
});
36+
37+
const container = document.getElementById(“app”);
38+
const root = createRoot(container);
39+
root.render(<App />)
40+
```
41+
42+
## Verify
43+
This snippet contains an intentional error and can be used as a test to make sure that everything's working as expected.
44+
45+
```javascript
46+
return <button onClick={() => methodDoesNotExist()}>Break the world</button>;
47+
```
48+
49+
---
50+
## Next Steps
51+
- [Source Maps](https://docs.sentry.io/platforms/javascript/guides/react/sourcemaps/): Learn how to enable readable stack traces in your Sentry errors.
52+
- [React Features](https://docs.sentry.io/platforms/javascript/guides/react/features/): Learn about our first class integration with the React framework.
53+
- [Session Replay](https://docs.sentry.io/platforms/javascript/guides/react/session-replay/): Get to the root cause of an error or latency issue faster by seeing all the technical details related to that issue in one visual replay on your web application.
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
---
2+
name: React
3+
doc_link: https://docs.sentry.io/platforms/javascript/guides/react/
4+
support_level: production
5+
type: framework
6+
7+
---
8+
9+
## Install
10+
Sentry captures data by using an SDK within your application’s runtime.
11+
12+
```bash
13+
# Using yarn
14+
yarn add @sentry/react
15+
```
16+
17+
## Configure
18+
Initialize Sentry as early as possible in your application's lifecycle.
19+
20+
```javascript
21+
import { createRoot } React from "react-dom/client";
22+
import React from "react";
23+
import * as Sentry from "@sentry/react";
24+
import App from "./App";
25+
26+
Sentry.init({
27+
dsn: "___PUBLIC_DSN___",
28+
integrations: [new Sentry.Replay()],
29+
// Session Replay
30+
replaysSessionSampleRate: 0.1, // This sets the sample rate at 10%. You may want to change it to 100% while in development and then sample at a lower rate in production.
31+
replaysOnErrorSampleRate: 1.0, // If you're not already sampling the entire session, change the sample rate to 100% when sampling sessions where errors occur.
32+
});
33+
34+
const container = document.getElementById(“app”);
35+
const root = createRoot(container);
36+
root.render(<App />)
37+
```
38+
39+
## Verify
40+
This snippet contains an intentional error and can be used as a test to make sure that everything's working as expected.
41+
42+
```javascript
43+
return <button onClick={() => methodDoesNotExist()}>Break the world</button>;
44+
```
45+
46+
---
47+
## Next Steps
48+
- [Source Maps](https://docs.sentry.io/platforms/javascript/guides/react/sourcemaps/): Learn how to enable readable stack traces in your Sentry errors.
49+
- [React Features](https://docs.sentry.io/platforms/javascript/guides/react/features/): Learn about our first class integration with the React framework.
50+
- [Performance Monitoring](https://docs.sentry.io/platforms/javascript/guides/react/performance/): Track down transactions to connect the dots between 10-second page loads and poor-performing API calls or slow database queries.
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
---
2+
name: React
3+
doc_link: https://docs.sentry.io/platforms/javascript/guides/react/
4+
support_level: production
5+
type: framework
6+
7+
---
8+
9+
## Install
10+
Sentry captures data by using an SDK within your application’s runtime.
11+
12+
```bash
13+
# Using yarn
14+
yarn add @sentry/react @sentry/tracing
15+
16+
# Using npm
17+
npm install --save @sentry/react @sentry/tracing
18+
```
19+
20+
## Configure
21+
Initialize Sentry as early as possible in your application's lifecycle.
22+
23+
```javascript
24+
import { createRoot } React from "react-dom/client";
25+
import React from "react";
26+
import * as Sentry from "@sentry/react";
27+
import { BrowserTracing } from "@sentry/tracing";
28+
import App from "./App";
29+
30+
Sentry.init({
31+
dsn: "___PUBLIC_DSN___",
32+
integrations: [new BrowserTracing(), new Sentry.Replay()],
33+
// Performance Monitoring
34+
tracesSampleRate: 1.0, // Capture 100% of the transactions, reduce in production!
35+
// Session Replay
36+
replaysSessionSampleRate: 0.1, // This sets the sample rate at 10%. You may want to change it to 100% while in development and then sample at a lower rate in production.
37+
replaysOnErrorSampleRate: 1.0, // If you're not already sampling the entire session, change the sample rate to 100% when sampling sessions where errors occur.
38+
});
39+
40+
const container = document.getElementById(“app”);
41+
const root = createRoot(container);
42+
root.render(<App />)
43+
```
44+
45+
## Verify
46+
This snippet contains an intentional error and can be used as a test to make sure that everything's working as expected.
47+
48+
```javascript
49+
return <button onClick={() => methodDoesNotExist()}>Break the world</button>;
50+
```
51+
52+
---
53+
## Next Steps
54+
- [Source Maps](https://docs.sentry.io/platforms/javascript/guides/react/sourcemaps/): Learn how to enable readable stack traces in your Sentry errors.
55+
- [React Features](https://docs.sentry.io/platforms/javascript/guides/react/features/): Learn about our first class integration with the React framework.
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
---
2+
name: React
3+
doc_link: https://docs.sentry.io/platforms/javascript/guides/react/
4+
support_level: production
5+
type: framework
6+
7+
---
8+
9+
## Install
10+
Sentry captures data by using an SDK within your application’s runtime.
11+
12+
```bash
13+
# Using yarn
14+
yarn add @sentry/react
15+
16+
# Using npm
17+
npm install --save @sentry/react
18+
```
19+
20+
## Configure
21+
Initialize Sentry as early as possible in your application's lifecycle.
22+
23+
```javascript
24+
import { createRoot } React from "react-dom/client";
25+
import React from "react";
26+
import * as Sentry from "@sentry/react";
27+
import App from "./App";
28+
29+
Sentry.init({
30+
dsn: "___PUBLIC_DSN___",
31+
});
32+
33+
const container = document.getElementById(“app”);
34+
const root = createRoot(container);
35+
root.render(<App />)
36+
```
37+
38+
## Verify
39+
This snippet contains an intentional error and can be used as a test to make sure that everything's working as expected.
40+
41+
```javascript
42+
return <button onClick={() => methodDoesNotExist()}>Break the world</button>;
43+
```
44+
45+
---
46+
## Next Steps
47+
- [Source Maps](https://docs.sentry.io/platforms/javascript/guides/react/sourcemaps/): Learn how to enable readable stack traces in your Sentry errors.
48+
- [React Features](https://docs.sentry.io/platforms/javascript/guides/react/features/): Learn about our first class integration with the React framework.
49+
- [Performance Monitoring](https://docs.sentry.io/platforms/javascript/guides/react/performance/): Track down transactions to connect the dots between 10-second page loads and poor-performing API calls or slow database queries.
50+
- [Session Replay](https://docs.sentry.io/platforms/javascript/guides/react/session-replay/): Get to the root cause of an error or latency issue faster by seeing all the technical details related to that issue in one visual replay on your web application.

0 commit comments

Comments
 (0)