Skip to content

Commit 26f92c4

Browse files
author
vinogradov
committed
update versions and example
1 parent 2feaed2 commit 26f92c4

File tree

5 files changed

+62
-78
lines changed

5 files changed

+62
-78
lines changed

.babelrc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"presets": [
3+
["env", {
4+
"modules": false
5+
}],
6+
"react"
7+
]
8+
}

README.md

Lines changed: 11 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,18 @@
1-
Starter Kit for a modern SPA application. Includes only the latest and greatest web technologies. Use it for your next heroic SPA project because you can't go wrong with it.
1+
React starter kit for a modern single page (SPA) application. Includes only the latest and greatest web technologies. Use it for your next heroic SPA project because you can't go wrong with it. Contains minimal viable "hello, world" code just to proof it works. Remove hello world and write your own great project.
22

33
# Includes
44

5-
* WebPack (build tool, module system, bundling, watch mode)
6-
* ES6 (Babel)
7-
* bundled
8-
* UglifyJs minified
9-
* UglifyJs compressed
10-
* UglifyJs mangled
11-
* ESLint
12-
* React (with React DOM)
13-
* SASS
14-
* bundled
15-
* UglifyJs minified
5+
* [React](https://facebook.github.io/react/) – a javascript library for building user interfaces
6+
* [Webpack 2](https://webpack.js.org/) – build tool, module system, bundling, minification, watch mode, ect. ([babel-loader](https://github.com/babel/babel-loader), [eslint-loader](https://github.com/MoOx/eslint-loader) and [sass-loader](https://github.com/webpack-contrib/sass-loader) included)
7+
* [Babel](https://babeljs.io/) – ES2015/2016/2017 support
8+
* [ESLint](http://eslint.org/) – the pluggable linting utility for JavaScript and JSX
9+
* [SASS](http://sass-lang.com/) – CSS with superpowers
1610

17-
# TODO
11+
# Usage
12+
`npm install`
1813

19-
* Tune ESLint
20-
* Redux
21-
* Redux Form 3.0
22-
* JSCS
23-
* Rollbar?
14+
for development purposes (watch mode with automatic browser refresh): `npm start` and go to http://localhost:8080/
2415

25-
### Tests:
16+
for distribution purposes (generate public static files): `npm run dist`
2617

27-
* karma
28-
* karma-coverage/istambul?
29-
* js-complexity-vz?
30-
31-
### Out of the box application skeleton:
32-
33-
* authorization
34-
* authentication
35-
* i18n by http://l20n.org
36-
37-
# Run
38-
npm install
39-
40-
for dev: npm start, http://localhost:8080/
41-
42-
for dist: npm run dist
18+
![](http://vinogradov.github.io/spa-starter-kit/screenshot.png)

package.json

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,22 @@
11
{
2-
"name": "spa-starter-kit",
2+
"name": "react-starter-kit",
33
"version": "1.0.0",
4-
"description": "Starter Kit for a modern SPA application. Includes only the latest and greatest web technologies. Use it for your next heroic SPA project because you can't go wrong with it",
4+
"description": "React starter kit for a modern single page application. Zero configuration. Ready to go. Just paste your code!",
55
"main": "index.js",
66
"scripts": {
77
"start": "webpack-dev-server",
88
"dist": "webpack --display-error-details --env.dist",
99
"test": "echo \"Error: no test specified\" && exit 1"
1010
},
11-
"author": "Vadim Vinogradov <[email protected]>",
1211
"license": "MIT",
1312
"dependencies": {
14-
"babel-core": "6.23.1",
15-
"babel-loader": "6.4.0",
16-
"babel-preset-env": "1.2.1",
13+
"babel-core": "6.24.0",
14+
"babel-loader": "6.4.1",
15+
"babel-preset-env": "1.2.2",
1716
"babel-preset-react": "6.23.0",
18-
"clean-webpack-plugin": "0.1.15",
19-
"css-loader": "0.27.2",
20-
"eslint": "3.17.1",
17+
"clean-webpack-plugin": "0.1.16",
18+
"css-loader": "0.27.3",
19+
"eslint": "3.18.0",
2120
"eslint-loader": "1.6.3",
2221
"eslint-plugin-react": "6.10.0",
2322
"extract-text-webpack-plugin": "2.1.0",
@@ -27,13 +26,13 @@
2726
"react": "15.4.2",
2827
"react-dom": "15.4.2",
2928
"sass-loader": "6.0.3",
30-
"style-loader": "0.13.2",
29+
"style-loader": "0.14.1",
3130
"webpack": "2.2.1"
3231
},
3332
"devDependencies": {
34-
"webpack-dev-server": "2.4.1"
33+
"webpack-dev-server": "2.4.2"
3534
},
36-
"engines" : {
37-
"node" : ">=7.5.0"
35+
"engines": {
36+
"node": ">=7.5.0"
3837
}
3938
}

src/helloWorldComponent/helloWorldComponent.js

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,36 @@ import * as ReactDOM from 'react-dom';
44
require('./helloWorldComponent.scss');
55

66
export default function() {
7-
const HelloMessage = React.createClass({
8-
propTypes: {
9-
name: React.PropTypes.string.isRequired
10-
},
7+
class HelloMessage extends React.Component {
8+
constructor(props) {
9+
super(props);
10+
this.state = {toggle: true};
11+
}
12+
13+
onClickHandler() {
14+
this.setState((prevState) => ({
15+
toggle: !prevState.toggle
16+
}));
17+
}
18+
1119
render() {
12-
return <div>Hello {this.props.name}</div>;
20+
return (
21+
<div>
22+
<div>Hello {this.props.name}</div>
23+
<button onClick={this.onClickHandler.bind(this)}>
24+
toggle: {this.state.toggle ? 'ON' : 'OFF'}
25+
</button>
26+
</div>
27+
);
1328
}
14-
});
29+
}
30+
31+
HelloMessage.propTypes = {
32+
name: React.PropTypes.string
33+
};
1534

16-
ReactDOM.render(<HelloMessage name="John"/>, document.querySelector('#app'));
35+
ReactDOM.render(
36+
<HelloMessage name="John"/>,
37+
document.querySelector('#app')
38+
);
1739
}

webpack.config.js

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,7 @@ module.exports = function (env) {
5555
test: /\.js$/,
5656
include: SRC_ABSOLUTE_PATH, // other paths are ignored
5757
use: [{
58-
loader: 'babel-loader',
59-
options: JSON.stringify({
60-
presets: [
61-
['env', {modules: false}],
62-
'react'
63-
]
64-
})
58+
loader: 'babel-loader'
6559
}, {
6660
// ESLint should be before any transpiling tools.
6761
// Or use preLoaders section to check source files, not modified by other loaders (like babel-loader)
@@ -98,19 +92,4 @@ module.exports = function (env) {
9892
}
9993
}
10094
}
101-
};
102-
103-
// in case of NODE API (http://webpack.github.io/docs/node.js-api.html):
104-
105-
// webpack({
106-
107-
// }, function(err, stats) {
108-
// }).watch({ // watch options:
109-
// debug: true,
110-
// aggregateTimeout: 300, // wait so long for more changes
111-
// poll: true // use polling instead of native watchers
112-
// // pass a number to set the polling interval
113-
114-
// }, function(err, stats) {
115-
// console.log(stats.toString({colors: true}));
116-
// });
95+
};

0 commit comments

Comments
 (0)