@sentry/cli
Advanced tools
Comparing version 2.23.1 to 2.23.2
@@ -1,9 +0,9 @@ | ||
sentry-cli-Darwin-arm64=80db99473013abbc312a6160c4c8eeac110d573560e632c5da9444fe44ae683d | ||
sentry-cli-Darwin-universal=21af0cd6375e7b0686b5d4808ea6035b0eaf8b5c64b8e024f7da87ec2aa986a3 | ||
sentry-cli-Darwin-x86_64=6b3b2efd7f2e2fce2eef3a493676895fed90b5677dff780da813a2748f423ce9 | ||
sentry-cli-Linux-aarch64=c780829bef1e4f3fde18f51adc747f4497077677289bae07bf1c0427ba9c1196 | ||
sentry-cli-Linux-armv7=0e95c542dac19cd4077e20f506be0bec9a56dccd0dd08849ad63bf6cb77644e2 | ||
sentry-cli-Linux-i686=6879f208ab9bde5417a5c1fa9ba113ed9ebaae4f3ee800c4155ff8dba9e2a82e | ||
sentry-cli-Linux-x86_64=e01de8640c4f7c19c8e9670d0269528beccbf196b2be32f9380b3f69eea51ac8 | ||
sentry-cli-Windows-i686.exe=cdc09bff3d2958315f056fc87ebc365bca2663e966d116a777b7d599219bec47 | ||
sentry-cli-Windows-x86_64.exe=8d877c6b31a87ce268ffebc2b071389f22ab642edfc5a42f2e4122e127325fe6 | ||
sentry-cli-Darwin-arm64=2661e69e85fde9b8c1dc6e6bf9f9a61abb7a8b6986df3ba19abf00c0f681aeb9 | ||
sentry-cli-Darwin-universal=b8a1f6a855400e483a51e3c9efb2fc5c256879d88ded8cd2e2f97c5a3a0ee086 | ||
sentry-cli-Darwin-x86_64=33c9718a63ee620fb5716674c9dfffa4d82636918202c8e054f5185167a1b188 | ||
sentry-cli-Linux-aarch64=0caaa6ef000667a584ee4308a2c151ee9fb586d7d2ceef1f64837043e3b8bf79 | ||
sentry-cli-Linux-armv7=83d95451a7c2e788a806531bd9d0ccf7e6e6292f9e74cd771021bf03abc584da | ||
sentry-cli-Linux-i686=d92e9d461db1bf0995abd48251490969ab955dc8a3bc525cf72d717a56fffac6 | ||
sentry-cli-Linux-x86_64=ce0b62603da9fdc3d37aeb1f2af1b04c82efaf32a8d36114c950d7dc32ed11a8 | ||
sentry-cli-Windows-i686.exe=392b59d3acb4d81504bb501a90ec0397a51cd1e090c897c1a10b274355585abd | ||
sentry-cli-Windows-x86_64.exe=8fdafca0a16eac1ba633549beceb569f5e63c1ec1f3fad4f6b3b539e23620b1e |
'use strict'; | ||
const os = require('os'); | ||
const path = require('path'); | ||
const fs = require('fs'); | ||
const childProcess = require('child_process'); | ||
@@ -16,2 +18,19 @@ | ||
/** | ||
* This convoluted function resolves the path to the manually downloaded fallback | ||
* `sentry-cli` binary in a way that can't be analysed by @vercel/nft. | ||
* | ||
* Without this, the binary can be detected as an asset and included by bundlers | ||
* that use @vercel/nft. | ||
* | ||
* @returns {string} The path to the sentry-cli binary | ||
*/ | ||
function getFallbackBinaryPath() { | ||
const parts = []; | ||
parts.push(__dirname); | ||
parts.push('..'); | ||
parts.push(`sentry-cli${process.platform === 'win32' ? '.exe' : ''}`); | ||
return path.resolve(...parts); | ||
} | ||
function getDistributionForThisPlatform() { | ||
@@ -71,7 +90,21 @@ const arch = os.arch(); | ||
/** | ||
* This convoluted function resolves the path to the `sentry-cli` binary in a | ||
* way that can't be analysed by @vercel/nft. | ||
* Throws an error with a message stating that Sentry CLI doesn't support the current platform. | ||
* | ||
* Without this, the binary can be detected as an asset and included by bundlers | ||
* that use @vercel/nft. | ||
* @returns {never} nothing. It throws. | ||
*/ | ||
function throwUnsupportedPlatformError() { | ||
throw new Error( | ||
`Unsupported operating system or architecture! Sentry CLI does not work on this architecture. | ||
Sentry CLI supports: | ||
- Darwin (macOS) | ||
- Linux and FreeBSD on x64, x86, ia32, arm64, and arm architectures | ||
- Windows x64, x86, and ia32 architectures` | ||
); | ||
} | ||
/** | ||
* Tries to find the installed Sentry CLI binary - either by looking into the relevant | ||
* optional dependencies or by trying to resolve the fallback binary. | ||
* | ||
* @returns {string} The path to the sentry-cli binary | ||
@@ -87,10 +120,9 @@ */ | ||
if (packageName === undefined) { | ||
throw new Error( | ||
`Unsupported operating system or architecture! Sentry CLI does not work on this architecture. | ||
throwUnsupportedPlatformError(); | ||
} | ||
Sentry CLI supports: | ||
- Darwin (macOS) | ||
- Linux and FreeBSD on x64, x86, ia32, arm64, and arm architectures | ||
- Windows x64, x86, and ia32 architectures` | ||
); | ||
let fallbackBinaryPath = getFallbackBinaryPath(); | ||
if (fs.existsSync(fallbackBinaryPath)) { | ||
// Since the fallback got installed, the optional dependencies likely didn't get installed, so we just default to the fallback. | ||
return fallbackBinaryPath; | ||
} | ||
@@ -121,3 +153,3 @@ | ||
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.`); | ||
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.`); | ||
} | ||
@@ -130,6 +162,6 @@ } | ||
/** | ||
* Absolute path to the sentry-cli binary (platform dependent). | ||
* @type {string} | ||
* Will be used as the binary path when defined with `mockBinaryPath`. | ||
* @type {string | undefined} | ||
*/ | ||
let binaryPath = getBinaryPath(); | ||
let mockedBinaryPath; | ||
@@ -144,3 +176,3 @@ /** | ||
function mockBinaryPath(mockPath) { | ||
binaryPath = mockPath; | ||
mockedBinaryPath = mockPath; | ||
} | ||
@@ -231,3 +263,3 @@ | ||
function getPath() { | ||
return binaryPath; | ||
return mockedBinaryPath !== undefined ? mockedBinaryPath : getBinaryPath(); | ||
} | ||
@@ -328,2 +360,5 @@ | ||
serializeOptions, | ||
getDistributionForThisPlatform, | ||
throwUnsupportedPlatformError, | ||
getFallbackBinaryPath, | ||
}; |
{ | ||
"name": "@sentry/cli", | ||
"version": "2.23.1", | ||
"version": "2.23.2", | ||
"description": "A command line utility to work with Sentry. https://docs.sentry.io/hosted/learn/cli/", | ||
@@ -33,11 +33,12 @@ "repository": "git://github.com/getsentry/sentry-cli.git", | ||
"optionalDependencies": { | ||
"@sentry/cli-darwin": "2.23.1", | ||
"@sentry/cli-linux-arm": "2.23.1", | ||
"@sentry/cli-linux-arm64": "2.23.1", | ||
"@sentry/cli-linux-i686": "2.23.1", | ||
"@sentry/cli-linux-x64": "2.23.1", | ||
"@sentry/cli-win32-i686": "2.23.1", | ||
"@sentry/cli-win32-x64": "2.23.1" | ||
"@sentry/cli-darwin": "2.23.2", | ||
"@sentry/cli-linux-arm": "2.23.2", | ||
"@sentry/cli-linux-arm64": "2.23.2", | ||
"@sentry/cli-linux-i686": "2.23.2", | ||
"@sentry/cli-linux-x64": "2.23.2", | ||
"@sentry/cli-win32-i686": "2.23.2", | ||
"@sentry/cli-win32-x64": "2.23.2" | ||
}, | ||
"scripts": { | ||
"postinstall": "node ./scripts/install.js", | ||
"fix": "npm-run-all fix:eslint fix:prettier", | ||
@@ -44,0 +45,0 @@ "fix:eslint": "eslint --fix bin/* scripts/**/*.js js/**/*.js", |
@@ -5,8 +5,2 @@ #!/usr/bin/env node | ||
// TODO(v3): Remove this file | ||
console.log( | ||
'DEPRECATION NOTICE: The Sentry CLI install script has been deprecated. The package now uses "optionalDependencies" instead to install architecture-compatible binaries distributed over npm.' | ||
); | ||
const fs = require('fs'); | ||
@@ -202,3 +196,3 @@ const os = require('os'); | ||
const platform = os.platform(); | ||
const outputPath = helper.getPath(); | ||
const outputPath = helper.getFallbackBinaryPath(); | ||
@@ -328,12 +322,31 @@ if (process.env.SENTRYCLI_USE_LOCAL === '1') { | ||
(async () => { | ||
try { | ||
await downloadBinary(); | ||
await checkVersion(); | ||
process.exit(0); | ||
} catch (e) { | ||
// eslint-disable-next-line no-console | ||
console.error(e.toString()); | ||
process.exit(1); | ||
} | ||
})(); | ||
const { packageName: distributionPackageName, subpath: distributionSubpath } = | ||
helper.getDistributionForThisPlatform(); | ||
if (distributionPackageName === undefined) { | ||
helper.throwUnsupportedPlatformError(); | ||
} | ||
try { | ||
require.resolve(`${distributionPackageName}/${distributionSubpath}`); | ||
// If the `resolve` call succeeds it means a binary was installed successfully via optional dependencies so we can skip the manual postinstall download. | ||
process.exit(0); | ||
} catch (e) { | ||
// Optional dependencies likely didn't get installed - proceed with fallback downloading manually | ||
// Log message inspired by esbuild: https://github.com/evanw/esbuild/blob/914f6080c77cfe32a54888caa51ca6ea13873ce9/lib/npm/node-install.ts#L253 | ||
logger.log( | ||
`Sentry CLI failed to locate the "${distributionPackageName}" package after installation! | ||
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.` | ||
); | ||
downloadBinary() | ||
.then(() => checkVersion()) | ||
.then(() => { | ||
process.exit(0); | ||
}) | ||
.catch((e) => { | ||
console.error(e); | ||
process.exit(1); | ||
}); | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Install scripts
Supply chain riskInstall scripts are run when the package is installed. The majority of malware in npm is hidden in install scripts.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
63711
1254
1
24