From 65786b6929deb965e87eb54fe716cdd431f995e7 Mon Sep 17 00:00:00 2001 From: Oliver Eyton-Williams Date: Thu, 10 Jun 2021 15:08:14 +0200 Subject: [PATCH] fix: control CodeSee via .env variable (#42428) --- client/.babelrc | 74 --------------------------------------------- client/.babelrc.js | 75 ++++++++++++++++++++++++++++++++++++++++++++++ sample.env | 1 + 3 files changed, 76 insertions(+), 74 deletions(-) delete mode 100644 client/.babelrc create mode 100644 client/.babelrc.js diff --git a/client/.babelrc b/client/.babelrc deleted file mode 100644 index dce5bb8d09..0000000000 --- a/client/.babelrc +++ /dev/null @@ -1,74 +0,0 @@ -{ - "presets": [ - [ - "@babel/preset-env", - { - "loose": true, - "modules": false, - "useBuiltIns": "usage", - "corejs": 2, - "shippedProposals": true, - "targets": { - "browsers": [">0.25%", "not dead"] - } - } - ], - [ - "@babel/preset-react", - { - "useBuiltIns": true, - "pragma": "React.createElement" - } - ], - "@babel/preset-typescript" - ], - "plugins": [ - "preval", - "@babel/plugin-syntax-dynamic-import", - "babel-plugin-macros", - [ - "@babel/plugin-transform-runtime", - { - "helpers": true, - "regenerator": true - } - ], - [ - "babel-plugin-transform-imports", - { - "react-bootstrap": { - "transform": "react-bootstrap/lib/${member}", - "preventFullImport": true - } - } - ], - [ - "prismjs", - { - "languages": [ - "clike", - "css", - "html", - "javascript", - "markup", - "mathml", - "python", - "svg", - "xml", - "sql", - "typescript" - ], - "theme": "default", - "css": true, - "plugins": ["line-numbers"] - } - ] - ], - "env": { - "development": { - "plugins": [ - ["@codesee/instrument", { "hosted": true }] - ] - } - }, -} diff --git a/client/.babelrc.js b/client/.babelrc.js new file mode 100644 index 0000000000..8c3ec56abf --- /dev/null +++ b/client/.babelrc.js @@ -0,0 +1,75 @@ +require('dotenv').config({ path: '../.env' }); +const config = { + presets: [ + [ + '@babel/preset-env', + { + loose: true, + modules: false, + useBuiltIns: 'usage', + corejs: 2, + shippedProposals: true, + targets: { + browsers: ['>0.25%', 'not dead'] + } + } + ], + [ + '@babel/preset-react', + { + useBuiltIns: true, + pragma: 'React.createElement' + } + ], + '@babel/preset-typescript' + ], + plugins: [ + 'preval', + '@babel/plugin-syntax-dynamic-import', + 'babel-plugin-macros', + [ + '@babel/plugin-transform-runtime', + { + helpers: true, + regenerator: true + } + ], + [ + 'babel-plugin-transform-imports', + { + 'react-bootstrap': { + transform: 'react-bootstrap/lib/${member}', + preventFullImport: true + } + } + ], + [ + 'prismjs', + { + languages: [ + 'clike', + 'css', + 'html', + 'javascript', + 'markup', + 'mathml', + 'python', + 'svg', + 'xml', + 'sql', + 'typescript' + ], + theme: 'default', + css: true, + plugins: ['line-numbers'] + } + ] + ] +}; +if ( + process.env.FREECODECAMP_NODE_ENV === 'development' && + process.env.CODESEE === 'true' +) { + config.plugins.push(['@codesee/instrument', { hosted: true }]); +} +module.exports = config; diff --git a/sample.env b/sample.env index 2ad1f2fb2c..43e3c50a2e 100644 --- a/sample.env +++ b/sample.env @@ -65,6 +65,7 @@ RADIO_LOCATION=https://coderadio.freecodecamp.org PEER=stuff DEBUG=true LOCAL_MOCK_AUTH=true +CODESEE=false # Webhook proxy url from smee.io for PayPal WEBHOOK_PROXY_URL=