Skip to content

Commit 99ec765

Browse files
authored
Merge branch 'develop' into jb/pkg/profiling-node
2 parents f5fcb8c + 7ab0fe8 commit 99ec765

File tree

209 files changed

+2707
-2781
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

209 files changed

+2707
-2781
lines changed

.git-blame-ignore-revs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,7 @@
88
2aa4e94b036675245290596884959e06dcced044
99

1010
# chore: Rename `integration-tests` -> `browser-integration-tests` (#7455)
11-
ef6b3c7877d5fc8031c08bb28b0ffafaeb01f501
11+
ef6b3c7877d5fc8031c08bb28b0ffafaeb01f501
12+
13+
# chore: Enforce formatting of MD files in repository root #10127
14+
aecf26f22dbf65ce2c0caadc4ce71b46266c9f45

.github/workflows/build.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ env:
3535

3636
# packages/utils/cjs and packages/utils/esm: Symlinks to the folders inside of `build`, needed for tests
3737
CACHED_BUILD_PATHS: |
38+
${{ github.workspace }}/dev-packages/*/build
3839
${{ github.workspace }}/packages/*/build
3940
${{ github.workspace }}/packages/ember/*.d.ts
4041
${{ github.workspace }}/packages/gatsby/*.d.ts
@@ -888,6 +889,7 @@ jobs:
888889
matrix:
889890
test-application:
890891
[
892+
'cloudflare-astro',
891893
'node-express-app',
892894
'create-react-app',
893895
'create-next-app',
@@ -974,6 +976,16 @@ jobs:
974976
timeout-minutes: 5
975977
run: yarn test:assert
976978

979+
- name: Deploy Astro to Cloudflare
980+
uses: cloudflare/pages-action@v1
981+
if: matrix.test-application == 'cloudflare-astro'
982+
with:
983+
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
984+
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
985+
projectName: ${{ secrets.CLOUDFLARE_PROJECT_NAME }}
986+
directory: dist
987+
workingDirectory: dev-packages/e2e-tests/test-applications/${{ matrix.test-application }}
988+
977989
job_required_jobs_passed:
978990
name: All required jobs passed or were skipped
979991
needs:

CHANGELOG.md

Lines changed: 542 additions & 337 deletions
Large diffs are not rendered by default.

CONTRIBUTING.md

Lines changed: 70 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,18 @@
66

77
# Contributing
88

9-
We welcome suggested improvements and bug fixes to the `@sentry/*` family of packages, in the form of pull requests on [`GitHub`](https://github.com/getsentry/sentry-javascript). The guide below will help you get started, but if you have further questions, please feel free to reach out on [Discord](https://discord.gg/Ww9hbqr).
10-
9+
We welcome suggested improvements and bug fixes to the `@sentry/*` family of packages, in the form of pull requests on
10+
[`GitHub`](https://github.com/getsentry/sentry-javascript). The guide below will help you get started, but if you have
11+
further questions, please feel free to reach out on [Discord](https://discord.gg/Ww9hbqr).
1112

1213
## Setting up an Environment
1314

1415
To run the test suite and our code linter, node.js and yarn are required.
1516

16-
[`node` download](https://nodejs.org/download)
17-
[`yarn` download](https://yarnpkg.com/en/docs/install)
17+
[`node` download](https://nodejs.org/download) [`yarn` download](https://yarnpkg.com/en/docs/install)
1818

19-
`sentry-javascript` is a monorepo containing several packages, and we use `lerna` to manage them. To get started, install all dependencies, and then perform an initial build, so TypeScript can read all of the linked type definitions.
19+
`sentry-javascript` is a monorepo containing several packages, and we use `lerna` to manage them. To get started,
20+
install all dependencies, and then perform an initial build, so TypeScript can read all of the linked type definitions.
2021

2122
```
2223
$ yarn
@@ -27,58 +28,78 @@ With that, the repo is fully set up and you are ready to run all commands.
2728

2829
## Building Packages
2930

30-
Since we are using [`TypeScript`](https://www.typescriptlang.org/), you need to transpile the code to JavaScript to be able to use it. From the top level of the repo, there are three commands available:
31+
Since we are using [`TypeScript`](https://www.typescriptlang.org/), you need to transpile the code to JavaScript to be
32+
able to use it. From the top level of the repo, there are three commands available:
3133

3234
- `yarn build:dev`, which runs a one-time build of ES5 and ES6 versions of every package
33-
- `yarn build:dev:filter <name of npm package>`, which runs `yarn build:dev` only in projects relevant to the given package (so, for example, running `yarn build:dev:filter @sentry/react` will build the `react` package, all of its dependencies (`utils`, `core`, `browser`, etc), and all packages which depend on it (currently `gatsby` and `nextjs`))
35+
- `yarn build:dev:filter <name of npm package>`, which runs `yarn build:dev` only in projects relevant to the given
36+
package (so, for example, running `yarn build:dev:filter @sentry/react` will build the `react` package, all of its
37+
dependencies (`utils`, `core`, `browser`, etc), and all packages which depend on it (currently `gatsby` and `nextjs`))
3438
- `yarn build:dev:watch`, which runs `yarn build:dev` in watch mode (recommended)
3539

36-
3740
## Testing SDK Packages Locally
3841

3942
To test local versions of SDK packages, for instance in test projects, you have a couple of options:
4043

41-
* Use [`yarn link`](https://classic.yarnpkg.com/lang/en/docs/cli/link/) to symlink your package to the test project.
42-
* Use [`yalc` to install SDK packages](./docs/using-yalc.md) as if they were already published.
43-
* Run `build:tarball` in the repo and `yarn add ./path/to/tarball.tgz` in the project.
44+
- Use [`yarn link`](https://classic.yarnpkg.com/lang/en/docs/cli/link/) to symlink your package to the test project.
45+
- Use [`yalc` to install SDK packages](./docs/using-yalc.md) as if they were already published.
46+
- Run `build:tarball` in the repo and `yarn add ./path/to/tarball.tgz` in the project.
4447

4548
## Adding Tests
4649

4750
**Any nontrivial fixes/features should include tests.** You'll find a `test` folder in each package.
4851

49-
Note that _for the `browser` package only_, if you add a new file to the [integration test suite](https://github.com/getsentry/sentry-javascript/tree/master/packages/browser/test/integration/suites), you also need to add it to [the list in `shell.js`](https://github.com/getsentry/sentry-javascript/blob/b74e199254147fd984e7bb1ea24193aee70afa74/packages/browser/test/integration/suites/shell.js#L25) as well. Adding tests to existing files will work out of the box in all packages.
52+
Note that _for the `browser` package only_, if you add a new file to the
53+
[integration test suite](https://github.com/getsentry/sentry-javascript/tree/master/packages/browser/test/integration/suites),
54+
you also need to add it to
55+
[the list in `shell.js`](https://github.com/getsentry/sentry-javascript/blob/b74e199254147fd984e7bb1ea24193aee70afa74/packages/browser/test/integration/suites/shell.js#L25)
56+
as well. Adding tests to existing files will work out of the box in all packages.
5057

5158
## Running Tests
5259

53-
Running tests works the same way as building - running `yarn test` at the project root will run tests for all packages, and running `yarn test` in a specific package will run tests for that package. There are also commands to run subsets of the tests in each location. Check out the `scripts` entry of the corresponding `package.json` for details.
60+
Running tests works the same way as building - running `yarn test` at the project root will run tests for all packages,
61+
and running `yarn test` in a specific package will run tests for that package. There are also commands to run subsets of
62+
the tests in each location. Check out the `scripts` entry of the corresponding `package.json` for details.
5463

5564
Note: you must run `yarn build` before `yarn test` will work.
5665

5766
## Debugging Tests
5867

5968
If you run into trouble writing tests and need to debug one of them, you can do so using VSCode's debugger.
6069

61-
0. If you don't already have it installed, install the Tasks Shell Input extension, which you'll find in the Extensions tab in the sidebar as one of the recommended workspace extensions.
70+
0. If you don't already have it installed, install the Tasks Shell Input extension, which you'll find in the Extensions
71+
tab in the sidebar as one of the recommended workspace extensions.
6272

6373
1. Place breakpoints or `debugger` statements in the test or the underlying code wherever you'd like `jest` to pause.
6474
2. Open the file containing the test in question, and make sure its tab is active (so you can see the file's contents).
6575
3. Switch to the debugger in the sidebar and choose `Debug unit tests - just open file` from the dropdown.
6676
4. Click the green "play" button to run the tests in the open file in watch mode.
6777

68-
Pro tip: If any of your breakpoints are in code run by multiple tests, and you run the whole test file, you'll land on those breakpoints over and over again, in the middle of tests you don't care about. To avoid this, replace the test's initial `it` or `test` with `it.only` or `test.only`. That way, when you hit a breakpoint, you'll know you got there are part of the buggy test.
78+
Pro tip: If any of your breakpoints are in code run by multiple tests, and you run the whole test file, you'll land on
79+
those breakpoints over and over again, in the middle of tests you don't care about. To avoid this, replace the test's
80+
initial `it` or `test` with `it.only` or `test.only`. That way, when you hit a breakpoint, you'll know you got there are
81+
part of the buggy test.
6982

7083
## Debug Build Flags
7184

7285
Throughout the codebase, you will find a `__DEBUG_BUILD__` constant. This flag serves two purposes:
7386

74-
1. It enables us to remove debug code from our minified CDN bundles during build, by replacing the flag with `false` before tree-shaking occurs.
75-
2. It enables users to remove Sentry debug code from their production bundles during their own build. When we build our npm packages, we replace the flag with `(typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__)`. If the user does nothing, this evaluates to `true` and logging is included. But if the user runs their own replacement during build (again replacing the flag with `false`), the build will tree-shake the logging away, just as our bundle builds do.
87+
1. It enables us to remove debug code from our minified CDN bundles during build, by replacing the flag with `false`
88+
before tree-shaking occurs.
89+
2. It enables users to remove Sentry debug code from their production bundles during their own build. When we build our
90+
npm packages, we replace the flag with `(typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__)`. If the user
91+
does nothing, this evaluates to `true` and logging is included. But if the user runs their own replacement during
92+
build (again replacing the flag with `false`), the build will tree-shake the logging away, just as our bundle builds
93+
do.
7694

77-
Note that the replacement flag, `__SENTRY_DEBUG__`, is different from the original flag . This is necessary because the replacement plugin runs twice, at two different stages of the build, and we don't want to run a replacement on our replacement (as would happen if we reused `__DEBUG_BUILD__`).
95+
Note that the replacement flag, `__SENTRY_DEBUG__`, is different from the original flag . This is necessary because the
96+
replacement plugin runs twice, at two different stages of the build, and we don't want to run a replacement on our
97+
replacement (as would happen if we reused `__DEBUG_BUILD__`).
7898

7999
## Linting
80100

81-
Similar to building and testing, linting can be done in the project root or in individual packages by calling `yarn lint`.
101+
Similar to building and testing, linting can be done in the project root or in individual packages by calling
102+
`yarn lint`.
82103

83104
Note: you must run `yarn build` before `yarn lint` will work.
84105

@@ -89,24 +110,34 @@ When contributing to the codebase, please note:
89110
- Make sure to follow the [Commit, Issue & PR guidelines](#commit-issue--pr-guidelines)
90111
- Non-trivial PRs will not be accepted without tests (see above).
91112
- Please do not bump version numbers yourself.
92-
- [`raven-js`](https://github.com/getsentry/sentry-javascript/tree/3.x/packages/raven-js) and [`raven-node`](https://github.com/getsentry/sentry-javascript/tree/3.x/packages/raven-node) are deprecated, and only bug and security fix PRs will be accepted targeting the [3.x branch](https://github.com/getsentry/sentry-javascript/tree/3.x). Any new features and improvements should be to our new SDKs (`browser`, `node`, and framework-specific packages like `react` and `nextjs`) and the packages which support them (`core`, `utils`, `integrations`, and the like).
113+
- [`raven-js`](https://github.com/getsentry/sentry-javascript/tree/3.x/packages/raven-js) and
114+
[`raven-node`](https://github.com/getsentry/sentry-javascript/tree/3.x/packages/raven-node) are deprecated, and only
115+
bug and security fix PRs will be accepted targeting the
116+
[3.x branch](https://github.com/getsentry/sentry-javascript/tree/3.x). Any new features and improvements should be to
117+
our new SDKs (`browser`, `node`, and framework-specific packages like `react` and `nextjs`) and the packages which
118+
support them (`core`, `utils`, `integrations`, and the like).
93119

94120
## PR reviews
95121

96-
For feedback in PRs, we use the [LOGAF scale](https://blog.danlew.net/2020/04/15/the-logaf-scale/) to specify how important a comment is:
122+
For feedback in PRs, we use the [LOGAF scale](https://blog.danlew.net/2020/04/15/the-logaf-scale/) to specify how
123+
important a comment is:
97124

98-
* `l`: low - nitpick. You may address this comment, but you don't have to.
99-
* `m`: medium - normal comment. Worth addressing and fixing.
100-
* `h`: high - Very important. We must not merge this PR without addressing this issue.
125+
- `l`: low - nitpick. You may address this comment, but you don't have to.
126+
- `m`: medium - normal comment. Worth addressing and fixing.
127+
- `h`: high - Very important. We must not merge this PR without addressing this issue.
101128

102-
You only need one approval from a maintainer to be able to merge. For some PRs, asking specific or multiple people for review might be adequate.
129+
You only need one approval from a maintainer to be able to merge. For some PRs, asking specific or multiple people for
130+
review might be adequate.
103131

104132
Our different types of reviews:
105133

106-
1. **LGTM without any comments.** You can merge immediately.
107-
2. **LGTM with low and medium comments.** The reviewer trusts you to resolve these comments yourself, and you don't need to wait for another approval.
108-
3. **Only comments.** You must address all the comments and need another review until you merge.
109-
4. **Request changes.** Only use if something critical is in the PR that absolutely must be addressed. We usually use `h` comments for that. When someone requests changes, the same person must approve the changes to allow merging. Use this sparingly.
134+
1. **LGTM without any comments.** You can merge immediately.
135+
2. **LGTM with low and medium comments.** The reviewer trusts you to resolve these comments yourself, and you don't need
136+
to wait for another approval.
137+
3. **Only comments.** You must address all the comments and need another review until you merge.
138+
4. **Request changes.** Only use if something critical is in the PR that absolutely must be addressed. We usually use
139+
`h` comments for that. When someone requests changes, the same person must approve the changes to allow merging. Use
140+
this sparingly.
110141

111142
## Commit, Issue & PR guidelines
112143

@@ -116,7 +147,7 @@ For commit messages, we use the format:
116147

117148
```
118149
<type>(<scope>): <subject> (<github-id>)
119-
````
150+
```
120151

121152
For example: `feat(core): Set custom transaction source for event processors (#5722)`.
122153

@@ -126,17 +157,19 @@ The Github-ID can be left out until the PR is merged.
126157

127158
### Issues
128159

129-
Issues should at least be categorized by package, for example `package: Node`.
130-
Additional labels for categorization can be added, and the Sentry SDK team may also add further labels as needed.
160+
Issues should at least be categorized by package, for example `package: Node`. Additional labels for categorization can
161+
be added, and the Sentry SDK team may also add further labels as needed.
131162

132163
### Pull Requests (PRs)
133164

134-
PRs are merged via `Squash and merge`.
135-
This means that all commits on the branch will be squashed into a single commit, and committed as such onto master.
165+
PRs are merged via `Squash and merge`. This means that all commits on the branch will be squashed into a single commit,
166+
and committed as such onto master.
136167

137-
* The PR name can generally follow the commit name (e.g. `feat(core): Set custom transaction source for event processors`)
138-
* Make sure to rebase the branch on `master` before squashing it
139-
* Make sure to update the commit message of the squashed branch to follow the commit guidelines - including the PR number
168+
- The PR name can generally follow the commit name (e.g.
169+
`feat(core): Set custom transaction source for event processors`)
170+
- Make sure to rebase the branch on `master` before squashing it
171+
- Make sure to update the commit message of the squashed branch to follow the commit guidelines - including the PR
172+
number
140173

141174
### Gitflow
142175

0 commit comments

Comments
 (0)