@sentry/cli 2.8.0 → 2.9.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 +9 -0
- package/checksums.txt +9 -9
- package/js/helper.js +21 -10
- package/js/logger.js +14 -0
- package/package.json +11 -6
- package/scripts/install.js +25 -15
- package/scripts/test-vercel-nft.js +16 -0
package/README.md
CHANGED
|
@@ -97,6 +97,15 @@ docker pull getsentry/sentry-cli
|
|
|
97
97
|
docker run --rm -v $(pwd):/work getsentry/sentry-cli --help
|
|
98
98
|
```
|
|
99
99
|
|
|
100
|
+
Starting version _`2.8.0`_, in case you see `"error: config value 'safe.directory' was not found;"` message,
|
|
101
|
+
you also need to correctly set UID and GID of mounted volumes like so:
|
|
102
|
+
|
|
103
|
+
```sh
|
|
104
|
+
docker run --rm -u "$(id -u):$(id -g)" -v $(pwd):/work getsentry/sentry-cli --help
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
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.
|
|
108
|
+
|
|
100
109
|
## Compiling
|
|
101
110
|
|
|
102
111
|
In case you want to compile this yourself, you need to install at minimum the
|
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=1052d4eb071794634c1619850dd1cbdf91be9ffaa0e5ea5cb849eba0330ee729
|
|
2
|
+
sentry-cli-Darwin-universal=db65a1ae2ff0322f0fcdae8848151f32159c53f80372ff1da961277498fa2ed0
|
|
3
|
+
sentry-cli-Darwin-x86_64=05784bb587ab197c3c22c9928300ee4bb1943684a74154652c703472753d9b66
|
|
4
|
+
sentry-cli-Linux-aarch64=0130b100deabf8a391945253de6dd173c021e0922bf0e0d0327b4c4ec6d1000f
|
|
5
|
+
sentry-cli-Linux-armv7=602d0bb3dc29f99edd65646087ccabcfdfa5299bbea087b9371cd54801a756c3
|
|
6
|
+
sentry-cli-Linux-i686=ad782c3fb8e4c3d0bf1883ca27b29298c5c309d594ade73a65bcae55844c2b25
|
|
7
|
+
sentry-cli-Linux-x86_64=8d24e65b07eee362cd8e8b80a98b6029c66950c01cc58b4345f235fae2e243a4
|
|
8
|
+
sentry-cli-Windows-i686.exe=0897d6848aabe654faf6483511f40fdff26d847a20e6291ef29969cc5ef92c1e
|
|
9
|
+
sentry-cli-Windows-x86_64.exe=b5c67065525a37349bc68c33fe97faaf5ba8eba89849ef0986979928419ed10b
|
package/js/helper.js
CHANGED
|
@@ -1,21 +1,29 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
const path = require('path');
|
|
3
4
|
const childProcess = require('child_process');
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
|
-
*
|
|
7
|
-
* @
|
|
7
|
+
* This convoluted function resolves the path to the `sentry-cli` binary in a
|
|
8
|
+
* way that can't be analysed by @vercel/nft.
|
|
9
|
+
*
|
|
10
|
+
* Without this, the binary can be detected as an asset and included by bundlers
|
|
11
|
+
* that use @vercel/nft.
|
|
12
|
+
* @returns {string} The path to the sentry-cli binary
|
|
8
13
|
*/
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
);
|
|
14
|
+
function getBinaryPath() {
|
|
15
|
+
const parts = [];
|
|
16
|
+
parts.push(__dirname);
|
|
17
|
+
parts.push('..');
|
|
18
|
+
parts.push(`sentry-cli${process.platform === 'win32' ? '.exe' : ''}`);
|
|
19
|
+
return path.resolve(...parts);
|
|
20
|
+
}
|
|
12
21
|
|
|
13
22
|
/**
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* ref: https://github.com/getsentry/sentry-javascript/issues/3865
|
|
17
|
-
* ref: https://github.com/vercel/nft/issues/203
|
|
23
|
+
* Absolute path to the sentry-cli binary (platform dependent).
|
|
24
|
+
* @type {string}
|
|
18
25
|
*/
|
|
26
|
+
let binaryPath = getBinaryPath();
|
|
19
27
|
|
|
20
28
|
/**
|
|
21
29
|
* Overrides the default binary path with a mock value, useful for testing.
|
|
@@ -165,7 +173,10 @@ async function execute(args, live, silent, configFile, config = {}) {
|
|
|
165
173
|
if (config.customHeader) {
|
|
166
174
|
env.CUSTOM_HEADER = config.customHeader;
|
|
167
175
|
} else if (config.headers) {
|
|
168
|
-
const headers = Object.entries(config.headers).flatMap(([key, value]) => [
|
|
176
|
+
const headers = Object.entries(config.headers).flatMap(([key, value]) => [
|
|
177
|
+
'--header',
|
|
178
|
+
`${key}:${value}`,
|
|
179
|
+
]);
|
|
169
180
|
args = [...headers, ...args];
|
|
170
181
|
}
|
|
171
182
|
return new Promise((resolve, reject) => {
|
package/js/logger.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const format = require('util').format;
|
|
4
|
+
|
|
5
|
+
module.exports = class Logger {
|
|
6
|
+
constructor(stream) {
|
|
7
|
+
this.stream = stream;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
log() {
|
|
11
|
+
const message = format(...arguments);
|
|
12
|
+
this.stream.write(`[sentry-cli] ${message}\n`);
|
|
13
|
+
}
|
|
14
|
+
};
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentry/cli",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.9.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/",
|
|
7
7
|
"author": "Sentry",
|
|
8
8
|
"license": "BSD-3-Clause",
|
|
9
9
|
"engines": {
|
|
10
|
-
"node": ">=
|
|
10
|
+
"node": ">= 10"
|
|
11
11
|
},
|
|
12
12
|
"main": "js/index.js",
|
|
13
13
|
"types": "js/index.d.ts",
|
|
@@ -17,13 +17,13 @@
|
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"https-proxy-agent": "^5.0.0",
|
|
19
19
|
"node-fetch": "^2.6.7",
|
|
20
|
-
"npmlog": "^6.0.1",
|
|
21
20
|
"progress": "^2.0.3",
|
|
22
21
|
"proxy-from-env": "^1.1.0",
|
|
23
22
|
"which": "^2.0.2"
|
|
24
23
|
},
|
|
25
24
|
"devDependencies": {
|
|
26
|
-
"
|
|
25
|
+
"@vercel/nft": "^0.22.1",
|
|
26
|
+
"eslint": "^7.32.0",
|
|
27
27
|
"eslint-config-prettier": "^8.5.0",
|
|
28
28
|
"jest": "^27.5.1",
|
|
29
29
|
"npm-run-all": "^4.1.5",
|
|
@@ -34,11 +34,12 @@
|
|
|
34
34
|
"fix": "npm-run-all fix:eslint fix:prettier",
|
|
35
35
|
"fix:eslint": "eslint --fix bin/* scripts/**/*.js js/**/*.js",
|
|
36
36
|
"fix:prettier": "prettier --write bin/* scripts/**/*.js js/**/*.js",
|
|
37
|
-
"test": "npm-run-all test:jest test:eslint test:prettier",
|
|
37
|
+
"test": "npm-run-all test:jest test:eslint test:prettier test:vercel-nft",
|
|
38
38
|
"test:jest": "jest",
|
|
39
39
|
"test:watch": "jest --watch --notify",
|
|
40
40
|
"test:eslint": "eslint bin/* scripts/**/*.js js/**/*.js",
|
|
41
|
-
"test:prettier": "prettier --check bin/* scripts/**/*.js js/**/*.js"
|
|
41
|
+
"test:prettier": "prettier --check bin/* scripts/**/*.js js/**/*.js",
|
|
42
|
+
"test:vercel-nft": "node scripts/test-vercel-nft.js"
|
|
42
43
|
},
|
|
43
44
|
"jest": {
|
|
44
45
|
"collectCoverage": true,
|
|
@@ -46,5 +47,9 @@
|
|
|
46
47
|
"testPathIgnorePatterns": [
|
|
47
48
|
"<rootDir>/src"
|
|
48
49
|
]
|
|
50
|
+
},
|
|
51
|
+
"volta": {
|
|
52
|
+
"node": "10.24.1",
|
|
53
|
+
"yarn": "1.22.19"
|
|
49
54
|
}
|
|
50
55
|
}
|
package/scripts/install.js
CHANGED
|
@@ -15,11 +15,13 @@ const fetch = require('node-fetch');
|
|
|
15
15
|
const HttpsProxyAgent = require('https-proxy-agent');
|
|
16
16
|
const ProgressBar = require('progress');
|
|
17
17
|
const Proxy = require('proxy-from-env');
|
|
18
|
-
const npmLog = require('npmlog');
|
|
19
18
|
const which = require('which');
|
|
20
19
|
|
|
21
20
|
const helper = require('../js/helper');
|
|
22
21
|
const pkgInfo = require('../package.json');
|
|
22
|
+
const Logger = require('../js/logger');
|
|
23
|
+
|
|
24
|
+
const logger = new Logger(getLogStream('stderr'));
|
|
23
25
|
|
|
24
26
|
const CDN_URL =
|
|
25
27
|
process.env.SENTRYCLI_LOCAL_CDNURL ||
|
|
@@ -157,14 +159,14 @@ function validateChecksum(tempPath, name) {
|
|
|
157
159
|
}
|
|
158
160
|
}
|
|
159
161
|
} catch (e) {
|
|
160
|
-
|
|
162
|
+
logger.log(
|
|
161
163
|
'Checksums are generated when the package is published to npm. They are not available directly in the source repository. Skipping validation.'
|
|
162
164
|
);
|
|
163
165
|
return;
|
|
164
166
|
}
|
|
165
167
|
|
|
166
168
|
if (!storedHash) {
|
|
167
|
-
|
|
169
|
+
logger.log(`Checksum for ${name} not found, skipping validation.`);
|
|
168
170
|
return;
|
|
169
171
|
}
|
|
170
172
|
|
|
@@ -176,7 +178,7 @@ function validateChecksum(tempPath, name) {
|
|
|
176
178
|
`Checksum validation for ${name} failed.\nExpected: ${storedHash}\nReceived: ${currentHash}`
|
|
177
179
|
);
|
|
178
180
|
} else {
|
|
179
|
-
|
|
181
|
+
logger.log('Checksum validation passed.');
|
|
180
182
|
}
|
|
181
183
|
}
|
|
182
184
|
|
|
@@ -188,7 +190,7 @@ async function downloadBinary() {
|
|
|
188
190
|
if (process.env.SENTRYCLI_USE_LOCAL === '1') {
|
|
189
191
|
try {
|
|
190
192
|
const binPath = which.sync('sentry-cli');
|
|
191
|
-
|
|
193
|
+
logger.log(`Using local binary: ${binPath}`);
|
|
192
194
|
fs.copyFileSync(binPath, outputPath);
|
|
193
195
|
return Promise.resolve();
|
|
194
196
|
} catch (e) {
|
|
@@ -206,7 +208,7 @@ async function downloadBinary() {
|
|
|
206
208
|
|
|
207
209
|
const cachedPath = getCachedPath(downloadUrl);
|
|
208
210
|
if (fs.existsSync(cachedPath)) {
|
|
209
|
-
|
|
211
|
+
logger.log(`Using cached binary: ${cachedPath}`);
|
|
210
212
|
fs.copyFileSync(cachedPath, outputPath);
|
|
211
213
|
return;
|
|
212
214
|
}
|
|
@@ -214,10 +216,10 @@ async function downloadBinary() {
|
|
|
214
216
|
const proxyUrl = Proxy.getProxyForUrl(downloadUrl);
|
|
215
217
|
const agent = proxyUrl ? new HttpsProxyAgent(proxyUrl) : null;
|
|
216
218
|
|
|
217
|
-
|
|
219
|
+
logger.log(`Downloading from ${downloadUrl}`);
|
|
218
220
|
|
|
219
221
|
if (proxyUrl) {
|
|
220
|
-
|
|
222
|
+
logger.log(`Using proxy URL: ${proxyUrl}`);
|
|
221
223
|
}
|
|
222
224
|
|
|
223
225
|
let response;
|
|
@@ -258,19 +260,29 @@ async function downloadBinary() {
|
|
|
258
260
|
decompressor = new stream.PassThrough();
|
|
259
261
|
}
|
|
260
262
|
const name = downloadUrl.match(/.*\/(.*?)$/)[1];
|
|
261
|
-
|
|
262
|
-
const
|
|
263
|
+
let downloadedBytes = 0;
|
|
264
|
+
const totalBytes = parseInt(response.headers.get('content-length'), 10);
|
|
265
|
+
const progressBar = createProgressBar(name, totalBytes);
|
|
263
266
|
const tempPath = getTempFile(cachedPath);
|
|
264
267
|
fs.mkdirSync(path.dirname(tempPath), { recursive: true });
|
|
265
268
|
|
|
266
269
|
await new Promise((resolve, reject) => {
|
|
267
270
|
response.body
|
|
268
271
|
.on('error', (e) => reject(e))
|
|
269
|
-
.on('data', (chunk) =>
|
|
272
|
+
.on('data', (chunk) => {
|
|
273
|
+
downloadedBytes += chunk.length;
|
|
274
|
+
progressBar.tick(chunk.length);
|
|
275
|
+
})
|
|
270
276
|
.pipe(decompressor)
|
|
271
277
|
.pipe(fs.createWriteStream(tempPath, { mode: '0755' }))
|
|
272
278
|
.on('error', (e) => reject(e))
|
|
273
|
-
.on('close', () =>
|
|
279
|
+
.on('close', () => {
|
|
280
|
+
if (downloadedBytes >= totalBytes) {
|
|
281
|
+
resolve();
|
|
282
|
+
} else {
|
|
283
|
+
reject(new Error('connection interrupted'));
|
|
284
|
+
}
|
|
285
|
+
});
|
|
274
286
|
});
|
|
275
287
|
|
|
276
288
|
if (process.env.SENTRYCLI_SKIP_CHECKSUM_VALIDATION !== '1') {
|
|
@@ -306,10 +318,8 @@ if (process.env.SENTRYCLI_LOCAL_CDNURL) {
|
|
|
306
318
|
process.on('exit', () => server.close());
|
|
307
319
|
}
|
|
308
320
|
|
|
309
|
-
npmLog.stream = getLogStream('stderr');
|
|
310
|
-
|
|
311
321
|
if (process.env.SENTRYCLI_SKIP_DOWNLOAD === '1') {
|
|
312
|
-
|
|
322
|
+
logger.log(`Skipping download because SENTRYCLI_SKIP_DOWNLOAD=1 detected.`);
|
|
313
323
|
process.exit(0);
|
|
314
324
|
}
|
|
315
325
|
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
const { nodeFileTrace } = require('@vercel/nft');
|
|
2
|
+
|
|
3
|
+
const entryPoint = require.resolve('..');
|
|
4
|
+
|
|
5
|
+
// Trace the module entrypoint
|
|
6
|
+
nodeFileTrace([entryPoint]).then((result) => {
|
|
7
|
+
console.log('@vercel/nft traced dependencies:', Array.from(result.fileList));
|
|
8
|
+
|
|
9
|
+
// If either binary is picked up, fail the test
|
|
10
|
+
if (result.fileList.has('sentry-cli') || result.fileList.has('sentry-cli.exe')) {
|
|
11
|
+
console.error('ERROR: The sentry-cli binary should not be found by @vercel/nft');
|
|
12
|
+
process.exit(-1);
|
|
13
|
+
} else {
|
|
14
|
+
console.log('The sentry-cli binary was not traced by @vercel/nft');
|
|
15
|
+
}
|
|
16
|
+
});
|