Skip to content

Commit 9ea5352

Browse files
committed
Switch from Yarn to pnpm package manager across project
1 parent 056590b commit 9ea5352

File tree

7 files changed

+35
-45
lines changed

7 files changed

+35
-45
lines changed

.npmrc

Lines changed: 0 additions & 10 deletions
This file was deleted.

CONTRIBUTING.md

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

77
## Setting up an Environment
88

9-
We use Next.js, `yarn` and `volta` to manage the environment.
9+
We use Next.js, `pnpm` and `volta` to manage the environment.
1010

1111
```
1212
cp .env.example .env.development
13-
yarn
13+
pnpm install
1414
1515
# Start dev server for user docs
16-
yarn dev
16+
pnpm dev
1717
1818
# Start dev server for developer docs
19-
yarn dev:developer-docs
19+
pnpm dev:developer-docs
2020
```
2121

2222
With that, the repo is fully set up and you are ready to open local docs under http://localhost:3000

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
develop: setup-git
22
[ -f .env.development ] || cp .env.example .env.development
3-
yarn
3+
pnpm install
44

55
setup-git:
66
ifneq (, $(shell which pre-commit))
@@ -9,7 +9,7 @@ endif
99
git config branch.autosetuprebase always
1010

1111
test:
12-
yarn test
12+
pnpm test
1313

1414
preview-api-docs:
1515
bin/preview-api-docs

develop-docs/backend/api/public.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ e.g. `/Users/yourname/code/sentry/tests/apidocs/openapi-derefed.json`.
378378

379379
In `sentry-docs`:
380380

381-
1. Run `OPENAPI_LOCAL_PATH=<COPIED_FULL_PATH> DISABLE_THUMBNAILS=1 yarn dev` and substitute
381+
1. Run `OPENAPI_LOCAL_PATH=<COPIED_FULL_PATH> DISABLE_THUMBNAILS=1 pnpm dev` and substitute
382382
`<COPIED_FULL_PATH>` with the path to your local openapi-derefed.json.
383383

384384
Unfortunately changes do not automatically reflect in your local server, so you will need to

