Skip to content

Commit 53351b2

Browse files
author
lewis617
committed
undo
1 parent b421e1f commit 53351b2

31 files changed

+820
-0
lines changed

redux-undo-boilerplate/.babelrc

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"stage": 0,
3+
"env": {
4+
// this plugin will be included only in development mode, e.g.
5+
// if NODE_ENV (or BABEL_ENV) environment variable is not set
6+
// or is equal to "development"
7+
"development/client": {
8+
"plugins": [
9+
// Include babel-plugin-react-display-name if you’re
10+
// using React.createClass() *before* react-transform:
11+
// "react-display-name",
12+
"react-transform"
13+
],
14+
"extra": {
15+
// must be defined and be an array
16+
"react-transform": {
17+
"transforms": [{
18+
// can be an NPM module name or a local path
19+
"transform": "react-transform-hmr",
20+
// see specific transform's docs for "imports" and "locals" it needs
21+
"imports": ["react"],
22+
"locals": ["module"]
23+
}, {
24+
// you can have many transforms, not just one
25+
"transform": "react-transform-catch-errors",
26+
"imports": ["react", "redbox-react"]
27+
}]
28+
}
29+
}
30+
}
31+
}
32+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
root = true
2+
3+
[*]
4+
indent_style = tab
5+
end_of_line = lf
6+
charset = utf-8
7+
trim_trailing_whitespace = true
8+
insert_final_newline = true
9+
10+
[*.{json,js,yml}]
11+
indent_style = space
12+
indent_size = 2
13+
14+
[.eslintrc]
15+
indent_style = space
16+
indent_size = 2
17+
18+
[*.md]
19+
trim_trailing_whitespace = false

redux-undo-boilerplate/.eslintrc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"extends": "standard",
3+
"parser": "babel-eslint",
4+
"ecmaFeatures": {
5+
"jsx": true
6+
},
7+
"env": {
8+
"browser": true,
9+
"mocha": true,
10+
"node": true
11+
}
12+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* text=auto

redux-undo-boilerplate/.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.DS_Store
2+
npm-debug.log
3+
node_modules
4+
coverage
5+
dist

redux-undo-boilerplate/.travis.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
sudo: false
2+
language: node_js
3+
node_js:
4+
- "4.0.0"
5+
script:
6+
- "npm run lint"
7+
- "npm run test:cov"
8+
after_script: "npm install coveralls@2 && cat ./coverage/lcov.info | coveralls"
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# 0.1.0 (2015/x/x)
2+
3+
#### Features
4+
5+
- **A:**
6+
- **B:**
7+
8+
#### Bugs Fixed
9+
10+
- **C:**

