Merge pull request #107 from ente-io/fix-sentry-symbol-js

fix sentry symbol js
This commit is contained in:
Manav 2022-11-17 15:51:13 +05:30 committed by GitHub
commit b468eae79d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -12,15 +12,13 @@ try {
process.exit(1); process.exit(1);
} }
const VERSION = /\bv?(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)(?:-[\da-z-]+(?:\.[\da-z-]+)*)?(?:\+[\da-z-]+(?:\.[\da-z-]+)*)?\b/i;
const SYMBOL_CACHE_FOLDER = '.electron-symbols'; const SYMBOL_CACHE_FOLDER = '.electron-symbols';
const package = require('./package.json');
const sentryCli = new SentryCli('./sentry.properties'); const sentryCli = new SentryCli('./sentry.properties');
async function main() { async function main() {
let version = getElectronVersion(); const version = getElectronVersion();
if (!version) { if (!version) {
console.error('Cannot detect electron version, check package.json'); console.error('Cannot detect electron version, check that electron is installed');
return; return;
} }
@ -68,20 +66,11 @@ async function main() {
} }
function getElectronVersion() { function getElectronVersion() {
if (!package) { try {
return false; return require('electron/package.json').version;
} catch (error) {
return undefined;
} }
let electronVersion =
(package.dependencies && package.dependencies.electron) ||
(package.devDependencies && package.devDependencies.electron);
if (!electronVersion) {
return false;
}
const matches = VERSION.exec(electronVersion);
return matches ? matches[0] : false;
} }
async function downloadSymbols(options) { async function downloadSymbols(options) {