Files
klz-cables.com/.pnpm-store/v10/files/45/85ead4fd461bdbd96933ba639feb24380105815d76ff60df7b7647338f06eb1a273d0a964cde07d9855ba14740b9e742e77c86a38fbbc7ba319401510c6b9d
Marc Mintel 5397309103
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
fix(products): fix breadcrumbs and product filtering (backport from main)
2026-02-24 16:04:21 +01:00

77 lines
3.1 KiB
Plaintext

'use strict';
const pkgInfo = require('../package.json');
const helper = require('./helper');
const Releases = require('./releases');
/**
* @typedef {import('./types').SentryCliOptions} SentryCliOptions
* @typedef {import('./types').SentryCliUploadSourceMapsOptions} SentryCliUploadSourceMapsOptions
* @typedef {import('./types').SourceMapsPathDescriptor} SourceMapsPathDescriptor
* @typedef {import('./types').SentryCliNewDeployOptions} SentryCliNewDeployOptions
* @typedef {import('./types').SentryCliCommitsOptions} SentryCliCommitsOptions
* @typedef {import('./types').SentryCliReleases} SentryCliReleases
*/
/**
* Interface to and wrapper around the `sentry-cli` executable.
*
* Commands are grouped into namespaces. See the respective namespaces for more
* documentation. To use this wrapper, simply create an instance and call methods:
*
* @example
* const cli = new SentryCli();
* console.log(SentryCli.getVersion());
*
* @example
* const cli = new SentryCli('path/to/custom/sentry.properties');
* const release = await cli.releases.proposeVersion());
* console.log(release);
*/
class SentryCli {
/**
* Creates a new `SentryCli` instance.
*
* If the `configFile` parameter is specified, configuration located in the default
* location and the value specified in the `SENTRY_PROPERTIES` environment variable is
* overridden.
*
* @param {string | null} [configFile] - Path to Sentry CLI config properties, as described in https://docs.sentry.io/learn/cli/configuration/#properties-files.
* By default, the config file is looked for upwards from the current path and defaults from ~/.sentryclirc are always loaded.
* This value will update `SENTRY_PROPERTIES` env variable.
* @param {SentryCliOptions} [options] - More options to pass to the CLI
*/
constructor(configFile, options) {
if (typeof configFile === 'string') {
this.configFile = configFile;
}
this.options = options || { silent: false };
this.releases = new Releases(Object.assign(Object.assign({}, this.options), { configFile }));
}
/**
* Returns the version of the installed `sentry-cli` binary.
* @returns {string}
*/
static getVersion() {
return pkgInfo.version;
}
/**
* Returns an absolute path to the `sentry-cli` binary.
* @returns {string}
*/
static getPath() {
return helper.getPath();
}
/**
* See {helper.execute} docs.
* @param {string[]} args Command line arguments passed to `sentry-cli`.
* @param {boolean | 'rejectOnError'} live can be set to:
* - `true` to inherit stdio to display `sentry-cli` output directly.
* - `false` to not inherit stdio and return the output as a string.
* - `'rejectOnError'` to inherit stdio and reject the promise if the command
* exits with a non-zero exit code.
* @returns {Promise<string>} A promise that resolves to the standard output.
*/
execute(args, live) {
return helper.execute(args, live, this.options.silent, this.configFile, this.options);
}
}
module.exports = SentryCli;