feat: skipping telemetry in dev env

This commit is contained in:
Anoop M D 2023-01-24 17:28:31 +05:30
parent 037013005f
commit fa40685a6a
4 changed files with 12 additions and 3 deletions

View File

@ -2,7 +2,8 @@ module.exports = {
reactStrictMode: false,
publicRuntimeConfig: {
CI: process.env.CI,
PLAYWRIGHT: process.env.PLAYWRIGHT
PLAYWRIGHT: process.env.PLAYWRIGHT,
ENV: process.env.ENV
},
webpack: (config, { isServer }) => {
// Fixes npm packages that depend on `fs` module

View File

@ -3,7 +3,7 @@
"version": "0.3.0",
"private": true,
"scripts": {
"dev": "next dev",
"dev": "cross-env ENV=dev next dev",
"build": "next build && next export",
"start": "next start",
"lint": "next lint",
@ -61,6 +61,7 @@
"@babel/preset-react": "^7.16.0",
"@babel/runtime": "^7.16.3",
"babel-loader": "^8.2.3",
"cross-env": "^7.0.3",
"css-loader": "^6.5.1",
"file-loader": "^6.2.0",
"html-loader": "^3.0.1",

View File

@ -23,7 +23,6 @@ const useCollectionTreeSync = () => {
const { ipcRenderer } = window;
const _openCollection = (pathname, uid, name) => {
console.log(`collection uid: ${uid}, pathname: ${pathname}, name: ${name}`);
dispatch(openCollectionEvent(uid, pathname, name));
};

View File

@ -13,6 +13,10 @@ const isPlaywrightTestRunning = () => {
return publicRuntimeConfig.PLAYWRIGHT ? true : false;
};
const isDevEnv = () => {
return publicRuntimeConfig.ENV === 'dev';
};
// Todo support chrome and firefox extension
const getPlatform = () => {
return isElectron() ? 'electron' : 'web';
@ -43,6 +47,10 @@ const trackStart = () => {
return;
}
if(isDevEnv()) {
return;
}
const trackingId = getAnonymousTrackingId();
const platform = getPlatform();
const client = getPosthogClient();