From fa40685a6a21c659503c77c8f0f35b18a180b891 Mon Sep 17 00:00:00 2001 From: Anoop M D Date: Tue, 24 Jan 2023 17:28:31 +0530 Subject: [PATCH] feat: skipping telemetry in dev env --- packages/bruno-app/next.config.js | 3 ++- packages/bruno-app/package.json | 3 ++- .../bruno-app/src/providers/App/useCollectionTreeSync.js | 1 - packages/bruno-app/src/providers/App/useTelemetry.js | 8 ++++++++ 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/packages/bruno-app/next.config.js b/packages/bruno-app/next.config.js index 920ab22b..ce46558b 100644 --- a/packages/bruno-app/next.config.js +++ b/packages/bruno-app/next.config.js @@ -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 diff --git a/packages/bruno-app/package.json b/packages/bruno-app/package.json index 00bacad1..ab61a169 100644 --- a/packages/bruno-app/package.json +++ b/packages/bruno-app/package.json @@ -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", diff --git a/packages/bruno-app/src/providers/App/useCollectionTreeSync.js b/packages/bruno-app/src/providers/App/useCollectionTreeSync.js index 93b29aaa..e408c7d0 100644 --- a/packages/bruno-app/src/providers/App/useCollectionTreeSync.js +++ b/packages/bruno-app/src/providers/App/useCollectionTreeSync.js @@ -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)); }; diff --git a/packages/bruno-app/src/providers/App/useTelemetry.js b/packages/bruno-app/src/providers/App/useTelemetry.js index 581c54c1..3591d858 100644 --- a/packages/bruno-app/src/providers/App/useTelemetry.js +++ b/packages/bruno-app/src/providers/App/useTelemetry.js @@ -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();