@sentry/cli 2.47.1 → 2.49.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/checksums.txt CHANGED
@@ -1,10 +1,10 @@
1
- sentry-cli-Darwin-arm64=8fe16710e3b6a377541f9697d430810b46fda5caef15c07086184427051d78c5
2
- sentry-cli-Darwin-universal=08d43e66fabade2d3b385c74f78e3be50f96846c5f8702400d7b81b3c672e4b2
3
- sentry-cli-Darwin-x86_64=02319109c31868c04e31ae3d701715dc76d57cb90569bc08ecc4ab830facbff5
4
- sentry-cli-Linux-aarch64=6ce920ff84c68d2c7b7cfd093adc35cf731adcdc5ccb2dc962505b44f31a3429
5
- sentry-cli-Linux-armv7=bc97edf7f5b776ca4f034a6d35b18934eb5fef3b4a030933bbdb3d6d38e10c4c
6
- sentry-cli-Linux-i686=a627aa2d4a985ff8d6ec4f01b27bdd411893b673c86d6446c23fbba18db80b7f
7
- sentry-cli-Linux-x86_64=6613872f1b21240fb5732be62620ef2bb40a436ce93955ca96393e6046947951
8
- sentry-cli-Windows-aarch64.exe=0bfcf84f8ce9aaa0ebfa4d87f1cec47b09193e307bdeb5f5555d81fc6e34bb0c
9
- sentry-cli-Windows-i686.exe=410f622253c1faa5e6991ad76790db4068db4e2ffd5e20cad1aa15343776c00e
10
- sentry-cli-Windows-x86_64.exe=23f5a4d98931729af8cc46eab49ad5defc5d2567c6ce9306673200e87b0d2ddc
1
+ sentry-cli-Darwin-arm64=a259aae5190a4b74a9f10be0e4945977da15d5af4628f9c79a5a8e63f3089aa3
2
+ sentry-cli-Darwin-universal=1206cd2890cc085b062497f406c361fc04b8c109a93f34cb0abfbb1884d702e3
3
+ sentry-cli-Darwin-x86_64=2a1993992bc4aaee528192fca3a91f6b638940844df57cd326580cbec7f01f63
4
+ sentry-cli-Linux-aarch64=7af5d3cd3e5bfc60af6446c0e51a48e26aae44565d37da9b558db7536a2dc1ca
5
+ sentry-cli-Linux-armv7=37a5cee041d6033f5692d7c0b0c4faa64b4e518775fbc0519d5a730a97f13a59
6
+ sentry-cli-Linux-i686=4279f33dc30f0c85dda9284eb77f5226d9a9095e17f5dc9e210b1d0af371a1bd
7
+ sentry-cli-Linux-x86_64=be4a9b22e8ac782728b2bf62a3bc61b2dcf20dae9c68acfc94ebaa8019ed5d78
8
+ sentry-cli-Windows-aarch64.exe=8ba2cb06c2c303b2a4823653a90c2455f01bda432254ee3c820137af5b549beb
9
+ sentry-cli-Windows-i686.exe=29d2203ea976821a8b975e8be68534600674aeb035262a1d209e33707eead10a
10
+ sentry-cli-Windows-x86_64.exe=6bf6eb9e8dcf8ad882515716deed554d9ec1a375ace6113a2d1c4dc7bee23d87
package/js/helper.js CHANGED
@@ -186,6 +186,7 @@ function mockBinaryPath(mockPath) {
186
186
  * @typedef {object} OptionSchema
187
187
  * @prop {string} param The flag of the command line option including dashes.
188
188
  * @prop {OptionType} type The value type of the command line option.
189
+ * @prop {string} [invertedParam] The flag of the command line option including dashes (optional).
189
190
  */
190
191
 
191
192
  /**
@@ -245,7 +246,7 @@ function serializeOptions(schema, options) {
245
246
  /**
246
247
  * Serializes the command and its options into an arguments array.
247
248
  *
248
- * @param {string} command The literal name of the command.
249
+ * @param {string[]} command The literal name of the command.
249
250
  * @param {OptionsSchema} [schema] An options schema required by the command.
250
251
  * @param {object} [options] An options object according to the schema.
251
252
  * @returns {string[]} An arguments array that can be passed via command line.
@@ -280,7 +281,11 @@ function getPath() {
280
281
  * expect(output.trim()).toBe('sentry-cli x.y.z');
281
282
  *
282
283
  * @param {string[]} args Command line arguments passed to `sentry-cli`.
283
- * @param {boolean} live We inherit stdio to display `sentry-cli` output directly.
284
+ * @param {boolean | 'rejectOnError'} live can be set to:
285
+ * - `true` to inherit stdio to display `sentry-cli` output directly.
286
+ * - `false` to not inherit stdio and return the output as a string.
287
+ * - `'rejectOnError'` to inherit stdio and reject the promise if the command
288
+ * exits with a non-zero exit code.
284
289
  * @param {boolean} silent Disable stdout for silents build (CI/Webpack Stats, ...)
285
290
  * @param {string} [configFile] Relative or absolute path to the configuration file.
286
291
  * @param {Object} [config] More configuration to pass to the CLI
@@ -321,15 +326,27 @@ async function execute(args, live, silent, configFile, config = {}) {
321
326
  ]);
322
327
  args = [...headers, ...args];
323
328
  }
329
+
324
330
  return new Promise((resolve, reject) => {
325
- if (live === true) {
331
+ if (live === true || live === 'rejectOnError') {
326
332
  const output = silent ? 'ignore' : 'inherit';
327
333
  const pid = childProcess.spawn(getPath(), args, {
328
334
  env,
329
335
  // stdin, stdout, stderr
330
336
  stdio: ['ignore', output, output],
331
337
  });
332
- pid.on('exit', () => {
338
+ pid.on('exit', (exitCode) => {
339
+ if (live === 'rejectOnError') {
340
+ if (exitCode === 0) {
341
+ resolve('success (live mode)');
342
+ }
343
+ reject(new Error(`Command ${args.join(' ')} failed with exit code ${exitCode}`));
344
+ }
345
+ // According to the type definition, resolving with void is not allowed.
346
+ // However, for backwards compatibility, we resolve void here to
347
+ // avoid a behaviour-breaking change.
348
+ // TODO (v3): Clean this up and always resolve a string (or change the type definition)
349
+ // @ts-expect-error - see comment above
333
350
  resolve();
334
351
  });
335
352
  } else {
package/js/index.d.ts CHANGED
@@ -208,7 +208,10 @@ declare module '@sentry/cli' {
208
208
 
209
209
  proposeVersion(): Promise<string>;
210
210
 
211
- uploadSourceMaps(release: string, options: SentryCliUploadSourceMapsOptions): Promise<string>;
211
+ uploadSourceMaps(
212
+ release: string,
213
+ options: SentryCliUploadSourceMapsOptions & { live?: boolean | 'rejectOnError' }
214
+ ): Promise<string>;
212
215
 
213
216
  listDeploys(release: string): Promise<string>;
214
217
 
@@ -10,13 +10,13 @@ const DEFAULT_IGNORE = ['node_modules'];
10
10
 
11
11
  /**
12
12
  * Schema for the `upload-sourcemaps` command.
13
- * @type {OptionsSchema}
13
+ * @type {import('../helper').OptionsSchema}
14
14
  */
15
15
  const SOURCEMAPS_SCHEMA = require('./options/uploadSourcemaps');
16
16
 
17
17
  /**
18
18
  * Schema for the `deploys new` command.
19
- * @type {OptionsSchema}
19
+ * @type {import('../helper').OptionsSchema}
20
20
  */
21
21
  const DEPLOYS_SCHEMA = require('./options/deploys');
22
22
 
@@ -95,7 +95,7 @@ class Releases {
95
95
  commitFlags.push('--ignore-missing');
96
96
  }
97
97
 
98
- return this.execute(['releases', 'set-commits', release].concat(commitFlags));
98
+ return this.execute(['releases', 'set-commits', release].concat(commitFlags), false);
99
99
  }
