@sentry/cli 1.77.1 → 1.77.2

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
@@ -1,6 +1,11 @@
1
1
  <p align="center">
2
- <img src="https://sentry-brand.storage.googleapis.com/sentry-logo-black.png" width="280">
3
- <br />
2
+ <a href="https://sentry.io/?utm_source=github&utm_medium=logo" target="_blank">
3
+ <picture>
4
+ <source srcset="https://sentry-brand.storage.googleapis.com/sentry-logo-white.png" media="(prefers-color-scheme: dark)" />
5
+ <source srcset="https://sentry-brand.storage.googleapis.com/sentry-logo-black.png" media="(prefers-color-scheme: light), (prefers-color-scheme: no-preference)" />
6
+ <img src="https://sentry-brand.storage.googleapis.com/sentry-logo-black.png" alt="Sentry" width="280">
7
+ </picture>
8
+ </a>
4
9
  </p>
5
10
 
6
11
  # Official Sentry Command Line Interface
@@ -12,7 +17,7 @@
12
17
 
13
18
  This is a Sentry command line client for some generic tasks. Right now this is
14
19
  primarily used to upload debug symbols to Sentry if you are not using the
15
- fastlane tools.
20
+ Fastlane tools.
16
21
 
17
22
  * Downloads can be found under
18
23
  [Releases](https://github.com/getsentry/sentry-cli/releases/)
@@ -20,13 +25,34 @@ fastlane tools.
20
25
 
21
26
  ## Installation
22
27
 
23
- The recommended way to install is with everybody's favorite curl to bash:
28
+ If you are on OS X or Linux, you can use the automated downloader which will fetch the latest release version for you and install it:
24
29
 
25
30
  curl -sL https://sentry.io/get-cli/ | bash
26
31
 
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:
34
+
35
+ curl -sL https://sentry.io/get-cli/ | SENTRY_CLI_VERSION=2.0.4 bash
36
+
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.
38
+
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.
40
+
41
+ To verify it’s installed correctly you can bring up the help:
42
+
43
+ sentry-cli --help
44
+
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
+
27
53
  ### Node
28
54
 
29
- Additionally you can also install this binary via npm:
55
+ Additionally, you can also install this binary via npm:
30
56
 
31
57
  npm install @sentry/cli
32
58
 
@@ -51,14 +77,22 @@ Or add property into your `.npmrc` file (https://www.npmjs.org/doc/files/npmrc.h
51
77
  sentrycli_cdnurl=https://mymirror.local/path
52
78
  ```
53
79
 
54
- Another option is to use the environment variable `SENTRYCLI_CDNURL`.
80
+ There are a few environment variables that you can provide to control the npm installation:
55
81
 
56
- ```sh
57
- SENTRYCLI_CDNURL=https://mymirror.local/path npm install @sentry/cli
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
58
88
  ```
59
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
+
60
94
  If you're installing the CLI with NPM from behind a proxy, the install script will
61
- use either NPM's configured HTTPS proxy server, or the value from your `HTTPS_PROXY`
95
+ use either NPM's configured HTTPS proxy server or the value from your `HTTPS_PROXY`
62
96
  environment variable.
63
97
 
64
98
  ### Homebrew
@@ -79,6 +113,23 @@ docker pull getsentry/sentry-cli
79
113
  docker run --rm -v $(pwd):/work getsentry/sentry-cli --help
80
114
  ```
81
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
+ ```
132
+
82
133
  ## Compiling
83
134
 
84
135
  In case you want to compile this yourself, you need to install at minimum the
package/bin/sentry-cli CHANGED
@@ -3,17 +3,17 @@
3
3
  'use strict';
4
4
 
5
5
  const childProcess = require('child_process');
6
- const cli = require('../js');
6
+ const SentryCli = require('../js');
7
7
 
8
8
  const child = childProcess
9
- .spawn(cli.getPath(), process.argv.slice(2), {
9
+ .spawn(SentryCli.getPath(), process.argv.slice(2), {
10
10
  stdio: 'inherit',
11
11
  })
12
- .on('error', err => {
12
+ .on('error', (err) => {
13
13
  console.error(err); // eslint-disable-line no-console
14
14
  process.exit(1);
15
15
  })
16
- .on('exit', code => process.exit(code));
16
+ .on('exit', (code) => process.exit(code));
17
17
 
18
18
  process.on('SIGTERM', () => child.kill('SIGTERM'));
19
19
  process.on('SIGINT', () => child.kill('SIGINT'));
package/checksums.txt CHANGED
@@ -1,9 +1,9 @@
1
- sentry-cli-Darwin-arm64=10951f615c9a23b1d598887a5114936c41ccdaec85d0ef749ce5ed1be4409203
2
- sentry-cli-Darwin-universal=1f1abe664a476b4488e018f1db775cb663aed3beb26a7a1a074346759277a935
3
- sentry-cli-Darwin-x86_64=1cf1d7595d851bed60639a7ad092b8451c0d13bdc1724767f38e2d78af988047
4
- sentry-cli-Linux-aarch64=e60603e05bad2a3449e6a18f5bc7d38525762faf32c99ed95bd95d7c5e13225e
5
- sentry-cli-Linux-armv7=5a30a376de811641edbad5bffe1227cd6186c43fedcc5c544269c4bc0f80acff
6
- sentry-cli-Linux-i686=44b2ea8ceb3bda57b6925316fb738892e8d84578802dfee0d1c481e4f0730826
7
- sentry-cli-Linux-x86_64=79ca22a21cb4932f12658f687f931899fa994248d3833957870a172350a4a4f0
8
- sentry-cli-Windows-i686.exe=45f30e37d3ff3fa48ecb77f91517a73c24d9f3fda0f385b38f396fbc674918a5
9
- sentry-cli-Windows-x86_64.exe=41c1abafc6aef4c02ec14540c60eb8139b9ba5ef22f9804b49b714c64c954b2f
1
+ sentry-cli-Darwin-arm64=a69b907a4984a5d69fdb8fa018d08e45254e57a7038839a39deee09545137c9c
2
+ sentry-cli-Darwin-universal=88648343df5e7e6bbf7e95fb8c67681b7949fdc919c00c0acaedf2ac8e258acc
3
+ sentry-cli-Darwin-x86_64=26593639d98aa5e853951d1a4303ab578f1964545984b22e7f51feafcbe56152
4
+ sentry-cli-Linux-aarch64=62f023ef7741facc7d4faead1717840aa83572991f9bcf42172b0ad82f27a820
5
+ sentry-cli-Linux-armv7=23570b65e0c31428914d388b8e5e7ffb499627af810f60965517148cce0ac6fc
6
+ sentry-cli-Linux-i686=a8e77f18ddadb5035d1c54b5978d7528b87fda62804a19a272f21761cdd0c889
7
+ sentry-cli-Linux-x86_64=088ac6568445c4ebb5b82652190f51c711e13d40d5bd94a62cc37f2f1865412d
8
+ sentry-cli-Windows-i686.exe=1d8a960afa3e6ef6f08125974d2ae2e79e8a7b38ae30f7c0b7a32db26f8b8e8b
9
+ sentry-cli-Windows-x86_64.exe=6c30d85138bac891ba490a222870067c82c0617226bcd8b32768f11b7a5c9585
package/js/helper.js CHANGED
@@ -1,17 +1,30 @@
1
1
  'use strict';
2
2
 
3
+ const os = require('os');
3
4
  const path = require('path');
5
+ const fs = require('fs');
4
6
  const childProcess = require('child_process');
5
7
 
8
+ const BINARY_DISTRIBUTIONS = [
9
+ { packageName: '@sentry/cli-darwin', subpath: 'bin/sentry-cli' },
10
+ { packageName: '@sentry/cli-linux-x64', subpath: 'bin/sentry-cli' },
11
+ { packageName: '@sentry/cli-linux-i686', subpath: 'bin/sentry-cli' },
12
+ { packageName: '@sentry/cli-linux-arm64', subpath: 'bin/sentry-cli' },
13
+ { packageName: '@sentry/cli-linux-arm', subpath: 'bin/sentry-cli' },
14
+ { packageName: '@sentry/cli-win32-x64', subpath: 'bin/sentry-cli.exe' },
15
+ { packageName: '@sentry/cli-win32-i686', subpath: 'bin/sentry-cli.exe' },
16
+ ];
17
+
6
18
  /**
7
- * This convoluted function resolves the path to the `sentry-cli` binary in a
8
- * way that can't be analysed by @vercel/nft.
19
+ * This convoluted function resolves the path to the manually downloaded fallback
20
+ * `sentry-cli` binary in a way that can't be analysed by @vercel/nft.
9
21
  *
10
22
  * Without this, the binary can be detected as an asset and included by bundlers
11
23
  * that use @vercel/nft.
24
+ *
12
25
  * @returns {string} The path to the sentry-cli binary
13
26
  */
14
- function getBinaryPath() {
27
+ function getFallbackBinaryPath() {
15
28
  const parts = [];
16
29
  parts.push(__dirname);
17
30
  parts.push('..');
@@ -19,19 +32,143 @@ function getBinaryPath() {
19
32
  return path.resolve(...parts);
20
33
  }
21
34
 
35
+ function getDistributionForThisPlatform() {
36
+ const arch = os.arch();
37
+ const platform = os.platform();
38
+
39
+ let packageName = undefined;
40
+ if (platform === 'darwin') {
41
+ packageName = '@sentry/cli-darwin';
42
+ } else if (platform === 'linux' || platform === 'freebsd') {
43
+ switch (arch) {
44
+ case 'x64':
45
+ packageName = '@sentry/cli-linux-x64';
46
+ break;
47
+ case 'x86':
48
+ case 'ia32':
49
+ packageName = '@sentry/cli-linux-i686';
50
+ break;
51
+ case 'arm64':
52
+ packageName = '@sentry/cli-linux-arm64';
53
+ break;
54
+ case 'arm':
55
+ packageName = '@sentry/cli-linux-arm';
56
+ break;
57
+ }
58
+ } else if (platform === 'win32') {
59
+ switch (arch) {
60
+ case 'x64':
61
+ packageName = '@sentry/cli-win32-x64';
62
+ break;
63
+ case 'x86':
64
+ case 'ia32':
65
+ packageName = '@sentry/cli-win32-i686';
66
+ break;
67
+ }
68
+ }
69
+
70
+ let subpath = undefined;
71
+ switch (platform) {
72
+ case 'win32':
73
+ subpath = 'bin/sentry-cli.exe';
74
+ break;
75
+ case 'darwin':
76
+ case 'linux':
77
+ case 'freebsd':
78
+ subpath = 'bin/sentry-cli';
79
+ break;
80
+ default:
81
+ subpath = 'bin/sentry-cli';
82
+ break;
83
+ }
84
+
85
+ return { packageName, subpath };
86
+ }
87
+
88
+ /**
89
+ * Throws an error with a message stating that Sentry CLI doesn't support the current platform.
90
+ *
91
+ * @returns {never} nothing. It throws.
92
+ */
93
+ function throwUnsupportedPlatformError() {
94
+ throw new Error(
95
+ `Unsupported operating system or architecture! Sentry CLI does not work on this architecture.
96
+
97
+ Sentry CLI supports:
98
+ - Darwin (macOS)
99
+ - Linux and FreeBSD on x64, x86, ia32, arm64, and arm architectures
100
+ - Windows x64, x86, and ia32 architectures`
101
+ );
102
+ }
103
+
104
+ /**
105
+ * Tries to find the installed Sentry CLI binary - either by looking into the relevant
106
+ * optional dependencies or by trying to resolve the fallback binary.
107
+ *
108
+ * @returns {string} The path to the sentry-cli binary
109
+ */
110
+ function getBinaryPath() {
111
+ if (process.env.SENTRY_BINARY_PATH) {
112
+ return process.env.SENTRY_BINARY_PATH;
113
+ }
114
+
115
+ const { packageName, subpath } = getDistributionForThisPlatform();
116
+
117
+ if (packageName === undefined) {
118
+ throwUnsupportedPlatformError();
119
+ }
120
+
121
+ let fallbackBinaryPath = getFallbackBinaryPath();
122
+ if (fs.existsSync(fallbackBinaryPath)) {
123
+ // Since the fallback got installed, the optional dependencies likely didn't get installed, so we just default to the fallback.
124
+ return fallbackBinaryPath;
125
+ }
126
+
127
+ let compatibleBinaryPath;
128
+ try {
129
+ compatibleBinaryPath = require.resolve(`${packageName}/${subpath}`);
130
+ } catch (e) {
131
+ const otherInstalledDistribution = BINARY_DISTRIBUTIONS.find(({ packageName, subpath }) => {
132
+ try {
133
+ require.resolve(`${packageName}/${subpath}`);
134
+ return true;
135
+ } catch (e) {
136
+ return false;
137
+ }
138
+ });
139
+
140
+ // These error messages are heavily inspired by esbuild's error messages: https://github.com/evanw/esbuild/blob/f3d535262e3998d845d0f102b944ecd5a9efda57/lib/npm/node-platform.ts#L150
141
+ if (otherInstalledDistribution) {
142
+ throw new Error(`Sentry CLI binary for this platform/architecture not found!
143
+
144
+ The "${otherInstalledDistribution.packageName}" package is installed, but for the current platform, you should have the "${packageName}" package installed instead. This usually happens if the "@sentry/cli" package is installed on one platform (for example Windows or MacOS) and then the "node_modules" folder is reused on another operating system (for example Linux in Docker).
145
+
146
+ To fix this, avoid copying the "node_modules" folder, and instead freshly install your dependencies on the target system. You can also configure your package manager to install the right package. For example, yarn has the "supportedArchitectures" feature: https://yarnpkg.com/configuration/yarnrc/#supportedArchitecture.`);
147
+ } else {
148
+ throw new Error(`Sentry CLI binary for this platform/architecture not found!
149
+
150
+ It seems like none of the "@sentry/cli" package's optional dependencies got installed. Please make sure your package manager is configured to install optional dependencies. If you are using npm to install your dependencies, please don't set the "--no-optional", "--ignore-optional", or "--omit=optional" flags. Sentry CLI needs the "optionalDependencies" feature in order to install its binary.`);
151
+ }
152
+ }
153
+
154
+ return compatibleBinaryPath;
155
+ }
156
+
22
157
  /**
23
- * Absolute path to the sentry-cli binary (platform dependent).
24
- * @type {string}
158
+ * Will be used as the binary path when defined with `mockBinaryPath`.
159
+ * @type {string | undefined}
25
160
  */
