Skip to content

Commit d08f40e

Browse files
chqy24gondzo
authored and
gondzo
committed
f2f challenge 30056013
1 parent 7dbee71 commit d08f40e

File tree

18 files changed

+96
-17
lines changed

18 files changed

+96
-17
lines changed

Procfile

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
web: npm run start

README.md

+21
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,24 @@ See Guild https://github.com/lorenwest/node-config/wiki/Configuration-Files
3434
|`lint:fix`|Lint and fix all `.js` files. [Read more on this](http://eslint.org/docs/user-guide/command-line-interface.html#fix).|
3535
|`test`|Run tests using [mocha-webpack](https://github.com/webpack/mocha-loader) for all `*.spec.(js|jsx)` files in the `src` dir.|
3636

37+
## Local deploy
38+
NODE_ENV=production npm run build
39+
NODE_ENV=production npm run start
40+
41+
## Heroku deploy
42+
43+
### Prerequisites
44+
- Heroku CLI
45+
46+
### set up
47+
npm run heroku:[ENV]:init
48+
npm run heroku:[ENV]:deploy
49+
50+
### update
51+
npm run heroku:[ENV]:deploy
52+
53+
`npm run heroku:[ENV]:init` will create a new git remote in current git repository and a new app in remote server.
54+
55+
`npm run heroku:[ENV]:deploy` line will push current branch to corresponding remote environment.
56+
57+
`ENV` can be 'prod', 'dev', 'staging', 'test'.

config/development.js

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/* eslint-disable import/no-commonjs */
2+
/**
3+
* Main config file
4+
*/
5+
module.exports = {
6+
// below env variables are NOT visible in frontend
7+
PORT: process.env.PORT || 3000,
8+
9+
// below env variables are visible in frontend
10+
GOOGLE_API_KEY: process.env.GOOGLE_API_KEY || 'AIzaSyCrL-O319wNJK8kk8J_JAYsWgu6yo5YsDI',
11+
API_BASE_PATH: process.env.API_BASE_PATH || 'https://kb-dsp-server-dev.herokuapp.com',
12+
};

config/production.js

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/* eslint-disable import/no-commonjs */
2+
/**
3+
* config file for production environment
4+
*/
5+
module.exports = {
6+
// below env variables are NOT visible in frontend
7+
PORT: process.env.PORT || 3000,
8+
9+
// below env variables are visible in frontend
10+
GOOGLE_API_KEY: process.env.GOOGLE_API_KEY || 'AIzaSyCrL-O319wNJK8kk8J_JAYsWgu6yo5YsDI',
11+
API_BASE_PATH: process.env.API_BASE_PATH || 'https://kb-dsp-server-dev.herokuapp.com',
12+
};

config/staging.js

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/* eslint-disable import/no-commonjs */
2+
/**
3+
* Main config file
4+
*/
5+
module.exports = {
6+
// below env variables are NOT visible in frontend
7+
PORT: process.env.PORT || 3000,
8+
9+
// below env variables are visible in frontend
10+
GOOGLE_API_KEY: process.env.GOOGLE_API_KEY || 'AIzaSyCrL-O319wNJK8kk8J_JAYsWgu6yo5YsDI',
11+
API_BASE_PATH: process.env.API_BASE_PATH || 'https://kb-dsp-server-dev.herokuapp.com',
12+
};

config/test.js

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/* eslint-disable import/no-commonjs */
2+
/**
3+
* Main config file
4+
*/
5+
module.exports = {
6+
// below env variables are NOT visible in frontend
7+
PORT: process.env.PORT || 3000,
8+
9+
// below env variables are visible in frontend
10+
GOOGLE_API_KEY: process.env.GOOGLE_API_KEY || 'AIzaSyCrL-O319wNJK8kk8J_JAYsWgu6yo5YsDI',
11+
API_BASE_PATH: process.env.API_BASE_PATH || 'https://kb-dsp-server-dev.herokuapp.com',
12+
};

package.json

+12-3
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,20 @@
55
"main": "index.js",
66
"scripts": {
77
"dev": "cross-env NODE_ENV=development nodemon server",
8-
"start": "cross-env NODE_ENV=production node server",
9-
"build": "cross-env NODE_ENV=production webpack --bail --progress --build --tc",
8+
"start": "node --max-old-space-size=512 server",
9+
"build": "node --max-old-space-size=512 ./node_modules/webpack/bin/webpack --bail --progress --build --tc",
1010
"lint": "eslint --ext jsx --ext js .",
1111
"lint:fix": "npm run lint -- --fix",
12-
"test": "mocha-webpack --require setup-test.js --webpack-config webpack.config-test.js \"src/**/*.spec.(jsx|js)\""
12+
"test": "mocha-webpack --require setup-test.js --webpack-config webpack.config-test.js \"src/**/*.spec.(jsx|js)\"",
13+
"postinstall":"npm run build",
14+
"heroku:prod:init":"git remote remove production && heroku create --remote production && heroku config:set NODE_ENV=production --remote production",
15+
"heroku:dev:init": "git remote remove dev && heroku create --remote dev && heroku config:set NODE_ENV=development NPM_CONFIG_PRODUCTION=false --remote dev",
16+
"heroku:staging:init": "git remote remove staging && heroku create --remote staging && heroku config:set NODE_ENV=staging --remote staging",
17+
"heroku:test:init": "git remote remove test && heroku create --remote test && heroku config:set NODE_ENV=test --remote test",
18+
"heroku:prod:deploy":"git push production master",
19+
"heroku:dev:deploy":"git push dev master",
20+
"heroku:staging:deploy":"git push staging master",
21+
"heroku:test:deploy":"git push test master"
1322
},
1423
"author": "",
1524
"license": "MIT",

src/components/Header/Header.jsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React, { PropTypes } from 'react';
22
import CSSModules from 'react-css-modules';
33
import { Link } from 'react-router';
4-
import LogInModalContainer from 'routes/Home/containers/LogInModalContainer';
4+
import LogInModalContainer from 'routes/Home/containers/LoginModalContainer';
55
import SignupModalContainer from 'routes/Home/containers/SignupModalContainer';
66
import SearchInput from '../SearchInput';
77
import Dropdown from '../Dropdown';

src/routes/DroneDetails/components/DroneScheduleTable/DroneScheduleTable.jsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, { PropTypes } from 'react';
22
import CSSModules from 'react-css-modules';
3-
import Reactable from 'Reactable';
3+
import Reactable from 'reactable';
44
import styles from './DroneScheduleTable.scss';
55

66
const Table = Reactable.Table;
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
import feedbackItem from './feedbackItem';
1+
import FeedbackItem from './FeedbackItem';
22

3-
export default feedbackItem;
3+
export default FeedbackItem;

src/routes/Home/components/LoginModal/LoginModal.jsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import Modal from 'react-modal';
77
import Button from 'components/Button';
88
import Checkbox from 'components/Checkbox';
99
import TextField from 'components/TextField';
10-
import styles from './LogInModal.scss';
10+
import styles from './LoginModal.scss';
1111
const { DOM: { input } } = React;
1212

1313
import UserApi from 'api/User.js';
@@ -168,7 +168,7 @@ class LogInModal extends React.Component {
168168
</form>
169169
</Modal>
170170

171-
171+
172172
</div>
173173
);
174174
}
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
import LogInModal from './LogInModal';
1+
import LoginModal from './LoginModal';
22

3-
export default LogInModal;
3+
export default LoginModal;

src/routes/Home/containers/LoginModalContainer.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { connect } from 'react-redux';
22
import {actions, sendLoginRequest, loginAction} from '../../../store/modules/global';
33

4-
import LogInModal from '../components/LogInModal';
4+
import LogInModal from '../components/LoginModal';
55

66
const mapState = (state) => ({...state.global, onSubmit: sendLoginRequest});
77

src/routes/MyDrone/components/MyDronesTable/MyDronesTable.jsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, { PropTypes, Component } from 'react';
2-
import Reactable from 'Reactable';
2+
import Reactable from 'reactable';
33
import CSSModules from 'react-css-modules';
44
import Dropdown from 'react-dropdown';
55
import styles from './MyDronesTable.scss';

src/routes/MyDrone/modules/MyDrone.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/routes/MyServices/components/MyServicesTable/MyServicesTable.jsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, { PropTypes, Component } from 'react';
2-
import Reactable from 'Reactable';
2+
import Reactable from 'reactable';
33
import CSSModules from 'react-css-modules';
44
import Dropdown from 'react-dropdown';
55
import styles from './MyServicesTable.scss';

src/routes/MyServices/modules/MyServices.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

webpack.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ module.exports = {
9393
output: {
9494
filename: '[name].[hash].js',
9595
path: path.join(__dirname, './dist'),
96-
publicPath: __DEV__ ? `http://${ip.address()}:${process.env.PORT || 3000}/` : '/',
96+
publicPath: '/',
9797
},
9898
plugins: [
9999
new webpack.DefinePlugin({

0 commit comments

Comments
 (0)