@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
63 lines (62 loc) • 2.86 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
var _a, _b, _c;
Object.defineProperty(exports, "__esModule", { value: true });
exports.SENTRY_ENABLED = exports.TRACKER_DEBUG_MODE = exports.TRACKER_ENABLED = exports.WORKSPACE_SLUG = exports.OMLET_VALIDATE = exports.LOGIN_SERVER_PORT = exports.LOG_FILE_PATH = exports.GIT_HISTORY_LIMIT_DAYS = exports.HTTP_PROXY_URL = exports.OMLET_EMAIL = exports.SENTRY_ENVIRONMENT = exports.ENV_TOKEN = exports.BASE_URL = exports.SENTRY_DSN = void 0;
const upath_1 = __importDefault(require("upath"));
function getProxyConfig() {
const varNames = [
"npm_config_https_proxy",
"npm_config_http_proxy",
"npm_config_proxy",
"http_proxy",
"https_proxy",
"http-proxy",
"https-proxy",
"proxy",
"HTTP_PROXY",
"HTTPS_PROXY",
"HTTP-PROXY",
"HTTPS-PROXY",
"PROXY",
];
for (const name of varNames) {
if (process.env[name]) {
return process.env[name];
}
}
}
function readNumberEnvVar(name) {
const value = process.env[name];
if (!value) {
return;
}
try {
return Number.parseInt(value, 10);
}
catch (_a) {
// Skip
}
}
const PROD_BASE_URL = "https://feta.omlet.dev";
const STG_BASE_URL = "https://feta.omlet.io";
const LOCAL_BASE_URL = "http://localhost:3001";
exports.SENTRY_DSN = "https://efe0f17d00fb3c814f6da7499047c9d0@o36333.ingest.us.sentry.io/4506982246907904";
exports.BASE_URL = (_a = process.env.OMLET_BASE_URL) !== null && _a !== void 0 ? _a : PROD_BASE_URL;
const isProd = PROD_BASE_URL === exports.BASE_URL;
const isStg = STG_BASE_URL === exports.BASE_URL;
const isLocal = LOCAL_BASE_URL === exports.BASE_URL;
exports.ENV_TOKEN = (_b = process.env.OMLET_TOKEN) !== null && _b !== void 0 ? _b : "";
exports.SENTRY_ENVIRONMENT = isProd ? "production" : isStg ? "staging" : "local";
exports.OMLET_EMAIL = "support@omlet.dev";
exports.HTTP_PROXY_URL = getProxyConfig();
exports.GIT_HISTORY_LIMIT_DAYS = (_c = readNumberEnvVar("GIT_LIMIT")) !== null && _c !== void 0 ? _c : 365;
exports.LOG_FILE_PATH = upath_1.default.join(process.cwd(), "omlet-cli.log");
exports.LOGIN_SERVER_PORT = "8989";
exports.OMLET_VALIDATE = process.env.OMLET_VALIDATE === "true";
exports.WORKSPACE_SLUG = process.env.OMLET_WORKSPACE_SLUG;
exports.TRACKER_ENABLED = process.env.OMLET_TRACKER_ENABLED ? process.env.OMLET_TRACKER_ENABLED === "true" : isProd;
exports.TRACKER_DEBUG_MODE = process.env.OMLET_TRACKER_DEBUG_MODE ? process.env.OMLET_TRACKER_DEBUG_MODE === "true" : !isProd;
exports.SENTRY_ENABLED = process.env.SENTRY_ENABLED ? process.env.SENTRY_ENABLED === "true" : !isLocal; // Sentry is enabled by default in production and staging