1
0
mirror of https://github.com/yldio/copilot.git synced 2024-11-13 06:40:06 +02:00

adding function to check node_env (#414)

This commit is contained in:
Alex Windett 2017-03-29 09:52:33 +01:00 committed by GitHub
parent 54216ae3d0
commit fe6d3e3228
7 changed files with 12 additions and 10 deletions

View File

@ -10,7 +10,8 @@ import Home from '@containers/home';
import NotFound from '@containers/not-found';
import Nav from '@components/navigation';
import OrgNavigation from '@components/navigation/org';
import PerfProfiler from '../perf-profiler';
import { isProduction } from '@utils';
import PerfProfiler from '@perf-profiler';
import React from 'react';
const App = connect()(React.createClass({
@ -33,7 +34,7 @@ const App = connect()(React.createClass({
return _children;
}
if (process.env.NODE_ENV !== 'production' && process.env.BASELINE_GRID) {
if ( !isProduction() && process.env.BASELINE_GRID) {
_children = (
<BaselineGrid>
{_children}
@ -51,7 +52,7 @@ const App = connect()(React.createClass({
export default (props) => (
<div>
{ process.env.NODE_ENV !== 'production' && <PerfProfiler /> }
{ !isProduction() && <PerfProfiler /> }
<App {...props}>
<Header />

View File

@ -13,8 +13,9 @@ import MockState from '@mock-states';
import LeakDatasets from './dataset-leak.json';
import NormalDatasets from './dataset-normal.json';
import Store from '@state/store';
import { isProduction } from '@utils';
if (process.env.NODE_ENV !== 'production') {
if ( !isProduction() ) {
a11y(React, {
ReactDOM
});

View File

@ -12,6 +12,7 @@ const Profiler = styled.div`
background: #bada55;
border: 2px solid black;
text-align: center;
z-index: 1;
& > h1 {
font-size: 1.5em;

View File

@ -6,6 +6,7 @@ import thunk from 'redux-thunk';
import perflogger from 'redux-perf-middleware';
import createReducer from '@state/reducers';
import { isProduction } from '@utils';
const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;
@ -18,7 +19,7 @@ export default (state = Object.freeze({})) => {
createLogger(),
promiseMiddleware(),
thunk,
process.env.NODE_ENV !== 'production' && perflogger
!isProduction() && perflogger
)
)
);

View File

@ -0,0 +1 @@
export const isProduction = () => process.env.NODE_ENV === 'production';

View File

@ -9,8 +9,7 @@ const {
MODULES,
FRONTEND,
UI,
STATIC,
MOCKSTATE
STATIC
} = paths;
module.exports = {
@ -25,8 +24,7 @@ module.exports = {
[`@${path.basename(fullpath)}`]: fullpath
}), {
'@root': FRONTEND,
'@ui': UI,
'@mock-states': MOCKSTATE
'@ui': UI
})
},
resolveLoader: {

View File

@ -14,7 +14,6 @@ module.exports = {
'node_modules'
],
FRONTEND: path.join(FRONTEND, 'src'),
MOCKSTATE: path.join(FRONTEND, 'src/mock-states'),
UI: process.env.NODE_ENV === 'production'
? path.join(FRONTEND, 'node_modules', '@tomgco/joyent-portal-ui', 'dist')
: path.join(UI, 'src'),