Skip to content

Commit dec11c9

Browse files
committed
feat: This upgrades the Sentry CLI to v3
1 parent f78aa3f commit dec11c9

File tree

8 files changed

+80
-20
lines changed

8 files changed

+80
-20
lines changed

packages/react-router/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
"@opentelemetry/instrumentation": "^0.208.0",
5151
"@opentelemetry/semantic-conventions": "^1.37.0",
5252
"@sentry/browser": "10.30.0",
53-
"@sentry/cli": "^2.58.4",
53+
"@sentry/cli": "^3.0.0",
5454
"@sentry/core": "10.30.0",
5555
"@sentry/node": "10.30.0",
5656
"@sentry/react": "10.30.0",

packages/react-router/src/vite/buildEnd/handleOnBuildEnd.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { rm } from 'node:fs/promises';
22
import type { Config } from '@react-router/dev/config';
3-
import SentryCli from '@sentry/cli';
3+
import { SentryCli } from '@sentry/cli';
44
import type { SentryVitePluginOptions } from '@sentry/vite-plugin';
55
import { glob } from 'glob';
66
import type { SentryReactRouterBuildOptions } from '../types';
@@ -73,7 +73,7 @@ export const sentryOnBuildEnd: BuildEndHook = async ({ reactRouterConfig, viteCo
7373
// check if release should be created
7474
if (release?.name) {
7575
try {
76-
await cliInstance.releases.new(release.name);
76+
await cliInstance.releases.new(release.name, {});
7777
} catch (error) {
7878
// eslint-disable-next-line no-console
7979
console.error('[Sentry] Could not create release', error);
@@ -85,7 +85,7 @@ export const sentryOnBuildEnd: BuildEndHook = async ({ reactRouterConfig, viteCo
8585
try {
8686
await cliInstance.execute(
8787
['sourcemaps', 'inject', reactRouterConfig.buildDirectory],
88-
debug ? 'rejectOnError' : false,
88+
debug,
8989
);
9090
} catch (error) {
9191
// eslint-disable-next-line no-console
@@ -100,7 +100,6 @@ export const sentryOnBuildEnd: BuildEndHook = async ({ reactRouterConfig, viteCo
100100
paths: [reactRouterConfig.buildDirectory],
101101
},
102102
],
103-
live: 'rejectOnError',
104103
});
105104
} catch (error) {
106105
// eslint-disable-next-line no-console

packages/react-router/test/vite/buildEnd/handleOnBuildEnd.test.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import SentryCli from '@sentry/cli';
1+
import { SentryCli } from '@sentry/cli';
22
import * as fs from 'fs';
33
import { glob } from 'glob';
44
import type { ResolvedConfig } from 'vite';
@@ -84,7 +84,7 @@ describe('sentryOnBuildEnd', () => {
8484
// @ts-expect-error - mocking the React config
8585
await sentryOnBuildEnd(config);
8686

87-
expect(mockSentryCliInstance.releases.new).toHaveBeenCalledWith('v1.0.0');
87+
expect(mockSentryCliInstance.releases.new).toHaveBeenCalledWith('v1.0.0', {});
8888
});
8989

9090
it('should create a new Sentry release when release name is provided in unstable_sentryVitePluginOptions', async () => {
@@ -106,7 +106,7 @@ describe('sentryOnBuildEnd', () => {
106106
// @ts-expect-error - mocking the React config
107107
await sentryOnBuildEnd(config);
108108

109-
expect(mockSentryCliInstance.releases.new).toHaveBeenCalledWith('v1.0.0-unstable');
109+
expect(mockSentryCliInstance.releases.new).toHaveBeenCalledWith('v1.0.0-unstable', {});
110110
});
111111

112112
it('should prioritize release name from main config over unstable_sentryVitePluginOptions', async () => {
@@ -131,7 +131,7 @@ describe('sentryOnBuildEnd', () => {
131131
// @ts-expect-error - mocking the React config
132132
await sentryOnBuildEnd(config);
133133

134-
expect(mockSentryCliInstance.releases.new).toHaveBeenCalledWith('v1.0.0');
134+
expect(mockSentryCliInstance.releases.new).toHaveBeenCalledWith('v1.0.0', {});
135135
});
136136

137137
it('should upload source maps when enabled', async () => {
@@ -154,7 +154,6 @@ describe('sentryOnBuildEnd', () => {
154154
expect(mockSentryCliInstance.releases.uploadSourceMaps).toHaveBeenCalledTimes(1);
155155
expect(mockSentryCliInstance.releases.uploadSourceMaps).toHaveBeenCalledWith('undefined', {
156156
include: [{ paths: ['/build'] }],
157-
live: 'rejectOnError',
158157
});
159158
});
160159

@@ -298,8 +297,7 @@ describe('sentryOnBuildEnd', () => {
298297

299298
expect(consoleSpy).toHaveBeenCalledWith(expect.stringContaining('[Sentry] Automatically setting'));
300299
expect(consoleSpy).toHaveBeenCalledWith(expect.stringContaining('Deleting asset after upload:'));
301-
// rejectOnError is used in debug mode to pipe debug id injection output from the CLI to this process's stdout
302-
expect(mockSentryCliInstance.execute).toHaveBeenCalledWith(['sourcemaps', 'inject', '/build'], 'rejectOnError');
300+
expect(mockSentryCliInstance.execute).toHaveBeenCalledWith(['sourcemaps', 'inject', '/build'], true);
303301

304302
consoleSpy.mockRestore();
305303
});

packages/remix/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
"@opentelemetry/instrumentation": "^0.208.0",
6969
"@opentelemetry/semantic-conventions": "^1.37.0",
7070
"@remix-run/router": "1.x",
71-
"@sentry/cli": "^2.58.2",
71+
"@sentry/cli": "^3.0.0",
7272
"@sentry/core": "10.30.0",
7373
"@sentry/node": "10.30.0",
7474
"@sentry/react": "10.30.0",

packages/remix/scripts/createRelease.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* eslint-disable no-console */
2-
const SentryCli = require('@sentry/cli');
2+
const { SentryCli } = require('@sentry/cli');
33

44
const { deleteSourcemaps } = require('./deleteSourcemaps');
55

packages/remix/scripts/injectDebugId.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* eslint-disable no-console */
22
const { execSync } = require('child_process');
33

4-
const SentryCli = require('@sentry/cli');
4+
const { SentryCli } = require('@sentry/cli');
55

66
function injectDebugId(buildPath) {
77
const cliPath = SentryCli.getPath();

packages/remix/test/scripts/upload-sourcemaps.test.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,8 @@ async function mock(mockedUri: string, stub: any) {
2222
}
2323

2424
await vi.hoisted(async () =>
25-
mock(
26-
'@sentry/cli',
27-
vi.fn().mockImplementation(() => {
25+
mock('@sentry/cli', {
26+
SentryCli: vi.fn().mockImplementation(() => {
2827
return {
2928
execute: vi.fn(),
3029
releases: {
@@ -35,7 +34,7 @@ await vi.hoisted(async () =>
3534
},
3635
};
3736
}),
38-
),
37+
}),
3938
);
4039

4140
// eslint-disable-next-line @typescript-eslint/no-var-requires

yarn.lock

Lines changed: 65 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7093,42 +7093,82 @@
70937093
resolved "https://registry.yarnpkg.com/@sentry/cli-darwin/-/cli-darwin-2.58.4.tgz#5e3005c1f845acac243e8dcb23bef17337924768"
70947094
integrity sha512-kbTD+P4X8O+nsNwPxCywtj3q22ecyRHWff98rdcmtRrvwz8CKi/T4Jxn/fnn2i4VEchy08OWBuZAqaA5Kh2hRQ==
70957095

7096+
"@sentry/cli-darwin@3.0.0":
7097+
version "3.0.0"
7098+
resolved "https://registry.yarnpkg.com/@sentry/cli-darwin/-/cli-darwin-3.0.0.tgz#a87c084faed6a28f2eec3182e627538eb8ff4019"
7099+
integrity sha512-Tni8jovMpYdSpppzviBSeVwLmIRIb2msHtf+hVQhuSqOEf2ZjhUNeeitjYc0qzeqYyI5Gr3jVX7ZTWDpUXDbWA==
7100+
70967101
"@sentry/cli-linux-arm64@2.58.4":
70977102
version "2.58.4"
70987103
resolved "https://registry.yarnpkg.com/@sentry/cli-linux-arm64/-/cli-linux-arm64-2.58.4.tgz#69da57656fda863f255d92123c3a3437e470408e"
70997104
integrity sha512-0g0KwsOozkLtzN8/0+oMZoOuQ0o7W6O+hx+ydVU1bktaMGKEJLMAWxOQNjsh1TcBbNIXVOKM/I8l0ROhaAb8Ig==
71007105

7106+
"@sentry/cli-linux-arm64@3.0.0":
7107+
version "3.0.0"
7108+
resolved "https://registry.yarnpkg.com/@sentry/cli-linux-arm64/-/cli-linux-arm64-3.0.0.tgz#531e115e14dac7dc700a67309157c9f600f3059e"
7109+
integrity sha512-apfuZz5OgJbJ6YWszADoekt7PS+JOtE4EQgGaB951FZbBongSmGUbWscXuv3p2L4IbrewMoZLQvFQU0vMBN1ZA==
7110+
71017111
"@sentry/cli-linux-arm@2.58.4":
71027112
version "2.58.4"
71037113
resolved "https://registry.yarnpkg.com/@sentry/cli-linux-arm/-/cli-linux-arm-2.58.4.tgz#869ddab30f0dcebc0e61cff2f3ff47dcd40f8abe"
71047114
integrity sha512-rdQ8beTwnN48hv7iV7e7ZKucPec5NJkRdrrycMJMZlzGBPi56LqnclgsHySJ6Kfq506A2MNuQnKGaf/sBC9REA==
71057115

7116+
"@sentry/cli-linux-arm@3.0.0":
7117+
version "3.0.0"
7118+
resolved "https://registry.yarnpkg.com/@sentry/cli-linux-arm/-/cli-linux-arm-3.0.0.tgz#0d6cfc1ad8fc626336c0483e0d8e9e0648d89bc6"
7119+
integrity sha512-yRSj6rMiHqwneWky6Zlv7SyLRvZM8WtfJLVFA7NWpPTUIAkt6d9h4rxlQE1m47WHfkiV7sE9w2ggnhSyvRCeJw==
7120+
71067121
"@sentry/cli-linux-i686@2.58.4":
71077122
version "2.58.4"
71087123
resolved "https://registry.yarnpkg.com/@sentry/cli-linux-i686/-/cli-linux-i686-2.58.4.tgz#e30ca6b897147b3fb7b2e8684b139183d55e21c6"
71097124
integrity sha512-NseoIQAFtkziHyjZNPTu1Gm1opeQHt7Wm1LbLrGWVIRvUOzlslO9/8i6wETUZ6TjlQxBVRgd3Q0lRBG2A8rFYA==
71107125

7126+
"@sentry/cli-linux-i686@3.0.0":
7127+
version "3.0.0"
7128+
resolved "https://registry.yarnpkg.com/@sentry/cli-linux-i686/-/cli-linux-i686-3.0.0.tgz#633a1241853f6940d5e29bfe6a1a87ed527ff4e0"
7129+
integrity sha512-i3eOPXenym1b92s7hceQmKrJytJSpYKl6mbDRbFkpdPYy7yfyQJHVKMoAlZWMa3zdTvAOcfhCi6NObF41T/6Iw==
7130+
71117131
"@sentry/cli-linux-x64@2.58.4":
71127132
version "2.58.4"
71137133
resolved "https://registry.yarnpkg.com/@sentry/cli-linux-x64/-/cli-linux-x64-2.58.4.tgz#f667e1fcaf0860f15401af8e0ee72f5013d84458"
71147134
integrity sha512-d3Arz+OO/wJYTqCYlSN3Ktm+W8rynQ/IMtSZLK8nu0ryh5mJOh+9XlXY6oDXw4YlsM8qCRrNquR8iEI1Y/IH+Q==
71157135

7136+
"@sentry/cli-linux-x64@3.0.0":
7137+
version "3.0.0"
7138+
resolved "https://registry.yarnpkg.com/@sentry/cli-linux-x64/-/cli-linux-x64-3.0.0.tgz#ad156cf77bddb5164e5457f12f2a0ef03e1fdaa8"
7139+
integrity sha512-KswI4val260rNc6eHsRuU2MHFGLMkbOcsacUggRZWlyZYccMHiK+IfKBxZJLAA5ti8Zr/68Sbvgfd+FvwHKeXQ==
7140+
71167141
"@sentry/cli-win32-arm64@2.58.4":
71177142
version "2.58.4"
71187143
resolved "https://registry.yarnpkg.com/@sentry/cli-win32-arm64/-/cli-win32-arm64-2.58.4.tgz#f612c5788954e2a97b6626e9e46fa9a41cb049c1"
71197144
integrity sha512-bqYrF43+jXdDBh0f8HIJU3tbvlOFtGyRjHB8AoRuMQv9TEDUfENZyCelhdjA+KwDKYl48R1Yasb4EHNzsoO83w==
71207145

7146+
"@sentry/cli-win32-arm64@3.0.0":
7147+
version "3.0.0"
7148+
resolved "https://registry.yarnpkg.com/@sentry/cli-win32-arm64/-/cli-win32-arm64-3.0.0.tgz#82ccf03d04c7560daf6d6a089d02c2b27c74582e"
7149+
integrity sha512-DhqSwh6hJfUd2XVOEEaeI30FE0CgAJGIrDWy6gw2PV2akr5KPp/Wm9gkKsutFrhxQyFEnbSEiwG0hT4G7zKsbg==
7150+
71217151
"@sentry/cli-win32-i686@2.58.4":
71227152
version "2.58.4"
71237153
resolved "https://registry.yarnpkg.com/@sentry/cli-win32-i686/-/cli-win32-i686-2.58.4.tgz#5611c05499f1b959d23e37650d0621d299c49cfc"
71247154
integrity sha512-3triFD6jyvhVcXOmGyttf+deKZcC1tURdhnmDUIBkiDPJKGT/N5xa4qAtHJlAB/h8L9jgYih9bvJnvvFVM7yug==
71257155

7156+
"@sentry/cli-win32-i686@3.0.0":
7157+
version "3.0.0"
7158+
resolved "https://registry.yarnpkg.com/@sentry/cli-win32-i686/-/cli-win32-i686-3.0.0.tgz#5773df876bf294a249ed78f6179c62da0da1bd7b"
7159+
integrity sha512-yrcuP4+2eNA2tFU/J+HvMWf/zNeXEJZoB/L+ds2f7w8Zs0oubmCxufE2oeoQhwcNDLD4xJhjSKorYS/Sn51FXg==
7160+
71267161
"@sentry/cli-win32-x64@2.58.4":
71277162
version "2.58.4"
71287163
resolved "https://registry.yarnpkg.com/@sentry/cli-win32-x64/-/cli-win32-x64-2.58.4.tgz#3290c59399579e8d484c97246cfa720171241061"
71297164
integrity sha512-cSzN4PjM1RsCZ4pxMjI0VI7yNCkxiJ5jmWncyiwHXGiXrV1eXYdQ3n1LhUYLZ91CafyprR0OhDcE+RVZ26Qb5w==
71307165

7131-
"@sentry/cli@^2.57.0", "@sentry/cli@^2.58.2", "@sentry/cli@^2.58.4":
7166+
"@sentry/cli-win32-x64@3.0.0":
7167+
version "3.0.0"
7168+
resolved "https://registry.yarnpkg.com/@sentry/cli-win32-x64/-/cli-win32-x64-3.0.0.tgz#eb9ef00a1dea73dd96e2ea99a4f1233085eec6bf"
7169+
integrity sha512-wa0RDRCgEoggEQ5TGx1zYBOIoms9xb5RxbbLGN2TH3EBiIOKOZrHVQjczDgBHQrtlyxwN0vTLjM3690kJ+gq+Q==
7170+
7171+
"@sentry/cli@^2.57.0":
71327172
version "2.58.4"
71337173
resolved "https://registry.yarnpkg.com/@sentry/cli/-/cli-2.58.4.tgz#eb8792600cdf956cc4fe2bf51380ea1682327411"
71347174
integrity sha512-ArDrpuS8JtDYEvwGleVE+FgR+qHaOp77IgdGSacz6SZy6Lv90uX0Nu4UrHCQJz8/xwIcNxSqnN22lq0dH4IqTg==
@@ -7148,6 +7188,25 @@
71487188
"@sentry/cli-win32-i686" "2.58.4"
71497189
"@sentry/cli-win32-x64" "2.58.4"
71507190

7191+
"@sentry/cli@^3.0.0":
7192+
version "3.0.0"
7193+
resolved "https://registry.yarnpkg.com/@sentry/cli/-/cli-3.0.0.tgz#cfdf5996d6925f373d541601a487aaaf36a6fae5"
7194+
integrity sha512-w/wH9tPlZY98mP+a0gYhTvuyRXnPrZa0hYaJnuaBNf9s2x+u7iz8tgtF4fW9X8DNeFylHxqZzSMK/gDLo5IAsA==
7195+
dependencies:
7196+
progress "^2.0.3"
7197+
proxy-from-env "^1.1.0"
7198+
undici "^6.22.0"
7199+
which "^2.0.2"
7200+
optionalDependencies:
7201+
"@sentry/cli-darwin" "3.0.0"
7202+
"@sentry/cli-linux-arm" "3.0.0"
7203+
"@sentry/cli-linux-arm64" "3.0.0"
7204+
"@sentry/cli-linux-i686" "3.0.0"
7205+
"@sentry/cli-linux-x64" "3.0.0"
7206+
"@sentry/cli-win32-arm64" "3.0.0"
7207+
"@sentry/cli-win32-i686" "3.0.0"
7208+
"@sentry/cli-win32-x64" "3.0.0"
7209+
71517210
"@sentry/rollup-plugin@^4.6.1":
71527211
version "4.6.1"
71537212
resolved "https://registry.yarnpkg.com/@sentry/rollup-plugin/-/rollup-plugin-4.6.1.tgz#28dece8d6fad3044fd634724f6334f6b9b8f3ded"
@@ -30204,6 +30263,11 @@ undici@^6.11.1, undici@^6.19.2:
3020430263
resolved "https://registry.yarnpkg.com/undici/-/undici-6.21.3.tgz#185752ad92c3d0efe7a7d1f6854a50f83b552d7a"
3020530264
integrity sha512-gBLkYIlEnSp8pFbT64yFgGE6UIB9tAkhukC23PmMDCe5Nd+cRqKxSjw5y54MK2AZMgZfJWMaNE4nYUHgi1XEOw==
3020630265

30266+
undici@^6.22.0:
30267+
version "6.22.0"
30268+
resolved "https://registry.yarnpkg.com/undici/-/undici-6.22.0.tgz#281adbc157af41da8e75393c9d75a1b788811bc3"
30269+
integrity sha512-hU/10obOIu62MGYjdskASR3CUAiYaFTtC9Pa6vHyf//mAipSvSQg6od2CnJswq7fvzNS3zJhxoRkgNVaHurWKw==
30270+
3020730271
unenv@2.0.0-rc.17:
3020830272
version "2.0.0-rc.17"
3020930273
resolved "https://registry.yarnpkg.com/unenv/-/unenv-2.0.0-rc.17.tgz#fa9b80d30e16f73e2d4a0be568ca97c0fb76bdac"

0 commit comments

Comments
 (0)