mirror of
https://github.com/yldio/copilot.git
synced 2024-11-28 14:10:04 +02:00
adding function to check node_env (#414)
This commit is contained in:
parent
54216ae3d0
commit
fe6d3e3228
@ -10,7 +10,8 @@ import Home from '@containers/home';
|
|||||||
import NotFound from '@containers/not-found';
|
import NotFound from '@containers/not-found';
|
||||||
import Nav from '@components/navigation';
|
import Nav from '@components/navigation';
|
||||||
import OrgNavigation from '@components/navigation/org';
|
import OrgNavigation from '@components/navigation/org';
|
||||||
import PerfProfiler from '../perf-profiler';
|
import { isProduction } from '@utils';
|
||||||
|
import PerfProfiler from '@perf-profiler';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
const App = connect()(React.createClass({
|
const App = connect()(React.createClass({
|
||||||
@ -33,7 +34,7 @@ const App = connect()(React.createClass({
|
|||||||
return _children;
|
return _children;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (process.env.NODE_ENV !== 'production' && process.env.BASELINE_GRID) {
|
if ( !isProduction() && process.env.BASELINE_GRID) {
|
||||||
_children = (
|
_children = (
|
||||||
<BaselineGrid>
|
<BaselineGrid>
|
||||||
{_children}
|
{_children}
|
||||||
@ -51,7 +52,7 @@ const App = connect()(React.createClass({
|
|||||||
|
|
||||||
export default (props) => (
|
export default (props) => (
|
||||||
<div>
|
<div>
|
||||||
{ process.env.NODE_ENV !== 'production' && <PerfProfiler /> }
|
{ !isProduction() && <PerfProfiler /> }
|
||||||
|
|
||||||
<App {...props}>
|
<App {...props}>
|
||||||
<Header />
|
<Header />
|
||||||
|
@ -13,8 +13,9 @@ import MockState from '@mock-states';
|
|||||||
import LeakDatasets from './dataset-leak.json';
|
import LeakDatasets from './dataset-leak.json';
|
||||||
import NormalDatasets from './dataset-normal.json';
|
import NormalDatasets from './dataset-normal.json';
|
||||||
import Store from '@state/store';
|
import Store from '@state/store';
|
||||||
|
import { isProduction } from '@utils';
|
||||||
|
|
||||||
if (process.env.NODE_ENV !== 'production') {
|
if ( !isProduction() ) {
|
||||||
a11y(React, {
|
a11y(React, {
|
||||||
ReactDOM
|
ReactDOM
|
||||||
});
|
});
|
||||||
|
@ -12,6 +12,7 @@ const Profiler = styled.div`
|
|||||||
background: #bada55;
|
background: #bada55;
|
||||||
border: 2px solid black;
|
border: 2px solid black;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
z-index: 1;
|
||||||
|
|
||||||
& > h1 {
|
& > h1 {
|
||||||
font-size: 1.5em;
|
font-size: 1.5em;
|
||||||
|
@ -6,6 +6,7 @@ import thunk from 'redux-thunk';
|
|||||||
import perflogger from 'redux-perf-middleware';
|
import perflogger from 'redux-perf-middleware';
|
||||||
|
|
||||||
import createReducer from '@state/reducers';
|
import createReducer from '@state/reducers';
|
||||||
|
import { isProduction } from '@utils';
|
||||||
|
|
||||||
const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;
|
const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;
|
||||||
|
|
||||||
@ -18,7 +19,7 @@ export default (state = Object.freeze({})) => {
|
|||||||
createLogger(),
|
createLogger(),
|
||||||
promiseMiddleware(),
|
promiseMiddleware(),
|
||||||
thunk,
|
thunk,
|
||||||
process.env.NODE_ENV !== 'production' && perflogger
|
!isProduction() && perflogger
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
1
frontend/src/utils/index.js
Normal file
1
frontend/src/utils/index.js
Normal file
@ -0,0 +1 @@
|
|||||||
|
export const isProduction = () => process.env.NODE_ENV === 'production';
|
@ -9,8 +9,7 @@ const {
|
|||||||
MODULES,
|
MODULES,
|
||||||
FRONTEND,
|
FRONTEND,
|
||||||
UI,
|
UI,
|
||||||
STATIC,
|
STATIC
|
||||||
MOCKSTATE
|
|
||||||
} = paths;
|
} = paths;
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
@ -25,8 +24,7 @@ module.exports = {
|
|||||||
[`@${path.basename(fullpath)}`]: fullpath
|
[`@${path.basename(fullpath)}`]: fullpath
|
||||||
}), {
|
}), {
|
||||||
'@root': FRONTEND,
|
'@root': FRONTEND,
|
||||||
'@ui': UI,
|
'@ui': UI
|
||||||
'@mock-states': MOCKSTATE
|
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
resolveLoader: {
|
resolveLoader: {
|
||||||
|
@ -14,7 +14,6 @@ module.exports = {
|
|||||||
'node_modules'
|
'node_modules'
|
||||||
],
|
],
|
||||||
FRONTEND: path.join(FRONTEND, 'src'),
|
FRONTEND: path.join(FRONTEND, 'src'),
|
||||||
MOCKSTATE: path.join(FRONTEND, 'src/mock-states'),
|
|
||||||
UI: process.env.NODE_ENV === 'production'
|
UI: process.env.NODE_ENV === 'production'
|
||||||
? path.join(FRONTEND, 'node_modules', '@tomgco/joyent-portal-ui', 'dist')
|
? path.join(FRONTEND, 'node_modules', '@tomgco/joyent-portal-ui', 'dist')
|
||||||
: path.join(UI, 'src'),
|
: path.join(UI, 'src'),
|
||||||
|
Loading…
Reference in New Issue
Block a user