@sentry/cli
Advanced tools
Comparing version 1.28.4 to 1.29.0
# Changelog | ||
## sentry-cli 1.29.0 | ||
* **BREAKING**: Drop support for Node 0.12. Please pin version `1.28.4` or install sentry-cli using a [different method](https://docs.sentry.io/learn/cli/installation/#automatic-installation) if you still require Node 0.12. | ||
* Fix NPM installation behind proxies | ||
* Remove console output when using the JS interface | ||
## sentry-cli 1.28.4 | ||
@@ -4,0 +10,0 @@ |
131
js/helper.js
'use strict'; | ||
/* global Promise */ | ||
const os = require('os'); | ||
const path = require('path'); | ||
const childProcess = require('child_process'); | ||
var os = require('os'); | ||
var path = require('path'); | ||
var childProcess = require('child_process'); | ||
const binaryPath = | ||
os.platform() === 'win32' | ||
? path.resolve(__dirname, '..\\bin\\sentry-cli.exe') | ||
: path.resolve(__dirname, '../sentry-cli'); | ||
function transformOption(option, values) { | ||
if (Array.isArray(values)) { | ||
return values | ||
.map(function(value) { | ||
return [option.param, value]; | ||
}) | ||
.reduce(function(acc, value) { | ||
return acc.concat(value); | ||
}, []); | ||
return values.reduce((acc, value) => acc.concat([option.param, value]), []); | ||
} | ||
return [option.param, values]; | ||
} | ||
var binaryPath = | ||
os.platform() === 'win32' | ||
? path.resolve(__dirname, '..\\bin\\sentry-cli.exe') | ||
: path.resolve(__dirname, '../sentry-cli'); | ||
function normalizeOptions(commandOptions, options) { | ||
return Object.keys(commandOptions).reduce((newOptions, sourceMapOption) => { | ||
const paramValue = options[sourceMapOption]; | ||
if (paramValue === undefined) { | ||
return newOptions; | ||
} | ||
module.exports = { | ||
normalizeOptions: function(commandOptions, options) { | ||
return Object.keys(commandOptions).reduce(function(newOptions, sourceMapOption) { | ||
var paramValue = options[sourceMapOption]; | ||
if (typeof paramValue === 'undefined') { | ||
return newOptions; | ||
const paramType = commandOptions[sourceMapOption].type; | ||
const paramName = commandOptions[sourceMapOption].param; | ||
if (paramType === 'array') { | ||
if (!Array.isArray(paramValue)) { | ||
throw new Error(`${sourceMapOption} should be an array`); | ||
} | ||
var paramType = commandOptions[sourceMapOption].type; | ||
var paramName = commandOptions[sourceMapOption].param; | ||
return newOptions.concat( | ||
transformOption(commandOptions[sourceMapOption], paramValue) | ||
); | ||
} | ||
if (paramType === 'array') { | ||
if (!Array.isArray(paramValue)) { | ||
throw new Error(sourceMapOption + ' should be an array'); | ||
} | ||
return newOptions.concat( | ||
transformOption(commandOptions[sourceMapOption], paramValue) | ||
); | ||
} else if (paramType === 'boolean' || paramType === 'inverted-boolean') { | ||
if (typeof paramValue !== 'boolean') { | ||
throw new Error(sourceMapOption + ' should be a bool'); | ||
} | ||
if (paramType === 'boolean' && paramValue) { | ||
return newOptions.concat([paramName]); | ||
} else if (paramType === 'inverted-boolean' && paramValue === false) { | ||
return newOptions.concat([paramName]); | ||
} | ||
return newOptions; | ||
if (paramType === 'boolean' || paramType === 'inverted-boolean') { | ||
if (typeof paramValue !== 'boolean') { | ||
throw new Error(`${sourceMapOption} should be a bool`); | ||
} | ||
return newOptions.concat(paramName, paramValue); | ||
}, []); | ||
}, | ||
prepareCommand: function(command, commandOptions, options) { | ||
return command.concat(this.normalizeOptions(commandOptions || {}, options || {})); | ||
}, | ||
if (paramType === 'boolean' && paramValue) { | ||
return newOptions.concat([paramName]); | ||
} | ||
getPath: function() { | ||
if (process.env.NODE_ENV === 'test') { | ||
return path.resolve(__dirname, '__mocks__/sentry-cli'); | ||
if (paramType === 'inverted-boolean' && paramValue === false) { | ||
return newOptions.concat([paramName]); | ||
} | ||
return newOptions; | ||
} | ||
return binaryPath; | ||
}, | ||
execute: function(args) { | ||
var env = Object.assign({}, process.env); | ||
var that = this; | ||
return new Promise(function(resolve, reject) { | ||
childProcess.execFile(that.getPath(), args, { env: env }, function(err, stdout) { | ||
if (err) return reject(err); | ||
// eslint-disable-next-line | ||
console.log(stdout); | ||
return resolve(stdout); | ||
}); | ||
return newOptions.concat(paramName, paramValue); | ||
}, []); | ||
} | ||
function prepareCommand(command, commandOptions, options) { | ||
return command.concat(normalizeOptions(commandOptions || {}, options || {})); | ||
} | ||
function getPath() { | ||
if (process.env.NODE_ENV === 'test') { | ||
return path.resolve(__dirname, '__mocks__/sentry-cli'); | ||
} | ||
return binaryPath; | ||
} | ||
function execute(args) { | ||
const env = Object.assign({}, process.env); | ||
return new Promise((resolve, reject) => { | ||
childProcess.execFile(getPath(), args, { env }, (err, stdout) => { | ||
if (err) { | ||
reject(err); | ||
} else { | ||
resolve(stdout); | ||
} | ||
}); | ||
} | ||
}); | ||
} | ||
module.exports = { | ||
normalizeOptions, | ||
prepareCommand, | ||
getPath, | ||
execute, | ||
}; |
'use strict'; | ||
var pkgInfo = require('../package.json'); | ||
var helper = require('./helper'); | ||
const pkgInfo = require('../package.json'); | ||
const helper = require('./helper'); | ||
function SentryCli(configFile) { | ||
if (typeof configFile === 'string') process.env.SENTRY_PROPERTIES = configFile; | ||
} | ||
class SentryCli { | ||
constructor(configFile) { | ||
if (typeof configFile === 'string') { | ||
process.env.SENTRY_PROPERTIES = configFile; | ||
} | ||
} | ||
SentryCli.prototype.getConfigStatus = function() { | ||
return helper.execute(['info', '--config-status-json']); | ||
}; | ||
static getVersion() { | ||
return pkgInfo.version; | ||
} | ||
SentryCli.getVersion = function() { | ||
return pkgInfo.version; | ||
}; | ||
static getPath() { | ||
return helper.getPath(); | ||
} | ||
} | ||
SentryCli.getPath = function() { | ||
return helper.getPath(); | ||
}; | ||
SentryCli.prototype.releases = require('./releases'); | ||
module.exports = SentryCli; |
'use strict'; | ||
/* global Promise */ | ||
const helper = require('../helper'); | ||
var helper = require('../helper'); | ||
const DEFAULT_IGNORE = ['node_modules']; | ||
const SOURCEMAPS_OPTIONS = require('./options/uploadSourcemaps'); | ||
var DEFAULT_IGNORE = ['node_modules']; | ||
var SOURCEMAPS_OPTIONS = require('./options/uploadSourcemaps'); | ||
module.exports = { | ||
new: function(release) { | ||
new(release) { | ||
return helper.execute(['releases', 'new', release]); | ||
}, | ||
finalize: function(release) { | ||
finalize(release) { | ||
return helper.execute(['releases', 'finalize', release]); | ||
}, | ||
proposeVersion: function() { | ||
proposeVersion() { | ||
return helper.execute(['releases', 'propose-version']); | ||
}, | ||
uploadSourceMaps: function(release, options) { | ||
if (typeof options === 'undefined' || typeof options.include === 'undefined') { | ||
uploadSourceMaps(release, options) { | ||
if (!options || !options.include) { | ||
throw new Error('options.include must be a vaild path(s)'); | ||
} | ||
return Promise.all( | ||
options.include.map(function(sourcemapPath) { | ||
var command = ['releases', 'files', release, 'upload-sourcemaps', sourcemapPath]; | ||
var newOptions = Object.assign({}, options); | ||
options.include.map(sourcemapPath => { | ||
const args = ['releases', 'files', release, 'upload-sourcemaps', sourcemapPath]; | ||
const newOptions = Object.assign({}, options); | ||
@@ -33,8 +35,6 @@ if (!newOptions.ignoreFile && !newOptions.ignore) { | ||
return helper.execute( | ||
helper.prepareCommand(command, SOURCEMAPS_OPTIONS, options) | ||
); | ||
}, this) | ||
return helper.execute(helper.prepareCommand(args, SOURCEMAPS_OPTIONS, options)); | ||
}) | ||
); | ||
} | ||
}, | ||
}; |
module.exports = { | ||
ignore: { | ||
param: '--ignore', | ||
type: 'array' | ||
type: 'array', | ||
}, | ||
ignoreFile: { | ||
param: '--ignore-file', | ||
type: 'string' | ||
type: 'string', | ||
}, | ||
rewrite: { | ||
param: '--rewrite', | ||
type: 'boolean' | ||
type: 'boolean', | ||
}, | ||
sourceMapReference: { | ||
param: '--no-sourcemap-reference', | ||
type: 'inverted-boolean' | ||
type: 'inverted-boolean', | ||
}, | ||
stripPrefix: { | ||
param: '--strip-prefix', | ||
type: 'array' | ||
type: 'array', | ||
}, | ||
stripCommonPrefix: { | ||
param: '--strip-common-prefix', | ||
type: 'array' | ||
type: 'array', | ||
}, | ||
validate: { | ||
param: '--validate', | ||
type: 'boolean' | ||
type: 'boolean', | ||
}, | ||
urlPrefix: { | ||
param: '--url-prefix', | ||
type: 'string' | ||
type: 'string', | ||
}, | ||
ext: { | ||
param: '--ext', | ||
type: 'string' | ||
} | ||
type: 'string', | ||
}, | ||
}; |
{ | ||
"name": "@sentry/cli", | ||
"version": "1.28.4", | ||
"version": "1.29.0", | ||
"description": "A command line utility to work with Sentry. https://docs.sentry.io/hosted/learn/cli/", | ||
"scripts": { | ||
"install": "node ./bin/install-sentry-cli", | ||
"install": "node scripts/install.js", | ||
"fix:eslint": "eslint --fix 'bin/*' js", | ||
@@ -11,4 +11,4 @@ "fix:prettier": "prettier --write 'bin/*' 'js/**/*.js'", | ||
"test:jest": "jest", | ||
"test:eslint": "eslint 'bin/*' js", | ||
"test:prettier": "prettier-check 'bin/*' 'js/**/*.js'", | ||
"test:eslint": "eslint bin scripts js", | ||
"test:prettier": "prettier-check 'bin/*' 'scripts/*.js' 'js/**/*.js'", | ||
"test": "npm-run-all test:jest test:eslint test:prettier", | ||
@@ -34,3 +34,6 @@ "test:watch": "jest --watch --notify" | ||
"dependencies": { | ||
"progress": "2.0.0" | ||
"https-proxy-agent": "^2.1.1", | ||
"node-fetch": "^1.7.3", | ||
"progress": "2.0.0", | ||
"proxy-from-env": "^1.0.0" | ||
}, | ||
@@ -40,12 +43,13 @@ "homepage": "https://docs.sentry.io/hosted/learn/cli/", | ||
"devDependencies": { | ||
"eslint": "^4.12.1", | ||
"eslint-config-es5": "^0.5.0", | ||
"eslint": "^4.16.0", | ||
"eslint-config-airbnb-base": "^12.1.0", | ||
"eslint-config-prettier": "^2.9.0", | ||
"eslint-plugin-import": "^2.8.0", | ||
"jest": "^21.2.1", | ||
"npm-run-all": "^4.1.2", | ||
"prettier": "^1.9.0", | ||
"prettier": "^1.10.2", | ||
"prettier-check": "^2.0.0" | ||
}, | ||
"engines": { | ||
"node": ">= 0.12.18" | ||
"node": ">= 4.5.0" | ||
}, | ||
@@ -52,0 +56,0 @@ "jest": { |
@@ -64,2 +64,6 @@ <p align="center"> | ||
If you're installing the CLI with NPM from behind a proxy, the install script will | ||
use either NPM's configured HTTPS proxy server, or the value from your `HTTPS_PROXY` | ||
environment variable. | ||
### Homebrew | ||
@@ -66,0 +70,0 @@ |
Sorry, the diff of this file is not supported yet
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 3 instances in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 4 instances in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
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
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
32744
11
282
113
4
8
10
5
+ Addedhttps-proxy-agent@^2.1.1
+ Addednode-fetch@^1.7.3
+ Addedproxy-from-env@^1.0.0
+ Addedagent-base@4.3.0(transitive)
+ Addeddebug@3.2.7(transitive)
+ Addedencoding@0.1.13(transitive)
+ Addedes6-promise@4.2.8(transitive)
+ Addedes6-promisify@5.0.0(transitive)
+ Addedhttps-proxy-agent@2.2.4(transitive)
+ Addediconv-lite@0.6.3(transitive)
+ Addedis-stream@1.1.0(transitive)
+ Addedms@2.1.3(transitive)
+ Addednode-fetch@1.7.3(transitive)
+ Addedproxy-from-env@1.1.0(transitive)
+ Addedsafer-buffer@2.1.2(transitive)