From 573f837c4fc6c9c33e1a3f6636afa67fcaf4d091 Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Wed, 4 Mar 2020 16:47:47 +0000 Subject: [PATCH 1/2] logrocket analytics --- package.json | 4 +++ packages/builder/rollup.config.js | 5 +++ packages/builder/src/builderStore/index.js | 5 +++ yarn.lock | 37 ++++++++++++++++++++++ 4 files changed, 51 insertions(+) diff --git a/package.json b/package.json index cd22a9972d..ca3a54e3b2 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,7 @@ "lerna": "3.14.1", "prettier": "^1.19.1", "prettier-plugin-svelte": "^0.7.0", + "rollup-plugin-replace": "^2.2.0", "svelte": "^3.18.1" }, "scripts": { @@ -22,5 +23,8 @@ "lint": "eslint packages", "lint:fix": "eslint --fix packages", "format": "prettier --write \"{,!(node_modules)/**/}*.{js,jsx,svelte}\"" + }, + "dependencies": { + "logrocket": "^1.0.6" } } diff --git a/packages/builder/rollup.config.js b/packages/builder/rollup.config.js index 183dba265c..aaca6e3c8f 100644 --- a/packages/builder/rollup.config.js +++ b/packages/builder/rollup.config.js @@ -9,6 +9,7 @@ import nodeglobals from "rollup-plugin-node-globals" import copy from "rollup-plugin-copy" import browsersync from "rollup-plugin-browsersync" import proxy from "http-proxy-middleware" +import replace from "rollup-plugin-replace" const target = "http://localhost:4001" const _builderProxy = proxy("/_builder", { @@ -152,6 +153,10 @@ export default { ], }), + replace({ + "process.env.NODE_ENV": JSON.stringify(production ? "production" : "development") + }), + svelte({ // enable run-time checks when not in production dev: !production, diff --git a/packages/builder/src/builderStore/index.js b/packages/builder/src/builderStore/index.js index dfc6d9fe59..dacb186952 100644 --- a/packages/builder/src/builderStore/index.js +++ b/packages/builder/src/builderStore/index.js @@ -1,9 +1,14 @@ import getStore from "./store" +import LogRocket from "logrocket"; export const store = getStore() export const initialise = async () => { try { + console.log(process.env.NODE_ENV); + if (process.env.NODE_ENV === "production") { + LogRocket.init("knlald/budibase"); + } setupRouter(store) await store.initialise() } catch (err) { diff --git a/yarn.lock b/yarn.lock index 5a91797867..4db066934c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1999,6 +1999,11 @@ estraverse@^4.0.0, estraverse@^4.1.0, estraverse@^4.1.1: resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.3.0.tgz#398ad3f3c5a24948be7725e83d11a7de28cdbd1d" integrity sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw== +estree-walker@^0.6.1: + version "0.6.1" + resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-0.6.1.tgz#53049143f40c6eb918b23671d1fe3219f3a1b362" + integrity sha512-SqmZANLWS0mnatqbSfRP5g8OXZC12Fgg1IwNtLsyHDzJizORW4khDfjPqJZsemPWBB2uqykUah5YpQ6epsqC/w== + esutils@^2.0.2: version "2.0.3" resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64" @@ -3222,6 +3227,11 @@ lodash@^4.17.12, lodash@^4.17.13, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17 resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548" integrity sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A== +logrocket@^1.0.6: + version "1.0.6" + resolved "https://registry.yarnpkg.com/logrocket/-/logrocket-1.0.6.tgz#6f12511ad69ba3ca2032295f278ef350230e2902" + integrity sha512-uIi0F+s44AtuJocUAW019SYKsPnnV/IB3IRsL0LFYY4fAfjGQjpcpxXt80yPpkBQkoHW1h5wHYoixs8ZU1MPZg== + loud-rejection@^1.0.0: version "1.6.0" resolved "https://registry.yarnpkg.com/loud-rejection/-/loud-rejection-1.6.0.tgz#5b46f80147edee578870f086d04821cf998e551f" @@ -3242,6 +3252,13 @@ macos-release@^2.2.0: resolved "https://registry.yarnpkg.com/macos-release/-/macos-release-2.3.0.tgz#eb1930b036c0800adebccd5f17bc4c12de8bb71f" integrity sha512-OHhSbtcviqMPt7yfw5ef5aghS2jzFVKEFyCJndQt2YpSQ9qRVSEv2axSJI1paVThEu+FFGs584h/1YhxjVqajA== +magic-string@^0.25.2: + version "0.25.6" + resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.25.6.tgz#5586387d1242f919c6d223579cc938bf1420795e" + integrity sha512-3a5LOMSGoCTH5rbqobC2HuDNRtE2glHZ8J7pK+QZYppyWA36yuNpsX994rIY2nCuyP7CZYy7lQq/X2jygiZ89g== + dependencies: + sourcemap-codec "^1.4.4" + make-dir@^1.0.0: version "1.3.0" resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-1.3.0.tgz#79c1033b80515bd6d24ec9933e860ca75ee27f0c" @@ -4515,6 +4532,21 @@ rimraf@2.6.3: dependencies: glob "^7.1.3" +rollup-plugin-replace@^2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/rollup-plugin-replace/-/rollup-plugin-replace-2.2.0.tgz#f41ae5372e11e7a217cde349c8b5d5fd115e70e3" + integrity sha512-/5bxtUPkDHyBJAKketb4NfaeZjL5yLZdeUihSfbF2PQMz+rSTEb8ARKoOl3UBT4m7/X+QOXJo3sLTcq+yMMYTA== + dependencies: + magic-string "^0.25.2" + rollup-pluginutils "^2.6.0" + +rollup-pluginutils@^2.6.0: + version "2.8.2" + resolved "https://registry.yarnpkg.com/rollup-pluginutils/-/rollup-pluginutils-2.8.2.tgz#72f2af0748b592364dbd3389e600e5a9444a351e" + integrity sha512-EEp9NhnUkwY8aif6bxgovPHMoMoNr2FulJziTndpt5H9RdwC47GSGuII9XxpSdzVGM0GWrNPHV6ie1LTNJPaLQ== + dependencies: + estree-walker "^0.6.1" + run-async@^2.2.0: version "2.3.0" resolved "https://registry.yarnpkg.com/run-async/-/run-async-2.3.0.tgz#0371ab4ae0bdd720d4166d7dfda64ff7a445a6c0" @@ -4708,6 +4740,11 @@ source-map@^0.6.1, source-map@~0.6.1: resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== +sourcemap-codec@^1.4.4: + version "1.4.8" + resolved "https://registry.yarnpkg.com/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz#ea804bd94857402e6992d05a38ef1ae35a9ab4c4" + integrity sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA== + spdx-correct@^3.0.0: version "3.1.0" resolved "https://registry.yarnpkg.com/spdx-correct/-/spdx-correct-3.1.0.tgz#fb83e504445268f154b074e218c87c003cd31df4" From 553cda96c82d641d2493757b9656b7a7ca9109ed Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Wed, 4 Mar 2020 16:50:07 +0000 Subject: [PATCH 2/2] move logrocket into the builder directory --- package.json | 4 +--- packages/builder/package.json | 1 + yarn.lock | 5 ----- 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index ca3a54e3b2..01e91b64ac 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,5 @@ "lint:fix": "eslint --fix packages", "format": "prettier --write \"{,!(node_modules)/**/}*.{js,jsx,svelte}\"" }, - "dependencies": { - "logrocket": "^1.0.6" - } + "dependencies": {} } diff --git a/packages/builder/package.json b/packages/builder/package.json index a09ac67db8..5fd31ddfb3 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -42,6 +42,7 @@ "feather-icons": "^4.21.0", "flatpickr": "^4.5.7", "lodash": "^4.17.13", + "logrocket": "^1.0.6", "lunr": "^2.3.5", "safe-buffer": "^5.1.2", "shortid": "^2.2.8", diff --git a/yarn.lock b/yarn.lock index 4db066934c..0daff7db37 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3227,11 +3227,6 @@ lodash@^4.17.12, lodash@^4.17.13, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17 resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548" integrity sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A== -logrocket@^1.0.6: - version "1.0.6" - resolved "https://registry.yarnpkg.com/logrocket/-/logrocket-1.0.6.tgz#6f12511ad69ba3ca2032295f278ef350230e2902" - integrity sha512-uIi0F+s44AtuJocUAW019SYKsPnnV/IB3IRsL0LFYY4fAfjGQjpcpxXt80yPpkBQkoHW1h5wHYoixs8ZU1MPZg== - loud-rejection@^1.0.0: version "1.6.0" resolved "https://registry.yarnpkg.com/loud-rejection/-/loud-rejection-1.6.0.tgz#5b46f80147edee578870f086d04821cf998e551f"