100
100
 
101
101
  /**
@@ -149,6 +149,7 @@ class Releases {
149
149
  * ext: ['js', 'map', 'jsbundle', 'bundle'], // override file extensions to scan for
150
150
  * projects: ['node'], // provide a list of projects
151
151
  * decompress: false // decompress gzip files before uploading
152
+ * live: true // whether to inherit stdio to display `sentry-cli` output directly.
152
153
  * });
153
154
  *
154
155
  * @param {string} release Unique name of the release.
@@ -199,7 +200,10 @@ class Releases {
199
200
 
200
201
  return uploadPaths.map((path) =>
201
202
  // `execute()` is async and thus we're returning a promise here
202
- this.execute(helper.prepareCommand([...args, path], SOURCEMAPS_SCHEMA, newOptions), true)
203
+ this.execute(
204
+ helper.prepareCommand([...args, path], SOURCEMAPS_SCHEMA, newOptions),
205
+ options.live != null ? options.live : true
206
+ )
203
207
  );
204
208
  });
205
209
 
@@ -255,7 +259,11 @@ class Releases {
255
259
  /**
256
260
  * See {helper.execute} docs.
257
261
  * @param {string[]} args Command line arguments passed to `sentry-cli`.
258
- * @param {boolean} live We inherit stdio to display `sentry-cli` output directly.
262
+ * @param {boolean | 'rejectOnError'} live can be set to:
263
+ * - `true` to inherit stdio to display `sentry-cli` output directly.
264
+ * - `false` to not inherit stdio and return the output as a string.
265
+ * - `'rejectOnError'` to inherit stdio and reject the promise if the command
266
+ * exits with a non-zero exit code.
259
267
  * @returns {Promise.<string>} A promise that resolves to the standard output.
260
268
  */
