@sentry/cli 2.58.3 → 3.0.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/README.md CHANGED
@@ -8,127 +8,36 @@
8
8
  </a>
9
9
  </p>
10
10
 
11
- # Official Sentry Command Line Interface
11
+ # Sentry CLI
12
12
 
13
- [![Build Status](https://github.com/getsentry/sentry-cli/workflows/CI/badge.svg?branch=master)](https://github.com/getsentry/sentry-cli/actions?query=workflow%3ACI)
14
- [![GitHub release](https://img.shields.io/github/release/getsentry/sentry-cli.svg)](https://github.com/getsentry/sentry-cli/releases/latest)
15
- [![npm version](https://img.shields.io/npm/v/@sentry/cli.svg)](https://www.npmjs.com/package/@sentry/cli)
16
- [![license](https://img.shields.io/github/license/getsentry/sentry-cli.svg)](https://github.com/getsentry/sentry-cli/blob/master/LICENSE)
13
+ This is the repository for Sentry CLI, the official command line interface for Sentry.
17
14
 
18
- This is a Sentry command line client for some generic tasks. Right now this is
19
- primarily used to upload debug symbols to Sentry if you are not using the
20
- Fastlane tools.
15
+ Sentry CLI can be used for many tasks, including uploading debug symbols and source maps to Sentry, managing releases, and viewing Sentry data such as issues and logs.
21
16
 
22
- * Downloads can be found under
23
- [Releases](https://github.com/getsentry/sentry-cli/releases/)
24
- * Documentation can be found [here](https://docs.sentry.io/hosted/learn/cli/)
17
+ ## Installation and Usage
25
18
 
26
- ## Installation
19
+ Please refer to [Sentry CLI's documentation page](https://docs.sentry.io/cli/).
27
20
 
28
- If you are on macOS or Linux, you can use the automated downloader which will fetch the latest release version for you and install it:
21
+ ## Compatibility
29
22
 
30
- curl -sL https://sentry.io/get-cli/ | bash
23
+ Sentry CLI officially supports [Sentry SaaS](https://sentry.io/) and [Sentry Self-Hosted](https://github.com/getsentry/self-hosted) versions 25.11.1 and above.
31
24
 
32
- We do, however, encourage you to pin the specific version of the CLI, so your builds are always reproducible.
33
- To do that, you can use the exact same method, with an additional version specifier:
25
+ ### Self-Hosted Sentry
34
26
 
35
- curl -sL https://sentry.io/get-cli/ | SENTRY_CLI_VERSION=2.33.1 bash
27
+ Although some Sentry CLI features may work with versions of Sentry Self-Hosted prior to 25.11.1, we recommend users upgrade their self-hosted installations to a compatible version.
36
28
 
37
- This will automatically download the correct version of `sentry-cli` for your operating system and install it. If necessary, it will prompt for your admin password for `sudo`. For a different installation location or for systems without `sudo` (like Windows), you can `export INSTALL_DIR=/custom/installation/path` before running this command.
29
+ For users who cannot upgrade their self-hosted installation, we recommend using the latest compatible Sentry CLI version, per the table below:
38
30
 
39
- If you are using `sentry-cli` on Windows environments, [Microsoft Visual C++ Redistributable](https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist) is required.
31
+ | **Sentry Self-Hosted Version** | **Newest Compatible Sentry CLI Version** |
32
+ | ------------------------------ | --------------------------------------------------------------------- |
33
+ | ≥ 25.11.1 | [latest](https://github.com/getsentry/sentry-cli/releases/latest) |
34
+ | < 25.11.1 | [2.58.4](https://github.com/getsentry/sentry-cli/releases/tag/2.58.4) |
40
35
 
41
- To verify it’s installed correctly you can bring up the help:
36
+ Note that we can only provide support for officially-supported Sentry Self-Hosted versions. We will not backport fixes for older Sentry CLI versions, even if they should be compatible with your self-hosted version.
42
37
 
43
- sentry-cli --help
38
+ ## Versioning
44
39
 
45
- ### pip
46
-
47
- _New in 2.14.3_: `sentry-cli` can also be installed using `pip`:
48
-
49
- ```bash
50
- pip install sentry-cli
51
- ```
52
-
53
- ### Node
54
-
55
- Additionally, you can also install this binary via npm:
56
-
57
- npm install @sentry/cli
58
-
59
- When installing globally, make sure to have set
60
- [correct permissions on the global node_modules directory](https://docs.npmjs.com/getting-started/fixing-npm-permissions).
61
- If this is not possible in your environment or still produces an EACCESS error,
62
- install as root:
63
-
64
- sudo npm install -g @sentry/cli --unsafe-perm
65
-
66
- By default, this package will download sentry-cli from the CDN managed by [Fastly](https://www.fastly.com/).
67
- To use a custom CDN, set the npm config property `sentrycli_cdnurl`. The downloader will append
68
- `"/<version>/sentry-cli-<dist>"`.
69
-
70
- ```sh
71
- npm install @sentry/cli --sentrycli_cdnurl=https://mymirror.local/path
72
- ```
73
-
74
- Or add property into your `.npmrc` file (https://www.npmjs.org/doc/files/npmrc.html)
75
-
76
- ```rc
77
- sentrycli_cdnurl=https://mymirror.local/path
78
- ```
79
-
80
- There are a few environment variables that you can provide to control the npm installation:
81
-
82
- ```
83
- SENTRYCLI_CDNURL=<url> # Use alternative cdn url for downloading binary
84
- SENTRYCLI_USE_LOCAL=1 # Use local instance of sentry-cli binary (looked up via $PATH environment)
85
- SENTRYCLI_SKIP_DOWNLOAD=1 # Skip downloading binary entirely
86
- SENTRYCLI_NO_PROGRESS_BAR=1 # Do not print the progress bar when downloading binary (default for non-TTY environments like CI)
87
- SENTRYCLI_LOG_STREAM=<stdout|stderr> # Changes where to redirect install script output
88
- ```
89
-
90
- When using `sentry-cli` via JavaScript API or any 3rd party plugin that is consuming said API,
91
- you can also use `SENTRY_BINARY_PATH=<path>` alongside `SENTRYCLI_SKIP_DOWNLOAD=1` to completely
92
- control what binaries are downloaded and used throughout the whole process.
93
-
94
- If you're installing the CLI with NPM from behind a proxy, the install script will
95
- use either NPM's configured HTTPS proxy server or the value from your `HTTPS_PROXY`
96
- environment variable.
97
-
98
- ### Homebrew
99
-
100
- A homebrew recipe is provided in the `getsentry/tools` tap:
101
-
102
- brew install getsentry/tools/sentry-cli
103
-
104
- ### Docker
105
-
106
- As of version _1.25.0_, there is an official Docker image that comes with
107
- `sentry-cli` preinstalled. If you prefer a specific version, specify it as tag.
108
- The latest development version is published under the `edge` tag. In production,
109
- we recommend you to use the `latest` tag. To use it, run:
110
-
111
- ```sh
112
- docker pull getsentry/sentry-cli
113
- docker run --rm -v $(pwd):/work getsentry/sentry-cli --help
114
- ```
115
-
116
- Starting version _`2.8.0`_, in case you see `"error: config value 'safe.directory' was not found;"` message,
117
- you also need to correctly set UID and GID of mounted volumes like so:
118
-
119
- ```sh
120
- docker run --rm -u "$(id -u):$(id -g)" -v $(pwd):/work getsentry/sentry-cli --help
121
- ```
122
-
123
- This is required due to security issue in older `git` implementations. See [here](https://github.blog/2022-04-12-git-security-vulnerability-announced/) for more details.
124
-
125
- ## Update
126
-
127
- To update sentry-cli to the latest version run:
128
-
129
- ```sh
130
- sentry-cli update
131
- ```
40
+ Sentry CLI follows semantic versioning, according to [this versioning policy](VERSIONING.md).
132
41
 
133
42
  ## Compiling
134
43
 
package/bin/sentry-cli CHANGED
@@ -3,7 +3,7 @@
3
3
  'use strict';
4
4
 
5
5
  const childProcess = require('child_process');
6
- const SentryCli = require('../js');
6
+ const { SentryCli } = require('../js');
7
7
 
8
8
  const child = childProcess
9
9
  .spawn(SentryCli.getPath(), process.argv.slice(2), {
package/checksums.txt CHANGED
@@ -1,7 +1,10 @@
1
- sentry-cli-Linux-aarch64=30f95cf10ff96bdbbfdc1a25a7b65ee0a7f906f2c380c0cdde185d14d5535246
2
- sentry-cli-Linux-armv7=ae2c0ecee950055b388817bdb6dd543730c36d6def8794252c00314c3f0a7e18
3
- sentry-cli-Linux-i686=4a36158a3140a26e1e8fbbb72f80a836df3f49ebcb5787e05b360e0f9ee01b3c
4
- sentry-cli-Linux-x86_64=645e64af49e68a285b66d7ddf440d06b76f8a5603797060f61c0c487ac7e2a89
5
- sentry-cli-Windows-aarch64.exe=ae190527ff55ed70c028d033408f446fa99c87b9fabe0ea7b1a336851940b77a
6
- sentry-cli-Windows-i686.exe=024a72a8ff6e076cd500c17086a7a146dfb59e9469936eb16b8a1ba31cf7394a
7
- sentry-cli-Windows-x86_64.exe=e26c363d45c572c6ae133a913657f995d171f7179aa221371da81966b0d5d2ef
1
+ sentry-cli-Darwin-arm64=3ef5233083cf2c6f37b3850bf6f970ef1770fb55d4911a1c36e53d0a540956f5
2
+ sentry-cli-Darwin-universal=b2eb3f411eef8082037fd3cd1e561178a9f084028820d74619195e10cfc5e4e8
3
+ sentry-cli-Darwin-x86_64=627ee375b823459d31c1b3f84fed5a700d299cb34c699608379e57a43e8a7a3c
4
+ sentry-cli-Linux-aarch64=815686a698e60e41a34035a00a0f11194db266e4b92259b979254a51eaf7bc12
5
+ sentry-cli-Linux-armv7=b9c2de7bb303e304a046876cf82f7cc1f2c2a68353cdcae4ffa38b80004e5607
6
+ sentry-cli-Linux-i686=74f9c694a165fe3884dcafd04a7f0e686c93cd0d999ec55d58ce363bd97abe93
7
+ sentry-cli-Linux-x86_64=460d2053f273fdbd26d88ccb35965448447c4b3715ddc8c6b476a3d243e54430
8
+ sentry-cli-Windows-aarch64.exe=cbacd717d2980ca0bb5edecff369f168ecc8bd934f4cd9dd628a9973f6b92555
9
+ sentry-cli-Windows-i686.exe=e3dde3c0b24a3b2ab37f75846b7e89e8698c53db08bbdc73f7b37860e285afca
10
+ sentry-cli-Windows-x86_64.exe=4acb63ef42e59f9e1aee920e0b399d1781a91f8f25b666b75313a4444ca6a3dc
package/js/helper.d.ts CHANGED
@@ -1,30 +1,60 @@
1
+ import { SentryCliOptions } from './types';
1
2
  /**
2
- * The javascript type of a command line option.
3
+ * This convoluted function resolves the path to the manually downloaded fallback
4
+ * `sentry-cli` binary in a way that can't be analysed by @vercel/nft.
5
+ *
6
+ * Without this, the binary can be detected as an asset and included by bundlers
7
+ * that use @vercel/nft.
8
+ *
9
+ * @returns The path to the sentry-cli binary
10
+ */
11
+ declare function getFallbackBinaryPath(): string;
12
+ declare function getDistributionForThisPlatform(): {
13
+ packageName: any;
14
+ subpath: any;
15
+ };
16
+ /**
17
+ * Throws an error with a message stating that Sentry CLI doesn't support the current platform.
18
+ *
19
+ * @returns nothing. It throws.
3
20
  */
4
- export type OptionType = "array" | "string" | "boolean" | "inverted-boolean";
21
+ declare function throwUnsupportedPlatformError(): void;
5
22
  /**
6
- * Schema definition of a command line option.
23
+ * Overrides the default binary path with a mock value, useful for testing.
24
+ *
25
+ * @param mockPath The new path to the mock sentry-cli binary
26
+ * @deprecated This was used in tests internally and will be removed in the next major version.
7
27
  */
8
- export type OptionSchema = {
9
- /**
10
- * The flag of the command line option including dashes.
11
- */
28
+ declare function mockBinaryPath(mockPath: string): void;
29
+ export type OptionsSchema = Record<string, {
12
30
  param: string;
13
- /**
14
- * The value type of the command line option.
15
- */
16
- type: OptionType;
17
- /**
18
- * The flag of the command line option including dashes (optional).
19
- */
31
+ type: 'array' | 'string' | 'number' | 'boolean' | 'inverted-boolean';
20
32
  invertedParam?: string;
21
- };
33
+ } | {
34
+ param?: never;
35
+ type: 'array' | 'string' | 'number' | 'boolean' | 'inverted-boolean';
36
+ invertedParam: string;
37
+ }>;
22
38
  /**
23
- * Schema definition for a command.
39
+ * Serializes command line options into an arguments array.
40
+ *
41
+ * @param schema An options schema required by the command.
42
+ * @param options An options object according to the schema.
24
43
  */
25
- export type OptionsSchema = {
26
- [x: string]: OptionSchema;
27
- };
44
+ declare function serializeOptions(schema: OptionsSchema, options: Record<string, unknown>): string[];
45
+ /**
46
+ * Serializes the command and its options into an arguments array.
47
+ *
48
+ * @param command The literal name of the command.
49
+ * @param schema An options schema required by the command.
50
+ * @param options An options object according to the schema.
51
+ * @returns An arguments array that can be passed via command line.
52
+ */
53
+ declare function prepareCommand(command: string[], schema: OptionsSchema, options: Record<string, unknown>): string[];
54
+ /**
55
+ * Returns the absolute path to the `sentry-cli` binary.
56
+ */
57
+ declare function getPath(): string;
28
58
  /**
29
59
  * Runs `sentry-cli` with the given command line arguments.
30
60
  *
@@ -42,82 +72,18 @@ export type OptionsSchema = {
42
72
  * const output = await execute(['--version']);
43
73
  * expect(output.trim()).toBe('sentry-cli x.y.z');
44
74
  *
45
- * @param {string[]} args Command line arguments passed to `sentry-cli`.
46
- * @param {boolean | 'rejectOnError'} live can be set to:
47
- * - `true` to inherit stdio to display `sentry-cli` output directly.
48
- * - `false` to not inherit stdio and return the output as a string.
49
- * - `'rejectOnError'` to inherit stdio and reject the promise if the command
75
+ * @param args Command line arguments passed to `sentry-cli`.
76
+ * @param live can be set to:
77
+ * - `true` to inherit stdio and reject the promise if the command
50
78
  * exits with a non-zero exit code.
51
- * @param {boolean} silent Disable stdout for silents build (CI/Webpack Stats, ...)
52
- * @param {string} [configFile] Relative or absolute path to the configuration file.
53
- * @param {import('./index').SentryCliOptions} [config] More configuration to pass to the CLI
54
- * @returns {Promise<string>} A promise that resolves to the standard output.
55
- */
56
- export function execute(args: string[], live: boolean | "rejectOnError", silent: boolean, configFile?: string, config?: import("./index").SentryCliOptions): Promise<string>;
57
- /**
58
- * Returns the absolute path to the `sentry-cli` binary.
59
- * @returns {string}
79
+ * - `false` to not inherit stdio and return the output as a string.
80
+ * @param silent Disable stdout for silents build (CI/Webpack Stats, ...)
81
+ * @param configFile Relative or absolute path to the configuration file.
82
+ * @param config More configuration to pass to the CLI
83
+ * @returns A promise that resolves to the standard output.
60
84
  */
61
- export function getPath(): string;
62
- export function getProjectFlagsFromOptions({ projects }?: {
85
+ declare function execute(args: string[], live: boolean, silent: boolean, configFile: string | undefined, config?: SentryCliOptions): Promise<string>;
86
+ declare function getProjectFlagsFromOptions({ projects }?: {
63
87
  projects?: any[];
64
88
  }): any;
65
- /**
66
- * Overrides the default binary path with a mock value, useful for testing.
67
- *
68
- * @param {string} mockPath The new path to the mock sentry-cli binary
69
- * @deprecated This was used in tests internally and will be removed in the next major version.
70
- */
71
- export function mockBinaryPath(mockPath: string): void;
72
- /**
73
- * Serializes the command and its options into an arguments array.
74
- *
75
- * @param {string[]} command The literal name of the command.
76
- * @param {OptionsSchema} [schema] An options schema required by the command.
77
- * @param {object} [options] An options object according to the schema.
78
- * @returns {string[]} An arguments array that can be passed via command line.
79
- */
80
- export function prepareCommand(command: string[], schema?: OptionsSchema, options?: object): string[];
81
- /**
82
- * The javascript type of a command line option.
83
- * @typedef {'array'|'string'|'boolean'|'inverted-boolean'} OptionType
84
- */
85
- /**
86
- * Schema definition of a command line option.
87
- * @typedef {object} OptionSchema
88
- * @prop {string} param The flag of the command line option including dashes.
89
- * @prop {OptionType} type The value type of the command line option.
90
- * @prop {string} [invertedParam] The flag of the command line option including dashes (optional).
91
- */
92
- /**
93
- * Schema definition for a command.
94
- * @typedef {Object.<string, OptionSchema>} OptionsSchema
95
- */
96
- /**
97
- * Serializes command line options into an arguments array.
98
- *
99
- * @param {OptionsSchema} schema An options schema required by the command.
100
- * @param {object} options An options object according to the schema.
101
- * @returns {string[]} An arguments array that can be passed via command line.
102
- */
103
- export function serializeOptions(schema: OptionsSchema, options: object): string[];
104
- export function getDistributionForThisPlatform(): {
105
- packageName: string;
106
- subpath: string;
107
- };
108
- /**
109
- * Throws an error with a message stating that Sentry CLI doesn't support the current platform.
110
- *
111
- * @returns {never} nothing. It throws.
112
- */
113
- export function throwUnsupportedPlatformError(): never;
114
- /**
115
- * This convoluted function resolves the path to the manually downloaded fallback
116
- * `sentry-cli` binary in a way that can't be analysed by @vercel/nft.
117
- *
118
- * Without this, the binary can be detected as an asset and included by bundlers
119
- * that use @vercel/nft.
120
- *
121
- * @returns {string} The path to the sentry-cli binary
122
- */
123
- export function getFallbackBinaryPath(): string;
89
+ export { execute, getPath, getProjectFlagsFromOptions, mockBinaryPath, prepareCommand, serializeOptions, getDistributionForThisPlatform, throwUnsupportedPlatformError, getFallbackBinaryPath, };
package/js/helper.js CHANGED
@@ -8,10 +8,20 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
- const os = require('os');
12
- const path = require('path');
13
- const fs = require('fs');
14
- const childProcess = require('child_process');
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.execute = execute;
13
+ exports.getPath = getPath;
14
+ exports.getProjectFlagsFromOptions = getProjectFlagsFromOptions;
15
+ exports.mockBinaryPath = mockBinaryPath;
16
+ exports.prepareCommand = prepareCommand;
17
+ exports.serializeOptions = serializeOptions;
18
+ exports.getDistributionForThisPlatform = getDistributionForThisPlatform;
19
+ exports.throwUnsupportedPlatformError = throwUnsupportedPlatformError;
20
+ exports.getFallbackBinaryPath = getFallbackBinaryPath;
21
+ const os = require("node:os");
22
+ const path = require("node:path");
23
+ const fs = require("node:fs");
24
+ const childProcess = require("node:child_process");
15
25
  const BINARY_DISTRIBUTIONS = [
16
26
  { packageName: '@sentry/cli-darwin', subpath: 'bin/sentry-cli' },
17
27
  { packageName: '@sentry/cli-linux-x64', subpath: 'bin/sentry-cli' },
@@ -29,7 +39,7 @@ const BINARY_DISTRIBUTIONS = [
29
39
  * Without this, the binary can be detected as an asset and included by bundlers
30
40
  * that use @vercel/nft.
31
41
  *
32
- * @returns {string} The path to the sentry-cli binary
42
+ * @returns The path to the sentry-cli binary
33
43
  */
34
44
  function getFallbackBinaryPath() {
35
45
  const parts = [];
@@ -96,7 +106,7 @@ function getDistributionForThisPlatform() {
96
106
  /**
97
107
  * Throws an error with a message stating that Sentry CLI doesn't support the current platform.
98
108
  *
99
- * @returns {never} nothing. It throws.
109
+ * @returns nothing. It throws.
100
110
  */
101
111
  function throwUnsupportedPlatformError() {
102
112
  throw new Error(`Unsupported operating system or architecture! Sentry CLI does not work on this architecture.
@@ -110,7 +120,7 @@ Sentry CLI supports:
110
120
  * Tries to find the installed Sentry CLI binary - either by looking into the relevant
111
121
  * optional dependencies or by trying to resolve the fallback binary.
112
122
  *
113
- * @returns {string} The path to the sentry-cli binary
123
+ * @returns The path to the sentry-cli binary
114
124
  */
115
125
  function getBinaryPath() {
116
126
  if (process.env.SENTRY_BINARY_PATH) {
@@ -157,40 +167,23 @@ It seems like none of the "@sentry/cli" package's optional dependencies got inst
157
167
  }
158
168
  /**
159
169
  * Will be used as the binary path when defined with `mockBinaryPath`.
160
- * @type {string | undefined}
161
170
  */
162
171
  let mockedBinaryPath;
163
172
  /**
164
173
  * Overrides the default binary path with a mock value, useful for testing.
165
174
  *
166
- * @param {string} mockPath The new path to the mock sentry-cli binary
175
+ * @param mockPath The new path to the mock sentry-cli binary
167
176
  * @deprecated This was used in tests internally and will be removed in the next major version.
168
177
  */
169
178
  // TODO(v3): Remove this function
170
179
  function mockBinaryPath(mockPath) {
171
180
  mockedBinaryPath = mockPath;
172
181
  }
173
- /**
174
- * The javascript type of a command line option.
175
- * @typedef {'array'|'string'|'boolean'|'inverted-boolean'} OptionType
176
- */
177
- /**
178
- * Schema definition of a command line option.
179
- * @typedef {object} OptionSchema
180
- * @prop {string} param The flag of the command line option including dashes.
181
- * @prop {OptionType} type The value type of the command line option.
182
- * @prop {string} [invertedParam] The flag of the command line option including dashes (optional).
183
- */
184
- /**
185
- * Schema definition for a command.
186
- * @typedef {Object.<string, OptionSchema>} OptionsSchema
187
- */
188
182
  /**
189
183
  * Serializes command line options into an arguments array.
190
184
  *
191
- * @param {OptionsSchema} schema An options schema required by the command.
192
- * @param {object} options An options object according to the schema.
193
- * @returns {string[]} An arguments array that can be passed via command line.
185
+ * @param schema An options schema required by the command.
186
+ * @param options An options object according to the schema.
194
187
  */
195
188
  function serializeOptions(schema, options) {
196
189
  return Object.keys(schema).reduce((newOptions, option) => {
@@ -225,17 +218,16 @@ function serializeOptions(schema, options) {
225
218
  /**
226
219
  * Serializes the command and its options into an arguments array.
227
220
  *
228
- * @param {string[]} command The literal name of the command.
229
- * @param {OptionsSchema} [schema] An options schema required by the command.
230
- * @param {object} [options] An options object according to the schema.
231
- * @returns {string[]} An arguments array that can be passed via command line.
221
+ * @param command The literal name of the command.
222
+ * @param schema An options schema required by the command.
223
+ * @param options An options object according to the schema.
224
+ * @returns An arguments array that can be passed via command line.
232
225
  */
233
226
  function prepareCommand(command, schema, options) {
234
227
  return command.concat(serializeOptions(schema || {}, options || {}));
235
228
  }
236
229
  /**
237
230
  * Returns the absolute path to the `sentry-cli` binary.
238
- * @returns {string}
239
231
  */
240
232
  function getPath() {
241
233
  return mockedBinaryPath !== undefined ? mockedBinaryPath : getBinaryPath();
@@ -257,16 +249,15 @@ function getPath() {
257
249
  * const output = await execute(['--version']);
258
250
  * expect(output.trim()).toBe('sentry-cli x.y.z');
259
251
  *
260
- * @param {string[]} args Command line arguments passed to `sentry-cli`.
261
- * @param {boolean | 'rejectOnError'} live can be set to:
262
- * - `true` to inherit stdio to display `sentry-cli` output directly.
263
- * - `false` to not inherit stdio and return the output as a string.
264
- * - `'rejectOnError'` to inherit stdio and reject the promise if the command
252
+ * @param args Command line arguments passed to `sentry-cli`.
253
+ * @param live can be set to:
254
+ * - `true` to inherit stdio and reject the promise if the command
265
255
  * exits with a non-zero exit code.
266
- * @param {boolean} silent Disable stdout for silents build (CI/Webpack Stats, ...)
267
- * @param {string} [configFile] Relative or absolute path to the configuration file.
268
- * @param {import('./index').SentryCliOptions} [config] More configuration to pass to the CLI
269
- * @returns {Promise<string>} A promise that resolves to the standard output.
256
+ * - `false` to not inherit stdio and return the output as a string.
257
+ * @param silent Disable stdout for silents build (CI/Webpack Stats, ...)
258
+ * @param configFile Relative or absolute path to the configuration file.
259
+ * @param config More configuration to pass to the CLI
260
+ * @returns A promise that resolves to the standard output.
270
261
  */
271
262
  function execute(args_1, live_1, silent_1, configFile_1) {
272
263
  return __awaiter(this, arguments, void 0, function* (args, live, silent, configFile, config = {}) {
@@ -280,9 +271,6 @@ function execute(args_1, live_1, silent_1, configFile_1) {
280
271
  if (config.authToken) {
281
272
  env.SENTRY_AUTH_TOKEN = config.authToken;
282
273
  }
283
- if (config.apiKey) {
284
- env.SENTRY_API_KEY = config.apiKey;
285
- }
286
274
  if (config.dsn) {
287
275
  env.SENTRY_DSN = config.dsn;
288
276
  }
@@ -306,7 +294,7 @@ function execute(args_1, live_1, silent_1, configFile_1) {
306
294
  args = [...headers, ...args];
307
295
  }
308
296
  return new Promise((resolve, reject) => {
309
- if (live === true || live === 'rejectOnError') {
297
+ if (live) {
310
298
  const output = silent ? 'ignore' : 'inherit';
311
299
  const pid = childProcess.spawn(getPath(), args, {
312
300
  env,
@@ -314,18 +302,10 @@ function execute(args_1, live_1, silent_1, configFile_1) {
314
302
  stdio: ['ignore', output, output],
315
303
  });
316
304
  pid.on('exit', (exitCode) => {
317
- if (live === 'rejectOnError') {
318
- if (exitCode === 0) {
319
- resolve('success (live mode)');
320
- }
321
- reject(new Error(`Command ${args.join(' ')} failed with exit code ${exitCode}`));
305
+ if (exitCode === 0) {
306
+ resolve('success (live mode)');
322
307
  }
323
- // According to the type definition, resolving with void is not allowed.
324
- // However, for backwards compatibility, we resolve void here to
325
- // avoid a behaviour-breaking change.
326
- // TODO (v3): Clean this up and always resolve a string (or change the type definition)
327
- // @ts-expect-error - see comment above
328
- resolve();
308
+ reject(new Error(`Command ${args.join(' ')} failed with exit code ${exitCode}`));
329
309
  });
330
310
  }
331
311
  else {
@@ -344,14 +324,3 @@ function execute(args_1, live_1, silent_1, configFile_1) {
344
324
  function getProjectFlagsFromOptions({ projects = [] } = {}) {
345
325
  return projects.reduce((flags, project) => flags.concat('-p', project), []);
346
326
  }
347
- module.exports = {
348
- execute,
349
- getPath,
350
- getProjectFlagsFromOptions,
351
- mockBinaryPath,
352
- prepareCommand,
353
- serializeOptions,
354
- getDistributionForThisPlatform,
355
- throwUnsupportedPlatformError,
356
- getFallbackBinaryPath,
357
- };
package/js/index.d.ts CHANGED
@@ -1,12 +1,6 @@
1
- export = SentryCli;
2
- /**
3
- * @typedef {import('./types').SentryCliOptions} SentryCliOptions
4
- * @typedef {import('./types').SentryCliUploadSourceMapsOptions} SentryCliUploadSourceMapsOptions
5
- * @typedef {import('./types').SourceMapsPathDescriptor} SourceMapsPathDescriptor
6
- * @typedef {import('./types').SentryCliNewDeployOptions} SentryCliNewDeployOptions
7
- * @typedef {import('./types').SentryCliCommitsOptions} SentryCliCommitsOptions
8
- * @typedef {import('./types').SentryCliReleases} SentryCliReleases
9
- */
1
+ import { Releases } from './releases';
2
+ import type { SentryCliOptions } from './types';
3
+ export type { SentryCliOptions, SentryCliUploadSourceMapsOptions, SourceMapsPathDescriptor, SentryCliNewDeployOptions, SentryCliCommitsOptions, } from './types';
10
4
  /**
11
5
  * Interface to and wrapper around the `sentry-cli` executable.
12
6
  *
@@ -22,17 +16,10 @@ export = SentryCli;
22
16
  * const release = await cli.releases.proposeVersion());
23
17
  * console.log(release);
24
18
  */
25
- declare class SentryCli {
26
- /**
27
- * Returns the version of the installed `sentry-cli` binary.
28
- * @returns {string}
29
- */
30
- static getVersion(): string;
31
- /**
32
- * Returns an absolute path to the `sentry-cli` binary.
33
- * @returns {string}
34
- */
35
- static getPath(): string;
19
+ export declare class SentryCli {
20
+ configFile: string | null;
21
+ options: SentryCliOptions;
22
+ releases: Releases;
36
23
  /**
37
24
  * Creates a new `SentryCli` instance.
38
25
  *
@@ -40,34 +27,28 @@ declare class SentryCli {
40
27
  * location and the value specified in the `SENTRY_PROPERTIES` environment variable is
41
28
  * overridden.
42
29
  *
43
- * @param {string | null} [configFile] - Path to Sentry CLI config properties, as described in https://docs.sentry.io/learn/cli/configuration/#properties-files.
30
+ * @param configFile Path to Sentry CLI config properties, as described in https://docs.sentry.io/learn/cli/configuration/#properties-files.
44
31
  * By default, the config file is looked for upwards from the current path and defaults from ~/.sentryclirc are always loaded.
45
32
  * This value will update `SENTRY_PROPERTIES` env variable.
46
- * @param {SentryCliOptions} [options] - More options to pass to the CLI
33
+ * @param options More options to pass to the CLI
47
34
  */
48
- constructor(configFile?: string | null, options?: SentryCliOptions);
49
- configFile: string;
50
- options: import("./types").SentryCliOptions;
51
- releases: Releases;
35
+ constructor(configFile: string | null, options: SentryCliOptions);
36
+ /**
37
+ * Returns the version of the installed `sentry-cli` binary.
38
+ */
39
+ static getVersion(): string;
40
+ /**
41
+ * Returns an absolute path to the `sentry-cli` binary.
42
+ */
43
+ static getPath(): string;
52
44
  /**
53
45
  * See {helper.execute} docs.
54
- * @param {string[]} args Command line arguments passed to `sentry-cli`.
55
- * @param {boolean | 'rejectOnError'} live can be set to:
56
- * - `true` to inherit stdio to display `sentry-cli` output directly.
57
- * - `false` to not inherit stdio and return the output as a string.
58
- * - `'rejectOnError'` to inherit stdio and reject the promise if the command
46
+ * @param args Command line arguments passed to `sentry-cli`.
47
+ * @param live can be set to:
48
+ * - `true` to inherit stdio and reject the promise if the command
59
49
  * exits with a non-zero exit code.
60
- * @returns {Promise<string>} A promise that resolves to the standard output.
50
+ * - `false` to not inherit stdio and return the output as a string.
51
+ * @returns A promise that resolves to the standard output.
61
52
  */
62
- execute(args: string[], live: boolean | "rejectOnError"): Promise<string>;
63
- }
64
- declare namespace SentryCli {
65
- export { SentryCliOptions, SentryCliUploadSourceMapsOptions, SourceMapsPathDescriptor, SentryCliNewDeployOptions, SentryCliCommitsOptions, SentryCliReleases };
53
+ execute(args: string[], live: boolean): Promise<string>;
66
54
  }
67
- import Releases = require("./releases");
68
- type SentryCliOptions = import("./types").SentryCliOptions;
69
- type SentryCliUploadSourceMapsOptions = import("./types").SentryCliUploadSourceMapsOptions;
70
- type SourceMapsPathDescriptor = import("./types").SourceMapsPathDescriptor;
71
- type SentryCliNewDeployOptions = import("./types").SentryCliNewDeployOptions;
72
- type SentryCliCommitsOptions = import("./types").SentryCliCommitsOptions;
73
- type SentryCliReleases = import("./types").SentryCliReleases;