From f424b39fafa5c49dbbc2079db0881c7e09e888d5 Mon Sep 17 00:00:00 2001 From: aeddi Date: Fri, 18 Jan 2019 15:11:51 +0100 Subject: [PATCH] feat(integration tests): added env variables resolving to react-native --- client/react-native/common/index.js | 20 +++++++++++++++++++ client/react-native/package.json | 4 +++- .../web/config/webpack.config.dev.js | 2 +- .../web/config/webpack.config.prod.js | 2 +- client/react-native/yarn.lock | 4 ++++ 5 files changed, 29 insertions(+), 3 deletions(-) diff --git a/client/react-native/common/index.js b/client/react-native/common/index.js index 273cdbd0ac..c8d8ba12b0 100644 --- a/client/react-native/common/index.js +++ b/client/react-native/common/index.js @@ -7,7 +7,27 @@ import ReactDOM from 'react-dom' import App from './components/App' +if (process.env['ENVIRONMENT'] === 'integration_test') { + console.error('LOLOLOLOLOL') +} +// import { Tester, TestHookStore } from 'cavy' +// import AppSpec from './specs/AppSpec' +// +// const testHookStore = new TestHookStore() +// +// class AppWrapper extends Component { +// render() { +// return ( +// +// +// +// ) +// } +// } +// + if (Platform.OS === 'web') { + console.error('LILILI') import('./helpers/patch-web.js') ReactDOM.render(, document.getElementById('root')) import('./registerServiceWorker').then() diff --git a/client/react-native/package.json b/client/react-native/package.json index 1b2f25dfb9..d5608db96b 100644 --- a/client/react-native/package.json +++ b/client/react-native/package.json @@ -13,6 +13,7 @@ "b64-lite": "^1.3.1", "babel-plugin-relay": "^1.6.2", "babel-plugin-transform-export-extensions": "^6.22.0", + "babel-plugin-transform-inline-environment-variables": "^0.4.3", "case": "^1.6.0", "concurrently": "^4.0.1", "crypto-js": "^3.1.9-1", @@ -87,7 +88,8 @@ "plugins": [ "@babel/plugin-syntax-export-namespace-from", "transform-export-extensions", - "relay" + "relay", + "transform-inline-environment-variables" ] } } diff --git a/client/react-native/web/config/webpack.config.dev.js b/client/react-native/web/config/webpack.config.dev.js index 2a69d074f7..b96ad7a8f4 100644 --- a/client/react-native/web/config/webpack.config.dev.js +++ b/client/react-native/web/config/webpack.config.dev.js @@ -10,7 +10,6 @@ const getCSSModuleLocalIdent = require('react-dev-utils/getCSSModuleLocalIdent') const getClientEnvironment = require('./env') const paths = require('./paths') const ManifestPlugin = require('webpack-manifest-plugin') -const getCacheIdentifier = require('react-dev-utils/getCacheIdentifier') const ModuleNotFoundPlugin = require('react-dev-utils/ModuleNotFoundPlugin') // Webpack uses `publicPath` to determine where the app is being served from. @@ -215,6 +214,7 @@ module.exports = { ], plugins: [ 'react-native-web', + require.resolve('babel-plugin-transform-inline-environment-variables'), require.resolve('@babel/plugin-proposal-export-namespace-from'), require.resolve('babel-plugin-relay'), [ diff --git a/client/react-native/web/config/webpack.config.prod.js b/client/react-native/web/config/webpack.config.prod.js index a7459d65f6..389b3f298a 100644 --- a/client/react-native/web/config/webpack.config.prod.js +++ b/client/react-native/web/config/webpack.config.prod.js @@ -14,7 +14,6 @@ const ModuleScopePlugin = require('react-dev-utils/ModuleScopePlugin') const getCSSModuleLocalIdent = require('react-dev-utils/getCSSModuleLocalIdent') const paths = require('./paths') const getClientEnvironment = require('./env') -const getCacheIdentifier = require('react-dev-utils/getCacheIdentifier') const ModuleNotFoundPlugin = require('react-dev-utils/ModuleNotFoundPlugin') // Webpack uses `publicPath` to determine where the app is being served from. @@ -285,6 +284,7 @@ module.exports = { ], plugins: [ 'react-native-web', + require.resolve('babel-plugin-transform-inline-environment-variables'), require.resolve('@babel/plugin-proposal-export-namespace-from'), require.resolve('babel-plugin-relay'), [ diff --git a/client/react-native/yarn.lock b/client/react-native/yarn.lock index 2cf76173ab..f7ff64c0f0 100644 --- a/client/react-native/yarn.lock +++ b/client/react-native/yarn.lock @@ -1250,6 +1250,10 @@ babel-plugin-transform-flow-strip-types@^6.8.0: babel-plugin-syntax-flow "^6.18.0" babel-runtime "^6.22.0" +babel-plugin-transform-inline-environment-variables@^0.4.3: + version "0.4.3" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-inline-environment-variables/-/babel-plugin-transform-inline-environment-variables-0.4.3.tgz#a3b09883353be8b5e2336e3ff1ef8a5d93f9c489" + babel-plugin-transform-object-rest-spread@^6.8.0: version "6.26.0" resolved "https://registry.yarnpkg.com/babel-plugin-transform-object-rest-spread/-/babel-plugin-transform-object-rest-spread-6.26.0.tgz#0f36692d50fef6b7e2d4b3ac1478137a963b7b06"