@omlet/cli
Version:
Omlet (https://omlet.dev) is a component analytics tool that uses a CLI to scan your codebase to detect components and their usage. Get real usage insights from customizable charts to measure adoption across all projects and identify opportunities to impr
53 lines (52 loc) • 1.89 kB
JavaScript
;
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.setErrorProps = exports.captureException = void 0;
const Sentry = __importStar(require("@sentry/node"));
const ciUtils_1 = require("./ciUtils");
const config_1 = require("./config");
const npmUtils_1 = require("./npmUtils");
const tracking_1 = require("./tracking");
const defaultProps = {
cliArgs: process.argv.slice(2),
cliVersion: (0, npmUtils_1.getCliVersion)(),
command: tracking_1.Command.none,
ci_vendor: ciUtils_1.ciVendor,
};
function init() {
Sentry.init({
dsn: config_1.SENTRY_DSN,
environment: config_1.SENTRY_ENVIRONMENT,
release: (0, npmUtils_1.getCliVersion)(),
});
Sentry.setExtras(defaultProps);
}
function captureException(error) {
if (config_1.SENTRY_ENABLED) {
Sentry.captureException(error);
}
}
exports.captureException = captureException;
function setErrorProps(errorProps) {
Sentry.setExtras(errorProps);
}
exports.setErrorProps = setErrorProps;
init();