Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
fedosejev committed Oct 16, 2016
1 parent 0fb4264 commit 77f8e5e
Show file tree
Hide file tree
Showing 12 changed files with 1,158 additions and 1,933 deletions.
42 changes: 23 additions & 19 deletions README.md
@@ -1,39 +1,43 @@
# Shopping List with React.js, Redux and ES2015
# Shopping List with React.js, Redux and ES2015.

Basic shopping list implemented with React.js (`v15`), Redux, ES2015 and Twitter Bootstrap (`v3`).
Basic shopping list implemented with React.js (`v15`) and Twitter Bootstrap (`v3`).

### Live
Uses Webpack, [Yarn](https://code.facebook.com/posts/1840075619545360).

https://fedosejev.github.io/shopping-list-react-redux/
### Live

### Other versions

+ [React.js and ES5](https://github.com/fedosejev/shopping-list-react)
+ [React.js and ES2015](https://github.com/fedosejev/shopping-list-react-es2015)
+ [React.js, Flux and ES5](https://github.com/fedosejev/shopping-list-react-flux)
http://fedosejev.github.io/shopping-list-react-redux/

## Install

`npm install`
1. `npm install -g yarn`
2. `yarn install`

## Build
#### What is Yarn?
+ https://code.facebook.com/posts/1840075619545360
+ https://scotch.io/tutorials/yarn-package-manager-an-improvement-over-npm

#### In development environment:
## Run

`npm run build-for-development`
1. `npm start`
2. Open `http://localhost:8080` in a web browser.

#### In production environment:
## Build

`npm run build-for-production`
`npm run build`

## Run
## Other versions

1. `./serve.sh`
2. Open `http://localhost:8080` in a web browser.
+ [React.js and ES5](https://github.com/fedosejev/shopping-list-react)
+ [React.js and ES2015](https://github.com/fedosejev/shopping-list-react-es2015)
+ [React.js and Flux (ES5)](https://github.com/fedosejev/shopping-list-react-flux)

## Author

[Artemij Fedosejev](http://artemij.com)
Artemij Fedosejev
+ [Website](http://artemij.com)
+ [LinkedIn](https://www.linkedin.com/in/artemij)
+ [React.Tips](http://react.tips)

## License

Expand Down
4 changes: 2 additions & 2 deletions build/index.html
@@ -1,3 +1,3 @@
<!doctype html><html lang="en"><head><meta charset="utf-8"><meta http-equiv="x-ua-compatible" content="ie=edge, chrome=1"><title>Shopping List</title><link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css"><style>ul {
<!doctype html><html lang="en"><head><meta charset="utf-8"><meta http-equiv="x-ua-compatible" content="ie=edge, chrome=1"><title>Shopping List</title><link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css"><style>ul {
padding-left: 0;
}</style></head><body><div data-react-application><h5 class="text-center text-muted">Loading application...</h5></div><script src="js/shopping-list.js"></script></body></html>
}</style></head><body><div data-react-application><h5 class="text-center text-muted">Loading application...</h5></div><script type="text/javascript" src="js/shopping-list.js"></script></body></html>
38 changes: 19 additions & 19 deletions build/js/shopping-list.js

Large diffs are not rendered by default.

54 changes: 0 additions & 54 deletions gulpfile.js

This file was deleted.

24 changes: 11 additions & 13 deletions package.json
Expand Up @@ -2,8 +2,10 @@
"name": "shopping-list-react-redux",
"version": "1.0.0",
"description": "Basic shopping list implemented with React.js and Redux.",
"main": "gulpfile.js",
"main": "",
"scripts": {
"start": "webpack-dev-server --hot --inline --progress --colors",
"build": "webpack -p --config ./webpack.production.config.js",
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
Expand All @@ -25,18 +27,14 @@
"redux": "^3.6.0"
},
"devDependencies": {
"babel-cli": "^6.16.0",
"babel-plugin-transform-object-rest-spread": "^6.16.0",
"babel-core": "^6.17.0",
"babel-loader": "^6.2.5",
"babel-preset-es2015": "^6.16.0",
"babel-preset-es2016": "^6.16.0",
"babel-preset-latest": "^6.16.0",
"babel-preset-react": "^6.11.1",
"babelify": "^7.3.0",
"browserify": "^13.1.0",
"gulp": "^3.9.1",
"gulp-html-minifier": "^0.1.8",
"gulp-uglify": "^2.0.0",
"vinyl-buffer": "^1.0.0",
"vinyl-source-stream": "^1.1.0"
"babel-preset-react": "^6.16.0",
"babel-preset-stage-2": "^6.17.0",
"html-minify-loader": "^1.1.0",
"html-webpack-plugin": "^2.22.0",
"webpack": "^1.13.2",
"webpack-dev-server": "^1.16.2"
}
}
5 changes: 4 additions & 1 deletion publish.sh
@@ -1,9 +1,12 @@
#!/bin/bash

gulp build-for-production
# Build content and static files
npm run build

# Commit and push
git add .
git commit -m "Update"
git push

# Deploy on GitHub Pages
git subtree push --prefix build origin gh-pages
3 changes: 1 addition & 2 deletions source/index.html → source/index.ejs
Expand Up @@ -4,7 +4,7 @@
<meta charset="utf-8" />
<meta http-equiv="x-ua-compatible" content="ie=edge, chrome=1" />
<title>Shopping List</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css">
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css">
<style>
ul {
padding-left: 0;
Expand All @@ -15,6 +15,5 @@
<div data-react-application>
<h5 class="text-center text-muted">Loading application...</h5>
</div>
<script src="js/shopping-list.js"></script>
</body>
</html>
4 changes: 2 additions & 2 deletions source/js/index.js
@@ -1,11 +1,11 @@
import React from 'react';
import { render } from 'react-dom';
import { Provider } from 'react-redux';
import { createStore } from 'redux';
import { createStore, compose } from 'redux';
import listItems from './reducers/ListItems';
import ShoppingListContainer from './components/ShoppingListContainer';

const store = createStore(listItems);
const store = createStore(listItems, compose(window.devToolsExtension ? window.devToolsExtension() : f => f));

render(
<Provider store={store}>
Expand Down
5 changes: 5 additions & 0 deletions update.sh
@@ -0,0 +1,5 @@
#!/bin/bash

git add .
git commit -m "Update"
git push
27 changes: 27 additions & 0 deletions webpack.config.js
@@ -0,0 +1,27 @@
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');

module.exports = {
entry: './source/js/index.js',
output: {
path: './build/',
filename: 'js/shopping-list.js'
},
module: {
loaders: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel',
query: {
presets: ['es2015', 'react', 'stage-2']
}
}
]
},
plugins: [
new HtmlWebpackPlugin({
template: './source/index.ejs'
})
]
};
41 changes: 41 additions & 0 deletions webpack.production.config.js
@@ -0,0 +1,41 @@
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');

module.exports = {
entry: './source/js/index.js',
output: {
path: './build/',
filename: 'js/shopping-list.js'
},
module: {
loaders: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel',
query: {
presets: ['es2015', 'react']
}
}
]
},
plugins: [
new webpack.DefinePlugin({
'process.env':{
'NODE_ENV': JSON.stringify('production')
}
}),
new webpack.optimize.UglifyJsPlugin({
compressor: {
warnings: false,
},
}),
new HtmlWebpackPlugin({
template: './source/index.ejs',
minify: {
html5: true,
collapseWhitespace: true
}
})
]
};

0 comments on commit 77f8e5e

Please sign in to comment.