26
- let binaryPath = getBinaryPath();
161
+ let mockedBinaryPath;
27
162
 
28
163
  /**
29
164
  * Overrides the default binary path with a mock value, useful for testing.
30
165
  *
31
166
  * @param {string} mockPath The new path to the mock sentry-cli binary
167
+ * @deprecated This was used in tests internally and will be removed in the next major version.
32
168
  */
169
+ // TODO(v3): Remove this function
33
170
  function mockBinaryPath(mockPath) {
34
- binaryPath = mockPath;
171
+ mockedBinaryPath = mockPath;
35
172
  }
36
173
 
37
174
  /**
@@ -61,7 +198,7 @@ function mockBinaryPath(mockPath) {
61
198
  function serializeOptions(schema, options) {
62
199
  return Object.keys(schema).reduce((newOptions, option) => {
63
200
  const paramValue = options[option];
64
- if (paramValue === undefined) {
201
+ if (paramValue === undefined || paramValue === null) {
65
202
  return newOptions;
66
203
  }
67
204
 
@@ -117,7 +254,7 @@ function prepareCommand(command, schema, options) {
117
254
  * @returns {string}
118
255
  */
119
256
  function getPath() {
120
- return binaryPath;
257
+ return mockedBinaryPath !== undefined ? mockedBinaryPath : getBinaryPath();
121
258
  }