261
269
  async execute(args, live) {
@@ -1,3 +1,6 @@
1
+ /**
2
+ * @type {import('../../helper').OptionsSchema}
3
+ */
1
4
  module.exports = {
2
5
  env: {
3
6
  param: '--env',
@@ -1,3 +1,6 @@
1
+ /**
2
+ * @type {import('../../helper').OptionsSchema}
3
+ */
1
4
  module.exports = {
2
5
  ignore: {
3
6
  param: '--ignore',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/cli",
3
- "version": "2.47.1",
3
+ "version": "2.49.0",
4
4
  "description": "A command line utility to work with Sentry. https://docs.sentry.io/hosted/learn/cli/",
5
5
  "repository": "git://github.com/getsentry/sentry-cli.git",
6
6
  "homepage": "https://docs.sentry.io/hosted/learn/cli/",
@@ -22,22 +22,24 @@
22
22
  "which": "^2.0.2"
23
23
  },
24
24
  "devDependencies": {
25
+ "@types/node": "^20.10.0",
25
26
  "@vercel/nft": "^0.22.1",
26
27
  "eslint": "^7.32.0",
27
28
  "eslint-config-prettier": "^8.5.0",
28
29
  "jest": "^27.5.1",
29
30
  "npm-run-all": "^4.1.5",
30
- "prettier": "2.8.8"
31
+ "prettier": "2.8.8",
32
+ "typescript": "~5.8.3"
31
33
  },
32
34
  "optionalDependencies": {
33
- "@sentry/cli-darwin": "2.47.1",
34
- "@sentry/cli-linux-arm": "2.47.1",
35
- "@sentry/cli-linux-arm64": "2.47.1",
36
- "@sentry/cli-linux-i686": "2.47.1",
37
- "@sentry/cli-linux-x64": "2.47.1",
38
- "@sentry/cli-win32-i686": "2.47.1",
39
- "@sentry/cli-win32-x64": "2.47.1",
40
- "@sentry/cli-win32-arm64": "2.47.1"
35
+ "@sentry/cli-darwin": "2.49.0",
36
+ "@sentry/cli-linux-arm": "2.49.0",
37
+ "@sentry/cli-linux-arm64": "2.49.0",
38
+ "@sentry/cli-linux-i686": "2.49.0",
39
+ "@sentry/cli-linux-x64": "2.49.0",
40
+ "@sentry/cli-win32-i686": "2.49.0",
41
+ "@sentry/cli-win32-x64": "2.49.0",
42
+ "@sentry/cli-win32-arm64": "2.49.0"
41
43
  },
42
44
  "scripts": {
43
45
  "postinstall": "node ./scripts/install.js",
@@ -49,6 +51,7 @@
49
51
  "test:watch": "jest --watch --notify",
50
52
  "test:eslint": "eslint bin/* scripts/**/*.js js/**/*.js",
51
53
  "test:prettier": "prettier --check bin/* scripts/**/*.js js/**/*.js",
54
+ "check:types": "tsc --noEmit",
52
55
  "test:vercel-nft": "node scripts/test-vercel-nft.js"
53
56
  },
54
57
  "jest": {