Skip to content

Commit a9ec621

Browse files
committed
update webpack configs to pure node 6x
1 parent 47483ca commit a9ec621

17 files changed

+5896
-285
lines changed

package.json

+11-10
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
11
{
22
"engine": {
3-
"node" : "^6.5.0",
3+
"node": "^6.5.0",
44
"npm": "*"
55
},
66
"name": "react-redux-graphql-apollo-bootstrap-webpack-starter",
7-
"version": "0.1.1",
7+
"version": "0.2.0",
88
"description": "react js + redux + graphQL + Apollo + react router + hot reload + devTools + bootstrap + webpack starter",
99
"main": "src/index.js",
1010
"scripts": {
1111
"dev": "NODE_ENV=dev webpack",
12-
"test": "NODE_ENV=test nyc mocha test/.setup.js test/**/*.spec.js --compilers js:babel-core/register --recursive",
13-
"prod": "NODE_ENV=production webpack -p --config webpack.production.config.babel.js ",
14-
"start": "NODE_ENV=dev babel-node --presets es2015 ./server.hot.reload.js",
15-
"dev-win": "setx NODE_ENV=dev webpack",
16-
"test-win": "setx NODE_ENV=test nyc mocha test/.setup.js test/**/*.spec.js --compilers js:babel-core/register --recursive",
17-
"prod-win": "setx NODE_ENV=production webpack -p --config webpack.production.config.babel.js ",
18-
"start-win": "setx NODE_ENV=dev babel-node --presets es2015 ./server.hot.reload.js"
12+
"test": "NODE_ENV=test nyc mocha test/.setup.js test/**/*.spec.js --recursive",
13+
"coverage": "nyc report --reporter=text-lcov | coveralls",
14+
"prod": "NODE_ENV=production webpack -p --config webpack.production.config.js ",
15+
"start": "NODE_ENV=dev node server.hot.reload",
16+
"dev-win": "set NODE_ENV=dev && webpack",
17+
"test-win": "set NODE_ENV=test && nyc mocha test/.setup.js test/**/*.spec.js --recursive",
18+
"prod-win": "set NODE_ENV=production && webpack -p --config webpack.production.config.js ",
19+
"start-win": "set NODE_ENV=dev && node server.hot.reload"
1920
},
2021
"keywords": [
2122
"react",
@@ -108,7 +109,7 @@
108109
"react-redux": "^4.4.1",
109110
"react-router": "^2.0.0",
110111
"react-router-redux": "^4.0.1",
111-
"react-tap-event-plugin": "^0.2.2",
112+
"react-tap-event-plugin": "^2.0.1",
112113
"redux": "^3.3.1",
113114
"redux-thunk": "^2.0.1",
114115
"whatwg-fetch": "^1.0.0"

server.hot.reload.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* eslint-disable no-var, no-console */
2-
import webpack from 'webpack';
3-
import WebpackDevServer from 'webpack-dev-server';
4-
import config from './webpack.hot.reload.config.babel';
2+
const webpack = require('webpack');
3+
const WebpackDevServer = require('webpack-dev-server');
4+
const config = require('./webpack.hot.reload.config');
55

66
new WebpackDevServer(
77
webpack(config), {

src/app/config/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
export const appConfig = {
22
// apollo client:
33
apollo: {
4-
networkInterface: 'https://v2.api.scaphold.io/graphql/flawless-basketball' // exemple: http://localhost:8080/graphql
4+
networkInterface: '' // exemple: http://localhost:8080/graphql
55
}
66
};

src/app/redux/modules/views.js

+31-51
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,12 @@ const initialState = {
2727
};
2828

2929
export default function (state = initialState, action) {
30-
switch (action.type) {
30+
const currentTime = moment().format(dateFormat);
3131

32+
switch (action.type) {
33+
// /////////////////////
3234
// non protected views:
35+
// /////////////////////
3336
case ENTER_HOME_VIEW:
3437
case ENTER_ABOUT_VIEW:
3538
case ENTER_LOGIN_VIEW:
@@ -38,9 +41,8 @@ export default function (state = initialState, action) {
3841
if (state.currentView !== action.currentView) {
3942
return {
4043
...state,
41-
currentView: action.currentView,
42-
enterTime: action.enterTime,
43-
leaveTime: action.leaveTime
44+
currentView: action.currentView,
45+
enterTime: currentTime
4446
};
4547
}
4648
return state;
@@ -53,20 +55,19 @@ export default function (state = initialState, action) {
5355
return {
5456
...state,
5557
currentView: action.currentView,
56-
enterTime: action.enterTime,
57-
leaveTime: action.leaveTime
58+
leaveTime: currentTime
5859
};
5960
}
6061
return state;
61-
62+
// /////////////////////
6263
// protected views:
64+
// /////////////////////
6365
case ENTER_PROTECTED_VIEW:
6466
if (state.currentView !== action.currentView) {
6567
return {
6668
...state,
6769
currentView: action.currentView,
68-
enterTime: action.enterTime,
69-
leaveTime: action.leaveTime
70+
enterTime: currentTime
7071
};
7172
}
7273
return state;
@@ -75,8 +76,7 @@ export default function (state = initialState, action) {
7576
return {
7677
...state,
7778
currentView: action.currentView,
78-
enterTime: action.enterTime,
79-
leaveTime: action.leaveTime
79+
leaveTime: currentTime
8080
};
8181
}
8282
return state;
@@ -90,87 +90,67 @@ export default function (state = initialState, action) {
9090
/* -----------------------------------------
9191
Reducer
9292
------------------------------------------*/
93-
export function enterHome(time = moment().format(dateFormat)) {
93+
export function enterHome() {
9494
return {
9595
type: ENTER_HOME_VIEW,
96-
currentView: 'home',
97-
enterTime: time,
98-
leaveTime: null
96+
currentView: 'home'
9997
};
10098
}
101-
export function leaveHome(time = moment().format(dateFormat)) {
99+
export function leaveHome() {
102100
return {
103101
type: LEAVE_HOME_VIEW,
104-
currentView: 'home',
105-
enterTime: null,
106-
leaveTime: time
102+
currentView: 'home'
107103
};
108104
}
109105

110-
export function enterAbout(time = moment().format(dateFormat)) {
106+
export function enterAbout() {
111107
return {
112108
type: ENTER_ABOUT_VIEW,
113-
currentView: 'about',
114-
enterTime: time,
115-
leaveTime: null
109+
currentView: 'about'
116110
};
117111
}
118-
export function leaveAbout(time = moment().format(dateFormat)) {
112+
export function leaveAbout() {
119113
return {
120114
type: LEAVE_ABOUT_VIEW,
121-
currentView: 'about',
122-
enterTime: null,
123-
leaveTime: time
115+
currentView: 'about'
124116
};
125117
}
126118

127-
export function enterLogin(time = moment().format(dateFormat)) {
119+
export function enterLogin() {
128120
return {
129121
type: ENTER_LOGIN_VIEW,
130-
currentView: 'login',
131-
enterTime: time,
132-
leaveTime: null
122+
currentView: 'login'
133123
};
134124
}
135-
export function leaveLogin(time = moment().format(dateFormat)) {
125+
export function leaveLogin() {
136126
return {
137127
type: LEAVE_LOGIN_VIEW,
138-
currentView: 'login',
139-
enterTime: null,
140-
leaveTime: time
128+
currentView: 'login'
141129
};
142130
}
143131

144-
export function enterRegister(time = moment().format(dateFormat)) {
132+
export function enterRegister() {
145133
return {
146134
type: ENTER_REGISTER_VIEW,
147-
currentView: 'register',
148-
enterTime: time,
149-
leaveTime: null
135+
currentView: 'register'
150136
};
151137
}
152-
export function leaveRegister(time = moment().format(dateFormat)) {
138+
export function leaveRegister() {
153139
return {
154140
type: LEAVE_REGISTER_VIEW,
155-
currentView: 'register',
156-
enterTime: null,
157-
leaveTime: time
141+
currentView: 'register'
158142
};
159143
}
160144

161-
export function enterProtected(time = moment().format(dateFormat)) {
145+
export function enterProtected() {
162146
return {
163147
type: ENTER_PROTECTED_VIEW,
164-
currentView: 'protected',
165-
enterTime: time,
166-
leaveTime: null
148+
currentView: 'protected'
167149
};
168150
}
169-
export function leaveProtected(time = moment().format(dateFormat)) {
151+
export function leaveProtected() {
170152
return {
171153
type: LEAVE_PROTECTED_VIEW,
172-
currentView: 'protected',
173-
enterTime: null,
174-
leaveTime: time
154+
currentView: 'protected'
175155
};
176156
}

src/app/routes/Route.js

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import {
55
Router,
66
Route,
77
IndexRoute,
8-
// hashHistory,
98
browserHistory
109
} from 'react-router';
1110
// import { Provider } from 'react-redux';

src/app/services/API/example.js

-17
This file was deleted.

src/app/services/fetchTools.js

-53
This file was deleted.

src/app/services/index.js

-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
import * as fetchTools from './fetchTools';
2-
import {getSomething} from './API/example';
32
import { apolloClient } from './apollo';
43

54
export {
65
// fetch tools:
76
fetchTools,
8-
// API:
9-
getSomething,
107
// apollo client
118
apolloClient
129
};

test/.setup.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
import { jsdom } from 'jsdom';
1+
require('babel-register')();
2+
3+
const { jsdom } = require('jsdom');
24

35
const exposedProperties = ['window', 'navigator', 'document'];
46

test/containers/components/Components.spec.js

-26
This file was deleted.

0 commit comments

Comments
 (0)