Skip to content

Commit

Permalink
use sentry + don't configure via 'dotenv' if process.env.NODE_ENV ===…
Browse files Browse the repository at this point in the history
… "production"
  • Loading branch information
jaensen committed Feb 22, 2023
1 parent f73cfb7 commit 801f2b9
Show file tree
Hide file tree
Showing 4 changed files with 108 additions and 20 deletions.
6 changes: 4 additions & 2 deletions shell/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"clean:all": "npx shx rm -rf public/bundle.* && npx shx rm -rf node_modules",
"clean": "npx shx rm -rf public/bundle.*",
"local": "ENVIRONMENT='local' webpack serve --hot --config webpack.config.js --mode=development",
"docker": "ENVIRONMENT='docker' HERE_API_KEY='TAyr4mDOyPVD3DUwlUhLgV-hQxIsXGl3wnlyTkTPWsA' USE_MOCKS='true' webpack serve --hot --host 0.0.0.0 --port 8080 --config webpack.config.js --mode=development",
"docker": "DEPLOY_ENVIRONMENT='docker' ENVIRONMENT='docker' HERE_API_KEY='TAyr4mDOyPVD3DUwlUhLgV-hQxIsXGl3wnlyTkTPWsA' USE_MOCKS='true' webpack serve --hot --host 0.0.0.0 --port 8080 --config webpack.config.js --mode=development",
"override": "ENVIRONMENT='override' webpack serve --hot --host localhost --port 8080 --config webpack.config.js --mode=development",
"build": "cross-env NODE_ENV=production webpack",
"validate": "svelte-check",
Expand Down Expand Up @@ -50,7 +50,9 @@
"svelte-spa-router": "^3.0.5",
"svelte-time": "^0.7.1",
"xstate": "^4.31.0",
"yup": "^0.32.11"
"yup": "^0.32.11",
"@sentry/browser": "^7.38.0",
"@sentry/tracing": "^7.38.0"
},
"devDependencies": {
"daisyui": "^2.31.0",
Expand Down
36 changes: 33 additions & 3 deletions shell/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,39 @@ import { me } from "./shared/stores/me";
import { Environment } from "./shared/environment";
import { IShell } from "./iShell";

import * as Sentry from "@sentry/browser";
import { BrowserTracing } from "@sentry/tracing";

Sentry.init({
dsn: "https://42e2eed7fcd94a3f86fa2ca4ffa7bd70@o4504719125905408.ingest.sentry.io/4504719127740416",
integrations: [new BrowserTracing()],

// Set tracesSampleRate to 1.0 to capture 100%
// of transactions for performance monitoring.
// We recommend adjusting this value in production
tracesSampleRate: 1.0,
});

/*
function monkeyPatchConsole () {
// Wrap 'log', 'warning' and 'error' methods
['log', 'warn', 'error'].forEach(function (method) {
var original = console[method];
console[method] = function () {
var stack = (new Error()).stack.split(" at ").slice(3);
// Chrome includes a single " at " string on the stack, FF doesn't.
if (stack[0] === "") {
stack = stack.slice(1);
}
var args = [].slice.call(arguments).concat([stack]);
return original.apply(console, args);
};
});
}
monkeyPatchConsole();
*/


dayjs.extend(relativeTime);
RpcGateway.setup(Environment.xdaiRpcGatewayUrl);
Expand Down Expand Up @@ -246,9 +279,6 @@ declare global {
}





async function load() {
await I18nDictionary.instance.waitHandle;
const App = require("src/App.svelte");
Expand Down
6 changes: 5 additions & 1 deletion shell/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ const dev = !prod;

const __ENVIRONMENT__ = process.env.ENVIRONMENT;

require("dotenv").config({ path: `./../.env.${__ENVIRONMENT__}` });
if (!process.env.NODE_ENV === "production") {
require("dotenv").config({path: `./../.env.${__ENVIRONMENT__}`});
}

console.log("Environment:", __ENVIRONMENT__);

const DEBUG = !process.argv.includes("--release");
const VERBOSE = process.argv.includes("--verbose");
Expand Down
80 changes: 66 additions & 14 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2345,10 +2345,57 @@
dependencies:
any-observable "^0.3.0"

"@silintl/svelte-google-places-autocomplete@^1.1.6":
version "1.1.6"
resolved "https://registry.npmjs.org/@silintl/svelte-google-places-autocomplete/-/svelte-google-places-autocomplete-1.1.6.tgz"
integrity sha512-wtroZA4XikPFn5HiPY+8p/7PjAmmyn+P0yypJgMdEH+tpbo42DTVxE+YuXHRF7d+7EhEkqjzp09MJmCOwy3Deg==
"@sentry/browser@^7.38.0":
version "7.38.0"
resolved "https://registry.yarnpkg.com/@sentry/browser/-/browser-7.38.0.tgz#cdb39da23f9ee2ce47395b2c12542acb4969efa7"
integrity sha512-rPJr+2jRYL29PeMYA2JgzYKTZQx6bc3T9evbAdIh0n+popSjpVyOpOMV/3l6A7KZeeix3dpp6eUZUxTJukqriQ==
dependencies:
"@sentry/core" "7.38.0"
"@sentry/replay" "7.38.0"
"@sentry/types" "7.38.0"
"@sentry/utils" "7.38.0"
tslib "^1.9.3"

"@sentry/core@7.38.0":
version "7.38.0"
resolved "https://registry.yarnpkg.com/@sentry/core/-/core-7.38.0.tgz#52f1f1f2ba5e88ab7b33c3abb0ea9730c78d953d"
integrity sha512-+hXh/SO3Ie6WC2b+wi01xLhyVREdkRXS5QBmCiv3z2ks2HvYXp7PoKSXJvNKiwCP+pBD+enOnM1YEzM2yEy5yw==
dependencies:
"@sentry/types" "7.38.0"
"@sentry/utils" "7.38.0"
tslib "^1.9.3"

"@sentry/replay@7.38.0":
version "7.38.0"
resolved "https://registry.yarnpkg.com/@sentry/replay/-/replay-7.38.0.tgz#48d240b67de6b4ab41c951d19abeceb0d3f7706d"
integrity sha512-Ai78/OIYedny605x8uS0n/a5uj7qnuevogGD6agLat9lGc8DFvC07m2iS+EFyGOwtQzyDlRYJvYkHL8peR3crQ==
dependencies:
"@sentry/core" "7.38.0"
"@sentry/types" "7.38.0"
"@sentry/utils" "7.38.0"

"@sentry/tracing@^7.38.0":
version "7.38.0"
resolved "https://registry.yarnpkg.com/@sentry/tracing/-/tracing-7.38.0.tgz#ba28f15f526e87df167de206fd4fb0a39277dac6"
integrity sha512-ejXJp8oOT64MVtBzqdECUUaNzKbpu25St8Klub1i4Sm7xO+ZjDQDI4TIHvWojZvtkwQ3F4jcsCclc8KuyJunyQ==
dependencies:
"@sentry/core" "7.38.0"
"@sentry/types" "7.38.0"
"@sentry/utils" "7.38.0"
tslib "^1.9.3"

"@sentry/types@7.38.0":
version "7.38.0"
resolved "https://registry.yarnpkg.com/@sentry/types/-/types-7.38.0.tgz#6e2611544446271ed237440b12de782805aefe25"
integrity sha512-NKOALR6pNUMzUrsk2m+dkPrO8uGNvNh1LD0BCPswKNjC2qHo1h1mDGCgBmF9+EWyii8ZoACTIsxvsda+MBf97Q==

"@sentry/utils@7.38.0":
version "7.38.0"
resolved "https://registry.yarnpkg.com/@sentry/utils/-/utils-7.38.0.tgz#d10716e730108301f58766970493e9c5da0ba502"
integrity sha512-MgbI3YmYuyyhUtvcXkgGBqjOW+nuLLNGUdWCK+C4kObf8VbLt3dSE/7SEMT6TSHLYQmxs2BxFgx5Agn97m68kQ==
dependencies:
"@sentry/types" "7.38.0"
tslib "^1.9.3"

"@sinclair/typebox@^0.24.1":
version "0.24.44"
Expand Down Expand Up @@ -5192,9 +5239,9 @@ d@1, d@^1.0.1:
type "^1.0.1"

daisyui@^2.31.0:
version "2.50.1"
resolved "https://registry.yarnpkg.com/daisyui/-/daisyui-2.50.1.tgz#ac41353f4d67e10f1b0144f02dc47c77fe9c08d7"
integrity sha512-Z4GuU/ZknYoHt7qfDQSC5rrxMJ6ffNV9baQfCSbo5J/clC1DBppfrqLJXS8A3NPBRo2GbbpKwdA1ZdThWdpBtQ==
version "2.50.2"
resolved "https://registry.yarnpkg.com/daisyui/-/daisyui-2.50.2.tgz#231bfffb9bcc9c7cd9ce47db0ddad6f25d5899b9"
integrity sha512-CzyTsqdkpP2Zwk5Fl+1pFfL7XewRn/COm4TyKx4DbdITpzADMe01j6YZRG/D0kAOyd7t4rXA3zvkqNc7Ak9ukQ==
dependencies:
color "^4.2"
css-selector-tokenizer "^0.8.0"
Expand Down Expand Up @@ -5627,6 +5674,11 @@ dotenv-webpack@^6.0.4:
dependencies:
dotenv-defaults "^2.0.1"

dotenv@^16.0.3:
version "16.0.3"
resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-16.0.3.tgz#115aec42bac5053db3c456db30cc243a5a836a07"
integrity sha512-7GO6HghkA5fYG9TYnNxi14/7K9f5occMlp3zXAuSxn7CKCxt9xbNWG7yF8hTCSUchlfWSe3uLmlPfigevRItzQ==

dotenv@^8.2.0:
version "8.6.0"
resolved "https://registry.npmjs.org/dotenv/-/dotenv-8.6.0.tgz"
Expand Down Expand Up @@ -9006,9 +9058,9 @@ lru-cache@^6.0.0:
yallist "^4.0.0"

lru-cache@^7.4.4, lru-cache@^7.5.1, lru-cache@^7.7.1:
version "7.16.0"
resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-7.16.0.tgz#b1b946cff368d3f3c569cc3d6a5ba8f90435160f"
integrity sha512-VJBdeMa9Bz27NNlx+DI/YXGQtXdjUU+9gdfN1rYfra7vtTjhodl5tVNmR42bo+ORHuDqDT+lGAUAb+lzvY42Bw==
version "7.16.1"
resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-7.16.1.tgz#7acea16fecd9ed11430e78443c2bb81a06d3dea9"
integrity sha512-9kkuMZHnLH/8qXARvYSjNvq8S1GYFFzynQTAfKeaJ0sIrR3PUPuu37Z+EiIANiZBvpfTf2B5y8ecDLSMWlLv+w==

lz-string@^1.4.4:
version "1.4.4"
Expand Down Expand Up @@ -11825,7 +11877,7 @@ selfsigned@^2.1.1:

semver@7.x, semver@^7.0.0, semver@^7.1.1, semver@^7.3.2, semver@^7.3.4, semver@^7.3.5, semver@^7.3.7:
version "7.3.8"
resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.8.tgz#07a78feafb3f7b32347d725e33de7e2a2df67798"
resolved "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz"
integrity sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==
dependencies:
lru-cache "^6.0.0"
Expand Down Expand Up @@ -12691,9 +12743,9 @@ svelte-typeahead@^4.3.2:
svelte-search "^1.1.0"

svelte@^3.47.0, svelte@^3.50.1:
version "3.52.0"
resolved "https://registry.npmjs.org/svelte/-/svelte-3.52.0.tgz"
integrity sha512-FxcnEUOAVfr10vDU5dVgJN19IvqeHQCS1zfe8vayTfis9A2t5Fhx+JDe5uv/C3j//bB1umpLJ6quhgs9xyUbCQ==
version "3.55.1"
resolved "https://registry.npmjs.org/svelte/-/svelte-3.55.1.tgz"
integrity sha512-S+87/P0Ve67HxKkEV23iCdAh/SX1xiSfjF1HOglno/YTbSTW7RniICMCofWGdJJbdjw3S+0PfFb1JtGfTXE0oQ==

svgo@^2.7.0:
version "2.8.0"
Expand Down

0 comments on commit 801f2b9

Please sign in to comment.