develop-docs/development-infrastructure/environment/index.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,12 @@ First we will use [mkcert](https://github.com/FiloSottile/mkcert) to create and
6565
brew install mkcert
6666
brew install nss # if you use Firefox
6767
brew install caddy
68-
yarn mkcert-localhost
68+
pnpm mkcert-localhost
6969
```
7070

7171
Then we will run the reverse proxy as needed:
7272
```shell
73-
yarn https-proxy
73+
pnpm https-proxy
7474
```
7575

7676
After the server is running we can visit the dev server using `https` at port `:8003` instead of over `http` at `:8000`.

develop-docs/frontend/upgrade-policies.mdx

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,15 @@ If you let everything stagnate and upgrade nothing, simply because it all works,
2525

2626
This can become a massive amount of work, as the package is maybe many minor versions **or even multiple major versions** out of date. If it becomes difficult enough to upgrade, the engineer may choose to avoid upgrading altogether and implement a hack to work around the need. This of course is doubly bad, as when you do _absolutely need to upgrade_, not only is it difficult to upgrade a very outdated package, you now have to understand and reverse the hack.
2727

28-
By being proactive and keeping up with major and minor versions, we will typically need to only consider a small set of changes in the package. This is safer as it is less likely for usages of the package to break since there is simply less to validate. This also helps to keep up with the latest performance updates, bug fixes, security patches. And helps to ensure when a developer is looking for documentation on the usage of a package, they wont have to hunt for older versions of the documentation.
28+
By being proactive and keeping up with major and minor versions, we will typically need to only consider a small set of changes in the package. This is safer as it is less likely for usages of the package to break since there is simply less to validate. This also helps to keep up with the latest performance updates, bug fixes, security patches. And helps to ensure when a developer is looking for documentation on the usage of a package, they won't have to hunt for older versions of the documentation.
2929

3030
### Consider the benefits and risks
3131

3232
On the other hand, choosing to constantly keep packages updated to the absolute most recent versions can have numerous consequences.
3333

3434
- Upgrading can in some cases be a non-trivial effort for marginal gains. Validating even small upgrades takes time, often when really nothing has changed. (This is of course a slippery slope, wait too long and packages can become exponentially more work to upgrade)
3535

36-
- There is a cost to too much `package.json` churn such as developers having to constantly run `yarn install` on every git pull.
36+
- There is a cost to too much `package.json` churn such as developers having to constantly run `pnpm install` on every git pull.
3737

3838
- A security vulnerability may be introduced in a new version that was not previously present. If we had waited to upgrade until the patch we would not be vulnerable.
3939

@@ -52,25 +52,25 @@ You may not have to do this manually! See the below section on [Take advantage o
5252
### Seeing what can be upgraded
5353

5454
```bash
55-
yarn outdated --color | sort
55+
pnpm outdated --color | sort
5656
```
5757

5858
### Upgrading packages
5959

6060
```bash
61-
yarn upgrade --latest [package-name] [...]
61+
pnpm upgrade --latest [package-name] [...]
6262
```
6363

6464
<Alert>
6565

66-
Dont forget to upgrade the `@types/[package-name]` package as well if necessary.
66+
Don't forget to upgrade the `@types/[package-name]` package as well if necessary.
6767

6868
</Alert>
6969

7070
If you would like to upgrade a group of packages (for example `@babel`) you can use
7171

7272
```bash
73-
yarn upgrade --latest $(yarn outdated | cut -d' ' -f1 | grep [group-name])
73+
pnpm upgrade --latest $(pnpm outdated | cut -d' ' -f1 | grep [group-name])
7474
```
7575

7676
## Proper testing of upgrades
@@ -83,7 +83,7 @@ yarn upgrade --latest $(yarn outdated | cut -d' ' -f1 | grep [group-name])
8383

8484
### Classifying types of upgrades
8585

86-
Depending on what category of package youve upgraded there are a number of steps youll need to take to validate that the upgrade is safe and that nothing has broken. The first step is to consider what categories the package being upgraded falls into.
86+
Depending on what category of package you've upgraded there are a number of steps you'll need to take to validate that the upgrade is safe and that nothing has broken. The first step is to consider what categories the package being upgraded falls into.
8787

8888
The general category of frontend dependencies we have are
8989

@@ -119,67 +119,67 @@ For example, some dependencies such as `webpack` fall both into the app build **
119119

120120
1. **Read the CHANGELOG of the package**
121121

122-
This will give you context into what you need to look out for. If the package has explicit breaking changes its important to be aware of those so you can validate that our usages is not affected by those changes. If we are affected changes will have to be made to Sentrys usage of that dependency to make it compatible.
122+
This will give you context into what you need to look out for. If the package has explicit breaking changes it's important to be aware of those so you can validate that our usages is not affected by those changes. If we are affected changes will have to be made to Sentry's usage of that dependency to make it compatible.
123123

124124
2. **Is CI passing?**
125125

126-
This is a really good first indicator of if the change is safe. If CI is failing theres a good chance the application itself is actually broken. You will need to fix failing tests before you can merge a package upgrade.
126+
This is a really good first indicator of if the change is safe. If CI is failing there's a good chance the application itself is actually broken. You will need to fix failing tests before you can merge a package upgrade.
127127

128128
However, **DO NOT** rely on CI passing to guarantee that the package was successfully upgraded! Our test coverage is good, but it is not perfect.
129129

130-
When upgrading Testing dependencies, at this point may also want to check the test logs and make sure theres no unusual output, ensure the number of tests run has not changed, and even check that the performance of the test runs has not regressed.
130+
When upgrading Testing dependencies, at this point may also want to check the test logs and make sure there's no unusual output, ensure the number of tests run has not changed, and even check that the performance of the test runs has not regressed.
131131

132132
3. **Does the application work?**
133133

134-
This is where it begins to become important to understand the category of the dependency. Its very useful to use the **Vercel Frontend Previews** during this step to see how the application acts with the upgraded package in a production build.
134+
This is where it begins to become important to understand the category of the dependency. It's very useful to use the **Vercel Frontend Previews** during this step to see how the application acts with the upgraded package in a production build.
135135

136136
- For feature-specific dependencies, you can specifically check that the features using the package are correctly working as expected.
137137

138-
- For framework dependencies, youll want to spot-check as much as you can. You should take into consideration the changes in the new version of the package and validate that whatever was changed behaves as expected. Looking for odd usage of APIs can be helpful here (e.g., are we doing manual `ReactDOM` calls anywhere? etc)
138+
- For framework dependencies, you'll want to spot-check as much as you can. You should take into consideration the changes in the new version of the package and validate that whatever was changed behaves as expected. Looking for "odd" usage of APIs can be helpful here (e.g., are we doing manual `ReactDOM` calls anywhere? etc)
139139

140-
- For application build dependencies we should already be feeling pretty good at this step, considering the application built and passed CI. But its still worth checking the change log to make sure nothing in the build pipeline may have affected the application. However, problems with the application build here may be hard to spot as they will likely be subtle if CI did not catch them.
140+
- For application build dependencies we should already be feeling pretty good at this step, considering the application built and passed CI. But it's still worth checking the change log to make sure nothing in the build pipeline may have affected the application. However, problems with the application build here may be hard to spot as they will likely be subtle if CI did not catch them.
141141

142-
- For test and development dependencies, its highly likely the application should be working fine. The only scenario where the application could be broken is if the dependency DID have some effect on the application code (in which case it should not be categorized as a pure test or dev dependency).
142+
- For test and development dependencies, it's highly likely the application should be working fine. The only scenario where the application could be broken is if the dependency DID have some effect on the application code (in which case it should not be categorized as a pure test or dev dependency).
143143

144-
This may also be a good time to check if the **size-limit report bot** has left a comment indicating a change in bundle size. If the bundle has increased dramatically its worth investigating (likewise if its decreased in size dramatically)
144+
This may also be a good time to check if the **size-limit report bot** has left a comment indicating a change in bundle size. If the bundle has increased dramatically it's worth investigating (likewise if it's decreased in size dramatically)
145145

146146
4. **Does the development environment work**
147147

148-
If youve upgraded a build or development dependency, youll definitely want to make sure the development environment is still working as expected.
148+
If you've upgraded a build or development dependency, you'll definitely want to make sure the development environment is still working as expected.
149149

150150
- Does `sentry devserver` still correctly run the client-side application?
151151

152152
- Does `pnpm dev-ui` still run the client-only version of the application?
153153

154-
Depending on what package youre upgrading, youll what to consider what to test. For example, if you upgraded `fork-ts-checker-webpack-plugin` youll want to validate that types are still being checked in development.
154+
Depending on what package you're upgrading, you'll what to consider what to test. For example, if you upgraded `fork-ts-checker-webpack-plugin` you'll want to validate that types are still being checked in development.
155155

156156
5. **Upgrade the package in getsentry if applicable**
157157

158158
Developer tooling and build packages are currently duplicated in `getsentry`'s `package.json`. For those packages, it is important to remember that you will need to upgrade the package in both places.
159159

160-
6. **Read the `yarn.lock` diff**
160+
6. **Read the `pnpm-lock.yaml` diff**
161161

162-
Its good to understand exactly what has changed with the upgrade. Its generally a bad thing if upgrading has caused a discrepancy in shared sub dependency versions. For example, if you upgrade `lodash` but another top level package specifies that it needs and older version of `lodash` we will now have **two versions** of `lodash` installed. That means two separate versions of `lodash` will be shipped!
162+
It's good to understand exactly what has changed with the upgrade. It's generally a bad thing if upgrading has caused a discrepancy in shared sub dependency versions. For example, if you upgrade `lodash` but another top level package specifies that it needs and older version of `lodash` we will now have **two versions** of `lodash` installed. That means two separate versions of `lodash` will be shipped!
163163

164-
Generally you will want to make sure nothing has duplicated versions, in that case you may need to use `[yarn-deduplicate](https://www.npmjs.com/package/yarn-deduplicate)` or in the worst case you may need to upgrade the package which is pulling in the offending older versions.
164+
Generally you will want to make sure nothing has duplicated versions, in that case you may need to use `[pnpm-dedupe](https://www.npmjs.com/package/pnpm-dedupe)` or in the worst case you may need to upgrade the package which is pulling in the offending older versions.
165165

166-
See [The Ultimate Guide to yarn.lock Lockfiles](https://www.arahansen.com/the-ultimate-guide-to-yarn-lock-lockfiles/) for an in-depth look on how these work.
166+
See [The Ultimate Guide to pnpm lockfiles](https://pnpm.io/pnpm-lock.html) for an in-depth look on how these work.
167167

168168
7. **Validate in production after the upgrade is merged**
169169

170170
Finally, in some cases, it may be worth checking that the application is operating as expected in production. In some rare cases a package may behave differently in production (though this is very rare, as checking the frontend preview is very close to the same production bundle).
171171

172172
## Take advantage of tooling
173173

174-
We use [GitHubs Dependabot](https://docs.github.com/en/code-security/dependabot) to automatically open pull requests for package upgrades.
174+
We use [GitHub's Dependabot](https://docs.github.com/en/code-security/dependabot) to automatically open pull requests for package upgrades.
175175

176176
It has two primary modes of operation
177177

178178
- **Creating security vulnerability PRs**
179179

180180
These package version bumps are critical as they fix known CVE vulnerabilities reported in the [GitHub Advisory Database](https://github.com/advisories). These should be merged ASAP.
181181
[Learn more about Dependabot alerts on GitHub](https://docs.github.com/en/code-security/dependabot/dependabot-alerts/about-dependabot-alerts).
182-
Again, keeping dependencies up to date helps to ensure that when a vulnerability is discovered, were able to upgrade that package without having to upgrade across multiple minor or even major versions.
182+
Again, keeping dependencies up to date helps to ensure that when a vulnerability is discovered, we're able to upgrade that package without having to upgrade across multiple minor or even major versions.
183183

184184
- **Opening version upgrade PRs**
185185

@@ -207,7 +207,7 @@ To tackle a dependabot PR there are a few steps to take
207207
<summary>Why do I have to do this?</summary>
208208

209209
The `dependabot` user is considered an outside contributor so the same precautions must be taken with these PRs as would be with an outside contributor.
210-
Its important to note that this is an explicit action youre taking to indicate that the upgrade is **generally considered safe**. Since it is theoretically possible for a package to exfiltrate secrets from the `getsentry/getsentry` GitHub actions run by including malicious code in the new package. This situation however is highly unlikely and would need to be a coordinated supply chain attack by one of our already vetted dependencies.
210+
It's important to note that this is an explicit action you're taking to indicate that the upgrade is **generally considered safe**. Since it is theoretically possible for a package to exfiltrate secrets from the `getsentry/getsentry` GitHub actions run by including malicious code in the new package. This situation however is highly unlikely and would need to be a coordinated supply chain attack by one of our already vetted dependencies.
211211

212212
</details>
213213

develop-docs/services/chartcuterie.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ chart-rendering.enabled: true
108108
Currently you need to manually build the configuration module in your development environment.
109109
110110
```shell
111-
yarn build-chartcuterie-config
111+
pnpm build-chartcuterie-config
112112
```
113113

114114
You can then boot the Chartcuterie devservice. If the devservice doesn't start
@@ -141,7 +141,7 @@ Chartcuterie.
141141

142142
### Updating chart types locally
143143

144-
Currently you need to rebuild the configuration module using `yarn
144+
Currently you need to rebuild the configuration module using `pnpm
145145
build-chartcuterie-config` on every change. This may be improved in the future.
146146

147147
## How it works

0 commit comments

Comments
 (0)