122
259
 
123
260
  /**
@@ -144,7 +281,7 @@ function getPath() {
144
281
  * @param {Object} [config] More configuration to pass to the CLI
145
282
  * @returns {Promise.<string>} A promise that resolves to the standard output.
146
283
  */
147
- function execute(args, live, silent, configFile, config = {}) {
284
+ async function execute(args, live, silent, configFile, config = {}) {
148
285
  const env = { ...process.env };
149
286
  if (configFile) {
150
287
  env.SENTRY_PROPERTIES = configFile;
@@ -172,6 +309,12 @@ function execute(args, live, silent, configFile, config = {}) {
172
309
  }
173
310
  if (config.customHeader) {
174
311
  env.CUSTOM_HEADER = config.customHeader;
312
+ } else if (config.headers) {
313
+ const headers = Object.entries(config.headers).flatMap(([key, value]) => [
314
+ '--header',
315
+ `${key}:${value}`,
316
+ ]);
317
+ args = [...headers, ...args];
175
318
  }
176
319
  return new Promise((resolve, reject) => {
177
320
  if (live === true) {
@@ -207,4 +350,7 @@ module.exports = {
207
350
  mockBinaryPath,
208
351
  prepareCommand,
209
352
  serializeOptions,
353
+ getDistributionForThisPlatform,
354
+ throwUnsupportedPlatformError,
355
+ getFallbackBinaryPath,
210
356
  };
package/js/index.d.ts CHANGED
@@ -38,11 +38,6 @@ declare module '@sentry/cli' {
38
38
  * This value will update `SENTRY_VCS_REMOTE` env variable.
39
39
  */
40
40
  vcsRemote?: string;
41
- /**
42
- * Unique identifier for the distribution, used to further segment your release.
43
- * Usually your build number.
44
- */
45
- dist?: string;
46
41
  /**
47
42
  * If true, all logs are suppressed.
48
43
  */
@@ -52,6 +47,11 @@ declare module '@sentry/cli' {
52
47
  * This value will update `CUSTOM_HEADER` env variable.
53
48
  */
54
49
  customHeader?: string;
50
+ /**
51
+ * Headers added to every outgoing network request.
52
+ * This value does not set any env variable, and is overridden by `customHeader`.
53
+ */
54
+ headers?: Record<string, string>;
55
55
  }
56
56
 
57
57
  /**
@@ -59,7 +59,9 @@ declare module '@sentry/cli' {
59
59
  * case `paths` takes the place of `include` in the options so as to make it
60
60
  * clear that this is not recursive.
61
61
  */
62
- export type SourceMapsPathDescriptor = Omit<SentryCliUploadSourceMapsOptions, 'include'> & { paths: string[] }
62
+ export type SourceMapsPathDescriptor = Omit<SentryCliUploadSourceMapsOptions, 'include'> & {
63
+ paths: string[];
64
+ };
63
65
 
64
66
  export interface SentryCliUploadSourceMapsOptions {
65
67
  /**
@@ -85,6 +87,15 @@ declare module '@sentry/cli' {
85
87
  * This prevents the automatic detection of sourcemap references.
86
88
  */
87
89
  sourceMapReference?: boolean;
90
+ /**
91
+ * Enables files gzip decompression prior to uploading. Defaults to `false`.
92
+ */
93
+ decompress?: boolean;
94
+ /**
95
+ * Enable artifacts deduplication prior to uploading. This will skip uploading
96
+ * any artifacts that are already present on the server. Defaults to `true`.
97
+ */
98
+ dedupe?: boolean;
88
99
  /**
89
100
  * When paired with the rewrite option this will remove a prefix from uploaded files.
90
101
  * For instance you can use this to remove a path that is build machine specific.
@@ -116,6 +127,15 @@ declare module '@sentry/cli' {
116
127
  * By default the following file extensions are processed: js, map, jsbundle and bundle.
117
128
  */
118
129
  ext?: string[];
130
+ /**
131
+ * Unique identifier for the distribution, used to further segment your release.
132
+ * Usually your build number.
133
+ */
134
+ dist?: string;
135
+ /**
136
+ * Use new Artifact Bundles upload, that enables use of Debug ID for Source Maps discovery.
137
+ */
138
+ useArtifactBundle?: boolean;
119
139
  }
120
140
 
121
141
  export interface SentryCliNewDeployOptions {
@@ -176,31 +196,19 @@ declare module '@sentry/cli' {
176
196
  }
177
197
 
178
198
  export interface SentryCliReleases {
179
- ['new'](
180
- release: string,
181
- options?: { projects: string[] } | string[]
182
- ): Promise<string>;
199
+ ['new'](release: string, options?: { projects: string[] } | string[]): Promise<string>;
183
200
 
184
- setCommits(
185
- release: string,
186
- options: SentryCliCommitsOptions
187
- ): Promise<string>;
201
+ setCommits(release: string, options: SentryCliCommitsOptions): Promise<string>;
188
202
 
189
- finalize(release: string): Promise<string>
203
+ finalize(release: string): Promise<string>;
190
204
 
191
- proposeVersion(): Promise<string>
205
+ proposeVersion(): Promise<string>;
192
206
 
193
- uploadSourceMaps(
194
- release: string,
195
- options: SentryCliUploadSourceMapsOptions
196
- ): Promise<string>
207
+ uploadSourceMaps(release: string, options: SentryCliUploadSourceMapsOptions): Promise<string>;
197
208
 
198
209
  listDeploys(release: string): Promise<string>;
199
210
 
200
- newDeploy(
201
- release: string,
202
- options: SentryCliNewDeployOptions
203
- ): Promise<string>
211
+ newDeploy(release: string, options: SentryCliNewDeployOptions): Promise<string>;
204
212
 
205
213
  execute(args: string[], live: boolean): Promise<string>;
206
214
  }
@@ -214,21 +222,14 @@ declare module '@sentry/cli' {
214
222
  * This value will update `SENTRY_PROPERTIES` env variable.
215
223
  * @param options {@link SentryCliOptions}
216
224
  */
217
- constructor(configFile?: string | null, options?: SentryCliOptions)
225
+ constructor(configFile?: string | null, options?: SentryCliOptions);
218
226
 
219
227
  public configFile?: string;
220
228
  public options?: SentryCliOptions;
221
- public releases: SentryCliReleases
222
-
223
- public static getVersion(): string
224
- public static getPath(): string
225
-
226
- /**
227
- * Downloads the CLI binary.
228
- * @returns {Promise<void>}
229
- */
230
- static downloadBinary(logger: { log(...args: unknown[]): void }): Promise<void>;
229
+ public releases: SentryCliReleases;
231
230
 
232
- public execute(args: string[], live: boolean): Promise<string>
231
+ public static getVersion(): string;
232
+ public static getPath(): string;
233
+ public execute(args: string[], live: boolean): Promise<string>;
233
234
  }
234
235
  }
package/js/index.js CHANGED
@@ -3,7 +3,6 @@
3
3
  const pkgInfo = require('../package.json');
4
4
  const helper = require('./helper');
5
5
  const Releases = require('./releases');
6
- const install = require('./install');
7
6
 
8
7
  /**
9
8
  * Interface to and wrapper around the `sentry-cli` executable.
@@ -55,15 +54,6 @@ class SentryCli {
55
54
  return helper.getPath();
56
55
  }
57
56
 
58
- /**
59
- * Downloads the CLI binary.
60
- * @param {any} [configFile] Optional logger to log installation information. Defaults to printing to the terminal.
61
- * @returns {Promise<void>}
62
- */
63
- static downloadBinary(logger) {
64
- return install.downloadBinary(logger);
65
- }
66
-
67
57
  /**
68
58
  * See {helper.execute} docs.
69
59
  * @param {string[]} args Command line arguments passed to `sentry-cli`.
@@ -50,7 +50,7 @@ class Releases {
50
50
  * @returns {Promise} A promise that resolves when the release has been created.
51
51
  * @memberof SentryReleases
52
52
  */
53
- new(release, options) {
53
+ async new(release, options) {
54
54
  const args = ['releases', 'new', release].concat(helper.getProjectFlagsFromOptions(options));
55
55
  return this.execute(args, null);
56
56
  }
@@ -76,7 +76,7 @@ class Releases {
76
76
  * @returns {Promise} A promise that resolves when the commits have been associated
77
77
  * @memberof SentryReleases
78
78
  */
79
- setCommits(release, options) {
79
+ async setCommits(release, options) {
80
80
  if (!options || (!options.auto && (!options.repo || !options.commit))) {
81
81
  throw new Error('options.auto, or options.repo and options.commit must be specified');
82
82
  }
@@ -95,10 +95,6 @@ class Releases {
95
95
  commitFlags.push('--ignore-missing');
96
96
  }
97
97
 
98
- if (options.ignoreEmpty) {
99
- commitFlags.push('--ignore-empty');
100
- }
101
-
102
98
  return this.execute(['releases', 'set-commits', release].concat(commitFlags));
103
99
  }
104
100
 
@@ -110,7 +106,7 @@ class Releases {
110
106
  * @returns {Promise} A promise that resolves when the release has been finalized.
111
107
  * @memberof SentryReleases
112
108
  */
113
- finalize(release) {
109
+ async finalize(release) {
114
110
  return this.execute(['releases', 'finalize', release], null);
115
111
  }
116
112
 
@@ -121,10 +117,9 @@ class Releases {
121
117
  * @returns {Promise.<string>} A promise that resolves to the version string.
122
118
  * @memberof SentryReleases
123
119
  */
124
- proposeVersion() {
125
- return this.execute(['releases', 'propose-version'], null).then(
126
- version => version && version.trim()
127
- );
120
+ async proposeVersion() {
121
+ const version = await this.execute(['releases', 'propose-version'], null);
122
+ return version.trim();
128
123
  }
129
124
 
130
125
  /**
@@ -145,13 +140,15 @@ class Releases {
145
140
  * ignoreFile: null, // path to a file with ignore rules
146
141
  * rewrite: false, // preprocess sourcemaps before uploading
147
142
  * sourceMapReference: true, // add a source map reference to source files
143
+ * dedupe: true, // deduplicate already uploaded files
148
144
  * stripPrefix: [], // remove certain prefices from filenames
149
145
  * stripCommonPrefix: false, // guess common prefices to remove from filenames
150
146
  * validate: false, // validate source maps and cancel the upload on error
151
147
  * urlPrefix: '', // add a prefix source map urls after stripping them
152
148
  * urlSuffix: '', // add a suffix source map urls after stripping them
153
149
  * ext: ['js', 'map', 'jsbundle', 'bundle'], // override file extensions to scan for
154
- * projects: ['node'] // provide a list of projects
150
+ * projects: ['node'], // provide a list of projects
151
+ * decompress: false // decompress gzip files before uploading
155
152
  * });
156
153
  *
157
154
  * @param {string} release Unique name of the release.
@@ -159,7 +156,7 @@ class Releases {
159
156
  * @returns {Promise} A promise that resolves when the upload has completed successfully.
160
157
  * @memberof SentryReleases
161
158
  */
162
- uploadSourceMaps(release, options) {
159
+ async uploadSourceMaps(release, options) {
163
160
  if (!options || !options.include || !Array.isArray(options.include)) {
164
161
  throw new Error(
165
162
  '`options.include` must be a vaild array of paths and/or path descriptor objects.'
@@ -169,7 +166,7 @@ class Releases {
169
166
  // Each entry in the `include` array will map to an array of promises, which
170
167
  // will in turn contain one promise per literal path value. Thus `uploads`
171
168
  // will be an array of Promise arrays, which we'll flatten later.
172
- const uploads = options.include.map(includeEntry => {
169
+ const uploads = options.include.map((includeEntry) => {
173
170
  let pathOptions;
174
171
  let uploadPaths;
175
172
 
@@ -200,7 +197,7 @@ class Releases {
200
197
  .concat(helper.getProjectFlagsFromOptions(options))
201
198
  .concat(['files', release, 'upload-sourcemaps']);
202
199
 
203
- return uploadPaths.map(path =>
200
+ return uploadPaths.map((path) =>
204
201
  // `execute()` is async and thus we're returning a promise here
205
202
  this.execute(helper.prepareCommand([...args, path], SOURCEMAPS_SCHEMA, newOptions), true)
206
203
  );
@@ -221,7 +218,7 @@ class Releases {
221
218
  * @returns {Promise} A promise that resolves when the list comes back from the server.
222
219
  * @memberof SentryReleases
223
220
  */
224
- listDeploys(release) {
221
+ async listDeploys(release) {
225
222
  return this.execute(['releases', 'deploys', release, 'list'], null);
226
223
  }
227
224
 
@@ -247,7 +244,7 @@ class Releases {
247
244
  * @returns {Promise} A promise that resolves when the deploy has been created.
248
245
  * @memberof SentryReleases
249
246
  */
250
- newDeploy(release, options) {
247
+ async newDeploy(release, options) {
251
248
  if (!options || !options.env) {
252
249
  throw new Error('options.env must be a vaild name');
253
250
  }
@@ -261,7 +258,7 @@ class Releases {
261
258
  * @param {boolean} live We inherit stdio to display `sentry-cli` output directly.
262
259
  * @returns {Promise.<string>} A promise that resolves to the standard output.
263
260
  */
264
- execute(args, live) {
261
+ async execute(args, live) {
265
262
  return helper.execute(args, live, this.options.silent, this.configFile, this.options);
266
263
  }
267
264
  }