Skip to content

Commit

Permalink
Merge branch 'master' into feat/developer-contact
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaewoook committed Aug 26, 2020
2 parents c4bb2ca + 667e52b commit 7042e6d
Show file tree
Hide file tree
Showing 4 changed files with 333 additions and 300 deletions.
21 changes: 11 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,33 +14,34 @@
"postpackage": "node scripts/CreateDistribution.js"
},
"devDependencies": {
"@types/chrome": "^0.0.117",
"@types/chrome": "^0.0.122",
"@types/clipboard": "^2.0.1",
"@types/firefox-webext-browser": "^78.0.0",
"@types/firefox-webext-browser": "^78.0.1",
"@types/fs-extra": "^9.0.1",
"@types/node": "^14.0.5",
"@types/react": "^16.9.41",
"@types/react": "^16.9.46",
"@types/react-dom": "^16.9.8",
"@types/styled-components": "^5.1.0",
"@typescript-eslint/eslint-plugin": "^3.5.0",
"@typescript-eslint/parser": "^3.5.0",
"archiver": "^4.0.1",
"@types/styled-components": "^5.1.2",
"@typescript-eslint/eslint-plugin": "^3.8.0",
"@typescript-eslint/parser": "^3.9.1",
"archiver": "^5.0.0",
"chalk": "^4.1.0",
"cross-env": "^7.0.2",
"eslint": "^6.6.0",
"eslint-config-react-app": "^5.2.1",
"eslint-plugin-react": "^7.20.2",
"eslint-plugin-react": "^7.20.6",
"fs-extra": "^9.0.1",
"typescript": "^3.9.5"
},
"dependencies": {
"@ant-design/icons": "^4.1.0",
"antd": "^4.4.0",
"@sentry/react": "^5.21.3",
"antd": "^4.4.1",
"axios": "^0.19.2",
"copy-to-clipboard": "^3.3.1",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-scripts": "^3.4.1",
"react-scripts": "^3.4.3",
"styled-components": "^5.1.1"
},
"browserslist": {
Expand Down
7 changes: 4 additions & 3 deletions src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import React from "react";
import * as Sentry from "@sentry/react";
import { render } from "react-dom";
import { App } from "./App";
import { getRuntime, getEnv } from "./utils";
import { getRuntime, isProduction } from "./utils";
import { AddressManager } from "./AddressManager";
import { SettingsManager, Settings, DEFAULT_SETTINGS } from "./SettingsManager";

Expand All @@ -10,11 +11,11 @@ window.__ENV__ = {
NODE_ENV: process.env.REACT_APP_ENV as string,
};

// initialize google analytics only in production
if (getEnv() === "production") {
if (isProduction()) {
window.ga("create", "UA-108816190-2", "auto");
window.ga("set", "checkProtocolTask", null);
window.ga("send", "pageview", "/");
Sentry.init({ dsn: "https://6b96accd47ff467da8394a51da93d909@o415139.ingest.sentry.io/5305794" });
} else {
console.info("Google Analytics disabled because runtime does not running in production.");
window.ga = function() {};
Expand Down
3 changes: 3 additions & 0 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ export const getEnv = () => {
return window.__ENV__.NODE_ENV;
};

export const isProduction = () => getEnv() === "production";
export const isDevelopment = () => getEnv() === "development";

export const getRuntime = (): Runtime => {
try {
if (typeof chrome == "undefined" && typeof browser == "undefined") {
Expand Down
Loading

0 comments on commit 7042e6d

Please sign in to comment.