@sentry/cli
Advanced tools
Comparing version 1.26.1 to 1.27.0
# Changelog | ||
## sentry-cli 1.27.0 | ||
* Support all options in the JS binding for `upload-sourcemaps`, courtesy of @montogeek | ||
* Enable automatic IP addresses when sending events with `send-event`, courtesy of @kirkins | ||
* No longer require secret keys to send events with `send-event` | ||
* Improve and speed up debug symbol handling in `upload-dsym` | ||
## sentry-cli 1.26.1 | ||
@@ -4,0 +11,0 @@ |
105
js/index.js
@@ -11,2 +11,40 @@ 'use strict'; | ||
var DEFAULT_IGNORE = ['node_modules']; | ||
var SOURCEMAPS_OPTIONS = { | ||
ignore: { | ||
param: '--ignore', | ||
type: 'array' | ||
}, | ||
ignoreFile: { | ||
param: '--ignore-file', | ||
type: 'string' | ||
}, | ||
rewrite: { | ||
param: '--rewrite', | ||
type: 'boolean' | ||
}, | ||
sourceMapReference: { | ||
param: '--no-sourcemap-reference', | ||
type: 'inverted-boolean' | ||
}, | ||
stripPrefix: { | ||
param: '--strip-prefix', | ||
type: 'array' | ||
}, | ||
stripCommonPrefix: { | ||
param: '--strip-common-prefix', | ||
type: 'array' | ||
}, | ||
validate: { | ||
param: '--validate', | ||
type: 'boolean' | ||
}, | ||
urlPrefix: { | ||
param: '--url-prefix', | ||
type: 'string' | ||
}, | ||
ext: { | ||
param: '--ext', | ||
type: 'string' | ||
} | ||
}; | ||
@@ -18,7 +56,7 @@ var binaryPath = | ||
function transformIgnore(ignore) { | ||
if (Array.isArray(ignore)) { | ||
return ignore | ||
function transformOption(option, values) { | ||
if (Array.isArray(values)) { | ||
return values | ||
.map(function(value) { | ||
return ['--ignore', value]; | ||
return [option.param, value]; | ||
}) | ||
@@ -29,5 +67,37 @@ .reduce(function(acc, value) { | ||
} | ||
return ['--ignore', ignore]; | ||
return [option.param, values]; | ||
} | ||
function normalizeOptions(options) { | ||
return Object.keys(SOURCEMAPS_OPTIONS).reduce(function(newOptions, sourceMapOption) { | ||
var paramValue = options[sourceMapOption]; | ||
if (paramValue === undefined) { | ||
return newOptions; | ||
} | ||
var paramType = SOURCEMAPS_OPTIONS[sourceMapOption].type; | ||
var paramName = SOURCEMAPS_OPTIONS[sourceMapOption].param; | ||
if (paramType === 'array') { | ||
if (!Array.isArray(paramValue)) { | ||
throw new Error(sourceMapOption + ' should be an array'); | ||
} | ||
return newOptions.concat( | ||
transformOption(SOURCEMAPS_OPTIONS[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; | ||
} | ||
return newOptions.concat(paramName, paramValue); | ||
}, []); | ||
} | ||
function SentryCli(configFile) { | ||
@@ -70,21 +140,18 @@ this.env = {}; | ||
'upload-sourcemaps', | ||
sourcemapPath, | ||
'--rewrite' | ||
sourcemapPath | ||
]; | ||
if (options.ignoreFile) { | ||
command = command.concat(['--ignore-file', options.ignoreFile]); | ||
} | ||
return this.execute(this.prepareCommand(command, options)); | ||
}, this) | ||
); | ||
}; | ||
if (options.ignore) { | ||
command = command.concat(transformIgnore(options.ignore)); | ||
} | ||
SentryCli.prototype.prepareCommand = function(command, options) { | ||
var newOptions = options || {}; | ||
if (!options.ignoreFile && !options.ignore) { | ||
command = command.concat(transformIgnore(DEFAULT_IGNORE)); | ||
} | ||
if (!newOptions.ignoreFile && !newOptions.ignore) { | ||
newOptions.ignore = DEFAULT_IGNORE; | ||
} | ||
return this.execute(command); | ||
}, this) | ||
); | ||
return command.concat(normalizeOptions(newOptions)); | ||
}; | ||
@@ -91,0 +158,0 @@ |
{ | ||
"name": "@sentry/cli", | ||
"version": "1.26.1", | ||
"version": "1.27.0", | ||
"description": "A command line utility to work with Sentry. https://docs.sentry.io/hosted/learn/cli/", | ||
@@ -5,0 +5,0 @@ "scripts": { |
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
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
28862
142