redux-undo-boilerplate/LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2015 Daniel Bugl <[email protected]> (https://github.com/omnidan)
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

redux-undo-boilerplate/README.md

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
# redux-undo-boilerplate
2+
3+
![Version 0.4.2](https://img.shields.io/badge/version-0.4.2-blue.svg?style=flat-square) [![Build Status](https://img.shields.io/travis/omnidan/redux-undo-boilerplate/master.svg?style=flat-square)](https://travis-ci.org/omnidan/redux-undo-boilerplate) [![Dependency Status](https://img.shields.io/david/omnidan/redux-undo-boilerplate.svg?style=flat-square)](https://david-dm.org/omnidan/redux-undo-boilerplate) [![devDependency Status](https://david-dm.org/omnidan/redux-undo-boilerplate/dev-status.svg?style=flat-square)](https://david-dm.org/omnidan/redux-undo-boilerplate#info=devDependencies) [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](http://standardjs.com/) [![https://gratipay.com/omnidan/](https://img.shields.io/gratipay/omnidan.svg?style=flat-square)](https://gratipay.com/omnidan/)
4+
5+
_a magical boilerplate with [hot reloading](#what-happens-if-i-change-some-code) and [awesome error handling™](#what-happens-if-i-make-a-typo--syntax-error) that uses [webpack](https://github.com/webpack/webpack), [redux](https://github.com/rackt/redux), [react](https://github.com/facebook/react) and [redux-undo](https://github.com/omnidan/redux-undo)_
6+
7+
8+
## Installation
9+
10+
You need to have `npm` installed (it comes with [node.js](https://nodejs.org/)).
11+
12+
```sh
13+
npm install
14+
```
15+
16+
17+
## Running
18+
19+
During development, run:
20+
21+
```sh
22+
npm run dev
23+
```
24+
25+
Which enables some development tools.
26+
27+
In production, run:
28+
29+
```sh
30+
npm start
31+
```
32+
33+
These commands (unless configured otherwise) start a web server at: [http://localhost:3000](http://localhost:3000)
34+
35+
36+
## Demo
37+
38+
[![https://i.imgur.com/M2KR4uo.gif](https://i.imgur.com/M2KR4uo.gif)](https://i.imgur.com/M2KR4uo.gif)
39+
40+
### What happens if I change some code?
41+
42+
Save the file in your editor and immediately see the changes reflected in your
43+
browser - coding has never been more efficient. What a beautiful world we live
44+
in nowadays.
45+
46+
[![http://i.imgur.com/VCxUA2b.gif](http://i.imgur.com/VCxUA2b.gif)](http://i.imgur.com/VCxUA2b.gif)
47+
48+
### What happens if I make a typo / syntax error?
49+
50+
Many of us know this: You accidentally type in the wrong window once, add a
51+
random character to your code and when you run it again you're like "WTF this
52+
just worked?!" - let `webpack-hot-middleware` help you out with this:
53+
54+
[![http://i.imgur.com/DTnGNFE.gif](http://i.imgur.com/DTnGNFE.gif)](http://i.imgur.com/DTnGNFE.gif)
55+
56+
### What happens if I mutate the state directly?
57+
58+
Mutating the state directly causes lots of bugs with Redux. There are no
59+
immutables in JavaScript, so we can't make sure this doesn't happen unless we
60+
use something like [Immutable.js](https://facebook.github.io/immutable-js/).
61+
62+
If you run this boilerplate in dev mode (`npm run dev`), it will tell you when
63+
you [mutate something directly](https://github.com/omnidan/redux-undo-boilerplate/blob/master/src/reducers/counter.js#L9):
64+
65+
[![https://i.imgur.com/y02EDxc.png](https://i.imgur.com/y02EDxc.png)](https://i.imgur.com/y02EDxc.png)
66+
67+
68+
## Testing
69+
70+
```sh
71+
npm test
72+
```
73+
74+
75+
## Thanks
76+
77+
Special thanks to these awesome projects/people making this possible :heart:
78+
79+
* [React](https://facebook.github.io/react/)
80+
* [Redux](https://rackt.github.io/redux/)
81+
* [Babel](https://babeljs.io/) - for ES6 support
82+
* [redux-boilerplate](https://github.com/chentsulin/redux-boilerplate) by [chentsulin](https://github.com/chentsulin) - this boilerplate is based off his project
83+
* [babel-plugin-react-transform](https://github.com/gaearon/babel-plugin-react-transform) by [gaearon](https://github.com/gaearon) - as a base for the hot reloading and error handling
84+
* [react-transform-catch-errors](https://github.com/gaearon/react-transform-catch-errors) by [gaearon](https://github.com/gaearon) - error handling
85+
* [react-transform-hmr](https://github.com/gaearon/react-transform-hmr) by [gaearon](https://github.com/gaearon) - hot reloading
86+
* [redux-devtools](https://github.com/gaearon/redux-devtools) by [gaearon](https://github.com/gaearon)
87+
* [redux-immutable-state-invariant](https://github.com/leoasis/redux-immutable-state-invariant) by [leoasis](https://github.com/leoasis) - detect state mutations
88+
89+
90+
## License
91+
92+
redux-boilerplate: MIT © [C.T. Lin](https://github.com/chentsulin)
93+
94+
redux-undo-boilerplate: MIT © [Daniel Bugl](https://github.com/omnidan)

redux-undo-boilerplate/index.html

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<html>
2+
<head>
3+
<title>Redux counter example</title>
4+
</head>
5+
<body>
6+
<div id="root">
7+
</div>
8+
</body>
9+
<script src="/static/bundle.js"></script>
10+
</html>

0 commit comments

Comments
 (0)