@sentry/cli 2.23.1 → 2.24.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 +9 -9
- package/js/helper.js +52 -17
- package/package.json +9 -8
- package/scripts/install.js +31 -18
package/checksums.txt
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
sentry-cli-Darwin-arm64=
|
|
2
|
-
sentry-cli-Darwin-universal=
|
|
3
|
-
sentry-cli-Darwin-x86_64=
|
|
4
|
-
sentry-cli-Linux-aarch64=
|
|
5
|
-
sentry-cli-Linux-armv7=
|
|
6
|
-
sentry-cli-Linux-i686=
|
|
7
|
-
sentry-cli-Linux-x86_64=
|
|
8
|
-
sentry-cli-Windows-i686.exe=
|
|
9
|
-
sentry-cli-Windows-x86_64.exe=
|
|
1
|
+
sentry-cli-Darwin-arm64=0a39aec3289bb377494075059cbd64716d1a87dc72ed4f5daefb99f66397791c
|
|
2
|
+
sentry-cli-Darwin-universal=055cb6cedb1d00a0eaf016e102f47dc2d62359f959dacb47ca13d7f31a8cf331
|
|
3
|
+
sentry-cli-Darwin-x86_64=655b3242bfba4cdc1d99a7badee83509f54287e7eb4caffb4368b0e8db2c5ae1
|
|
4
|
+
sentry-cli-Linux-aarch64=71ef47f50b1a89af96c3b24227bd52c65469a95cfeeacf8c3d8b987b9c3217e2
|
|
5
|
+
sentry-cli-Linux-armv7=560d3dacc3f675b347efe33904bafecd0bcd021ff2f8f9de6527ab285d2c1431
|
|
6
|
+
sentry-cli-Linux-i686=93e2f0c498d7dd17433a613fa98a2216000f1dd5491302399aff401874c84e05
|
|
7
|
+
sentry-cli-Linux-x86_64=c1ee72ab611ddf5c1a78e4d9e1398cbcd7734118fb27b2c3790981298a80e203
|
|
8
|
+
sentry-cli-Windows-i686.exe=47e9a7d29471f2b1ba72dc8221ad1eb48a75683b91f814d92249f43327ec1988
|
|
9
|
+
sentry-cli-Windows-x86_64.exe=0524fb4409e03428ed89980c46ecc05f598660eb19a08e5b74f600f2ed3a3ab9
|
package/js/helper.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const os = require('os');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const fs = require('fs');
|
|
4
6
|
const childProcess = require('child_process');
|
|
5
7
|
|
|
6
8
|
const BINARY_DISTRIBUTIONS = [
|
|
@@ -13,6 +15,23 @@ const BINARY_DISTRIBUTIONS = [
|
|
|
13
15
|
{ packageName: '@sentry/cli-win32-i686', subpath: 'bin/sentry-cli.exe' },
|
|
14
16
|
];
|
|
15
17
|
|
|
18
|
+
/**
|
|
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.
|
|
21
|
+
*
|
|
22
|
+
* Without this, the binary can be detected as an asset and included by bundlers
|
|
23
|
+
* that use @vercel/nft.
|
|
24
|
+
*
|
|
25
|
+
* @returns {string} The path to the sentry-cli binary
|
|
26
|
+
*/
|
|
27
|
+
function getFallbackBinaryPath() {
|
|
28
|
+
const parts = [];
|
|
29
|
+
parts.push(__dirname);
|
|
30
|
+
parts.push('..');
|
|
31
|
+
parts.push(`sentry-cli${process.platform === 'win32' ? '.exe' : ''}`);
|
|
32
|
+
return path.resolve(...parts);
|
|
33
|
+
}
|
|
34
|
+
|
|
16
35
|
function getDistributionForThisPlatform() {
|
|
17
36
|
const arch = os.arch();
|
|
18
37
|
const platform = os.platform();
|
|
@@ -67,11 +86,25 @@ function getDistributionForThisPlatform() {
|
|
|
67
86
|
}
|
|
68
87
|
|
|
69
88
|
/**
|
|
70
|
-
*
|
|
71
|
-
*
|
|
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.
|
|
72
107
|
*
|
|
73
|
-
* Without this, the binary can be detected as an asset and included by bundlers
|
|
74
|
-
* that use @vercel/nft.
|
|
75
108
|
* @returns {string} The path to the sentry-cli binary
|
|
76
109
|
*/
|
|
77
110
|
function getBinaryPath() {
|
|
@@ -82,14 +115,13 @@ function getBinaryPath() {
|
|
|
82
115
|
const { packageName, subpath } = getDistributionForThisPlatform();
|
|
83
116
|
|
|
84
117
|
if (packageName === undefined) {
|
|
85
|
-
|
|
86
|
-
|
|
118
|
+
throwUnsupportedPlatformError();
|
|
119
|
+
}
|
|
87
120
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
);
|
|
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;
|
|
93
125
|
}
|
|
94
126
|
|
|
95
127
|
let compatibleBinaryPath;
|
|
@@ -115,7 +147,7 @@ To fix this, avoid copying the "node_modules" folder, and instead freshly instal
|
|
|
115
147
|
} else {
|
|
116
148
|
throw new Error(`Sentry CLI binary for this platform/architecture not found!
|
|
117
149
|
|
|
118
|
-
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" or "--omit=optional" flags. Sentry CLI needs the "optionalDependencies" feature in order to install its binary.`);
|
|
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.`);
|
|
119
151
|
}
|
|
120
152
|
}
|
|
121
153
|
|
|
@@ -123,10 +155,10 @@ It seems like none of the "@sentry/cli" package's optional dependencies got inst
|
|
|
123
155
|
}
|
|
124
156
|
|
|
125
157
|
/**
|
|
126
|
-
*
|
|
127
|
-
* @type {string}
|
|
158
|
+
* Will be used as the binary path when defined with `mockBinaryPath`.
|
|
159
|
+
* @type {string | undefined}
|
|
128
160
|
*/
|
|
129
|
-
let
|
|
161
|
+
let mockedBinaryPath;
|
|
130
162
|
|
|
131
163
|
/**
|
|
132
164
|
* Overrides the default binary path with a mock value, useful for testing.
|
|
@@ -136,7 +168,7 @@ let binaryPath = getBinaryPath();
|
|
|
136
168
|
*/
|
|
137
169
|
// TODO(v3): Remove this function
|
|
138
170
|
function mockBinaryPath(mockPath) {
|
|
139
|
-
|
|
171
|
+
mockedBinaryPath = mockPath;
|
|
140
172
|
}
|
|
141
173
|
|
|
142
174
|
/**
|
|
@@ -222,7 +254,7 @@ function prepareCommand(command, schema, options) {
|
|
|
222
254
|
* @returns {string}
|
|
223
255
|
*/
|
|
224
256
|
function getPath() {
|
|
225
|
-
return
|
|
257
|
+
return mockedBinaryPath !== undefined ? mockedBinaryPath : getBinaryPath();
|
|
226
258
|
}
|
|
227
259
|
|
|
228
260
|
/**
|
|
@@ -318,4 +350,7 @@ module.exports = {
|
|
|
318
350
|
mockBinaryPath,
|
|
319
351
|
prepareCommand,
|
|
320
352
|
serializeOptions,
|
|
353
|
+
getDistributionForThisPlatform,
|
|
354
|
+
throwUnsupportedPlatformError,
|
|
355
|
+
getFallbackBinaryPath,
|
|
321
356
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentry/cli",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.24.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/",
|
|
@@ -30,15 +30,16 @@
|
|
|
30
30
|
"prettier": "2.8.8"
|
|
31
31
|
},
|
|
32
32
|
"optionalDependencies": {
|
|
33
|
-
"@sentry/cli-darwin": "2.
|
|
34
|
-
"@sentry/cli-linux-arm": "2.
|
|
35
|
-
"@sentry/cli-linux-arm64": "2.
|
|
36
|
-
"@sentry/cli-linux-i686": "2.
|
|
37
|
-
"@sentry/cli-linux-x64": "2.
|
|
38
|
-
"@sentry/cli-win32-i686": "2.
|
|
39
|
-
"@sentry/cli-win32-x64": "2.
|
|
33
|
+
"@sentry/cli-darwin": "2.24.0",
|
|
34
|
+
"@sentry/cli-linux-arm": "2.24.0",
|
|
35
|
+
"@sentry/cli-linux-arm64": "2.24.0",
|
|
36
|
+
"@sentry/cli-linux-i686": "2.24.0",
|
|
37
|
+
"@sentry/cli-linux-x64": "2.24.0",
|
|
38
|
+
"@sentry/cli-win32-i686": "2.24.0",
|
|
39
|
+
"@sentry/cli-win32-x64": "2.24.0"
|
|
40
40
|
},
|
|
41
41
|
"scripts": {
|
|
42
|
+
"postinstall": "node ./scripts/install.js",
|
|
42
43
|
"fix": "npm-run-all fix:eslint fix:prettier",
|
|
43
44
|
"fix:eslint": "eslint --fix bin/* scripts/**/*.js js/**/*.js",
|
|
44
45
|
"fix:prettier": "prettier --write bin/* scripts/**/*.js js/**/*.js",
|
package/scripts/install.js
CHANGED
|
@@ -2,12 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
5
|
-
// TODO(v3): Remove this file
|
|
6
|
-
|
|
7
|
-
console.log(
|
|
8
|
-
'DEPRECATION NOTICE: The Sentry CLI install script has been deprecated. The package now uses "optionalDependencies" instead to install architecture-compatible binaries distributed over npm.'
|
|
9
|
-
);
|
|
10
|
-
|
|
11
5
|
const fs = require('fs');
|
|
12
6
|
const os = require('os');
|
|
13
7
|
const path = require('path');
|
|
@@ -198,7 +192,7 @@ function validateChecksum(tempPath, name) {
|
|
|
198
192
|
async function downloadBinary() {
|
|
199
193
|
const arch = os.arch();
|
|
200
194
|
const platform = os.platform();
|
|
201
|
-
const outputPath = helper.
|
|
195
|
+
const outputPath = helper.getFallbackBinaryPath();
|
|
202
196
|
|
|
203
197
|
if (process.env.SENTRYCLI_USE_LOCAL === '1') {
|
|
204
198
|
try {
|
|
@@ -323,14 +317,33 @@ if (process.env.SENTRYCLI_SKIP_DOWNLOAD === '1') {
|
|
|
323
317
|
process.exit(0);
|
|
324
318
|
}
|
|
325
319
|
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
320
|
+
const { packageName: distributionPackageName, subpath: distributionSubpath } =
|
|
321
|
+
helper.getDistributionForThisPlatform();
|
|
322
|
+
|
|
323
|
+
if (distributionPackageName === undefined) {
|
|
324
|
+
helper.throwUnsupportedPlatformError();
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
try {
|
|
328
|
+
require.resolve(`${distributionPackageName}/${distributionSubpath}`);
|
|
329
|
+
// If the `resolve` call succeeds it means a binary was installed successfully via optional dependencies so we can skip the manual postinstall download.
|
|
330
|
+
process.exit(0);
|
|
331
|
+
} catch (e) {
|
|
332
|
+
// Optional dependencies likely didn't get installed - proceed with fallback downloading manually
|
|
333
|
+
// Log message inspired by esbuild: https://github.com/evanw/esbuild/blob/914f6080c77cfe32a54888caa51ca6ea13873ce9/lib/npm/node-install.ts#L253
|
|
334
|
+
logger.log(
|
|
335
|
+
`Sentry CLI failed to locate the "${distributionPackageName}" package after installation!
|
|
336
|
+
|
|
337
|
+
This can happen if you use an option to disable optional dependencies during installation, like "--no-optional", "--ignore-optional", or "--omit=optional". Sentry CLI uses the "optionalDependencies" package.json feature to install the correct binary for your platform and operating system. This post-install script will now try to work around this by manually downloading the Sentry CLI binary from the Sentry CDN. If this fails, you need to remove the "--no-optional", "--ignore-optional", and "--omit=optional" flags for Sentry CLI to work.`
|
|
338
|
+
);
|
|
339
|
+
|
|
340
|
+
downloadBinary()
|
|
341
|
+
.then(() => checkVersion())
|
|
342
|
+
.then(() => {
|
|
343
|
+
process.exit(0);
|
|
344
|
+
})
|
|
345
|
+
.catch((e) => {
|
|
346
|
+
console.error(e);
|
|
347
|
+
process.exit(1);
|
|
348
|
+
});
|
|
349
|
+
}
|