You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 11, 2018. It is now read-only.
This starter kit is designed to get you up and running with a bunch of awesome new front-end technologies, all on top of a configurable, feature-rich webpack build system that's already setup to provide hot reloading, CSS modules with Sass support, unit testing, code coverage reports, bundle splitting, and a whole lot more.
9
+
This starter kit is designed to get you up and running with a bunch of awesome new front-end technologies, all on top of a configurable, feature-rich webpack build system that's already setup to provide hot reloading, CSS preprocessing with Sass, unit testing, code coverage reports, bundle splitting, and more.
10
10
11
11
The primary goal of this project is to remain as **unopinionated** as possible. Its purpose is not to dictate your project structure or to demonstrate a complete sample application, but to provide a set of tools intended to make front-end development robust, easy, and, most importantly, fun. Check out the full feature list below!
12
12
@@ -40,7 +40,7 @@ Finally, This project wouldn't be possible without the help of our many contribu
│ ├── components # Global Reusable Presentational Components
106
+
│ ├── containers # Global Reusable Container Components
132
107
│ ├── layouts # Components that dictate major page structure
133
108
│ ├── redux # "Ducks" location...
134
109
│ │ └── modules # reducer, action, creators not part of a route
@@ -164,70 +139,17 @@ npm i --save-dev redux-devtools redux-devtools-log-monitor redux-devtools-dock-m
164
139
165
140
Then follow the [manual integration walkthrough](https://github.com/gaearon/redux-devtools/blob/master/docs/Walkthrough.md).
166
141
167
-
#### `redux-cli`
168
-
169
-
```bash
170
-
npm install redux-cli --save-dev
171
-
```
172
-
173
142
### Routing
174
143
We use `react-router`[route definitions](https://github.com/reactjs/react-router/blob/master/docs/API.md#plainroute) (`<route>/index.js`) to define units of logic within our application. See the [application structure](#application-structure) section for more information.
175
144
176
145
## Testing
177
-
To add a unit test, simply create a `.spec.js` file anywhere in `~/tests`. Karma will pick up on these files automatically, and Mocha and Chai will be available within your test without the need to import them. If you are using `redux-cli`, test files should automatically be generated when you create a component or redux module.
178
-
179
-
Coverage reports will be compiled to `~/coverage` by default. If you wish to change what reporters are used and where reports are compiled, you can do so by modifying `coverage_reporters` in `~/config/index.js`.
146
+
To add a unit test, simply create a `.spec.js` file anywhere in `~/tests`. Karma will pick up on these files automatically, and Mocha and Chai will be available within your test without the need to import them. Coverage reports will be compiled to `~/coverage` by default. If you wish to change what reporters are used and where reports are compiled, you can do so by modifying `coverage_reporters` in `~/config/index.js`.
180
147
181
148
## Deployment
182
149
Out of the box, this starter kit is deployable by serving the `~/dist` folder generated by `npm run deploy` (make sure to specify your target `NODE_ENV` as well). This project does not concern itself with the details of server-side rendering or API structure, since that demands an opinionated structure that makes it difficult to extend the starter kit. However, if you do need help with more advanced deployment strategies, here are a few tips:
183
150
184
151
### Static Deployments
185
-
If you are serving the application via a web server such as nginx, make sure to direct incoming routes to the root `~/dist/index.html` file and let react-router take care of the rest. If you are unsure of how to do this, you might find [this documentation](https://github.com/reactjs/react-router/blob/master/docs/guides/Histories.md#configuring-your-server) helpful. The Koa server that comes with the starter kit is able to be extended to serve as an API or whatever else you need, but that's entirely up to you.
186
-
187
-
### Heroku
188
-
189
-
Heroku has `nodejs buildpack` script that does the following when you deploy your app to Heroku.
190
-
1. Find `packages.json` in the root directory.
191
-
2. Install `nodejs` and `npm` packages.
192
-
3. Run `npm postinstall script`
193
-
4. Run `npm start`
194
-
195
-
Therefore, you need to modify `package.json` before deploying to Heroku. Make the following changes in the `scripts` section of `package.json`.
196
-
197
-
```
198
-
...
199
-
"start": "better-npm-run start:prod",
200
-
"serve": "better-npm-run start",
201
-
"postinstall": "npm run deploy:prod",
202
-
"betterScripts": {
203
-
...
204
-
"start:prod": {
205
-
"command": "babel-node bin/server",
206
-
"env": {
207
-
"NODE_ENV": "production"
208
-
}
209
-
}
210
-
...
211
-
},
212
-
```
213
-
214
-
It's also important to tell Heroku to install all `devDependencies` to successfully compile your app on Heroku's environment. Run the following in your terminal.
215
-
216
-
```bash
217
-
$ heroku config:set NPM_CONFIG_PRODUCTION=false
218
-
```
219
-
220
-
With this setup, you will install all the necessray packages, build your app, and start the webserver (e.g. koa) everytime you push your app to Heroku. Try to deploy to Heroku by running the following commands.
221
-
222
-
```bash
223
-
$ git add .
224
-
$ git commit -m 'My awesome commit'
225
-
$ git push heroku master
226
-
```
227
-
228
-
If you fail to deploy for an unknown reason, try [this helpful comment](https://github.com/davezuko/react-redux-starter-kit/issues/730#issuecomment-213997120) by [DonHansDampf](https://github.com/DonHansDampf) addressing Heroku deployments.
229
-
230
-
Have more questions? Feel free to submit an issue or join the Gitter chat!
152
+
If you are serving the application via a web server such as nginx, make sure to direct incoming routes to the root `~/dist/index.html` file and let react-router take care of the rest. If you are unsure of how to do this, you might find [this documentation](https://github.com/reactjs/react-router/blob/master/docs/guides/Histories.md#configuring-your-server) helpful. The Express server that comes with the starter kit is able to be extended to serve as an API or whatever else you need, but that's entirely up to you.
231
153
232
154
## Build System
233
155
@@ -241,13 +163,11 @@ If you need environment-specific overrides (useful for dynamically setting API e
241
163
|---|-----------|
242
164
|`dir_src`|application source code base path|
243
165
|`dir_dist`|path to build compiled application to|
244
-
|`server_host`|hostname for the Koa server|
245
-
|`server_port`|port for the Koa server|
246
-
|`compiler_css_modules`|whether or not to enable CSS modules|
166
+
|`server_host`|hostname for the Express server|
167
+
|`server_port`|port for the Express server|
247
168
|`compiler_devtool`|what type of source-maps to generate (set to `false`/`null` to disable)|
248
169
|`compiler_vendor`|packages to separate into to the vendor bundle|
249
170
250
-
251
171
### Root Resolve
252
172
Webpack is configured to make use of [resolve.root](http://webpack.github.io/docs/configuration.html#resolve-root), which lets you import local packages as if you were traversing from the root of your `~/src` directory. Here's an example:
253
173
@@ -275,11 +195,11 @@ These are global variables available to you anywhere in your source code. If you
275
195
276
196
### Styles
277
197
278
-
Both `.scss` and `.css` file extensions are supported out of the box and are configured to use [CSS Modules](https://github.com/css-modules/css-modules). After being imported, styles will be processed with [PostCSS](https://github.com/postcss/postcss) for minification and autoprefixing, and will be extracted to a `.css` file during production builds.
198
+
Both `.scss` and `.css` file extensions are supported out of the box. After being imported, styles will be processed with [PostCSS](https://github.com/postcss/postcss) for minification and autoprefixing, and will be extracted to a `.css` file during production builds.
279
199
280
200
### Server
281
201
282
-
This starter kit comes packaged with an Koa server. It's important to note that the sole purpose of this server is to provide `webpack-dev-middleware` and `webpack-hot-middleware` for hot module replacement. Using a custom Koa app in place of [webpack-dev-server](https://github.com/webpack/webpack-dev-server) makes it easier to extend the starter kit to include functionality such as API's, universal rendering, and more -- all without bloating the base boilerplate.
202
+
This starter kit comes packaged with an Express server. It's important to note that the sole purpose of this server is to provide `webpack-dev-middleware` and `webpack-hot-middleware` for hot module replacement. Using a custom Express app in place of [webpack-dev-server](https://github.com/webpack/webpack-dev-server) makes it easier to extend the starter kit to include functionality such as API's, universal rendering, and more -- all without bloating the base boilerplate.
0 commit comments