Skip to content

Commit b7a41b6

Browse files
committed
Initial commit
0 parents  commit b7a41b6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+11037
-0
lines changed

.babelrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"presets": [
3+
"es2015"
4+
]
5+
}

.eslintrc.json

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
"env": {
3+
"browser": true,
4+
"es6": true
5+
},
6+
"extends": "eslint:recommended",
7+
"parserOptions": {
8+
"ecmaFeatures": {
9+
"experimentalObjectRestSpread": true,
10+
"jsx": true
11+
},
12+
"sourceType": "module"
13+
},
14+
"plugins": [
15+
"react"
16+
],
17+
"rules": {
18+
"indent": [
19+
"error",
20+
2
21+
],
22+
"linebreak-style": [
23+
"error",
24+
"unix"
25+
],
26+
"quotes": [
27+
"error",
28+
"single"
29+
],
30+
"semi": [
31+
"error",
32+
"always"
33+
],
34+
"react/jsx-uses-react": "error",
35+
"react/jsx-uses-vars": "error"
36+
}
37+
}

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/.idea/
2+
/node_modules/
3+
/public/
4+
*.log

config/base.js

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
'use strict';
2+
/* global module */
3+
/* global __dirname */
4+
/* global require */
5+
6+
const path = require('path');
7+
const webpack = require('webpack');
8+
const HtmlWebpack = require('html-webpack-plugin');
9+
const WebpackManifest = require('webpack-manifest-plugin');
10+
const CleanWebpackPlugin = require('clean-webpack-plugin');
11+
const WebpackChunkHash = require('webpack-chunk-hash');
12+
const rootDir = path.resolve(__dirname, '..');
13+
const CopyWebpackPlugin = require('copy-webpack-plugin');
14+
15+
module.exports = () => {
16+
// noinspection JSUnresolvedFunction
17+
return {
18+
entry: [
19+
path.resolve(rootDir, 'src/app/entry', 'index')
20+
],
21+
output: {
22+
path: path.join(rootDir, 'public'),
23+
filename: '[name].bundle.[hash].js',
24+
sourceMapFilename: '[name].[hash].map'
25+
},
26+
resolve: {
27+
extensions: ['.jsx', '.js', '.json'],
28+
modules: [path.join(rootDir, 'src'), 'node_modules']
29+
},
30+
module: {
31+
rules: [
32+
{
33+
test: /\.jsx?$/,
34+
use: [
35+
{loader: 'react-hot-loader'},
36+
],
37+
exclude: [/node_modules/, /\.(spec|e2e)\.jsx?$/]
38+
},
39+
{
40+
test: /\.jsx?$/,
41+
use: [
42+
{loader: 'babel-loader', options: {presets: ['es2015', 'react']}}
43+
],
44+
exclude: [/node_modules/, /\.(spec|e2e)\.jsx?$/],
45+
46+
},
47+
{
48+
test: /\.css$/,
49+
use: [
50+
{loader: 'style-loader'},
51+
{loader: 'css-loader', options: {importantLoaders: 1}},
52+
{loader: 'postcss-loader'}
53+
]
54+
},
55+
{
56+
test: /\.(jpg|png|gif)$/,
57+
use: {
58+
loader: 'file-loader',
59+
options: {
60+
name: 'assets/[name].[hash].[ext]'
61+
}
62+
}
63+
},
64+
{
65+
test: /\.json$/,
66+
use: {
67+
loader: 'json-loader'
68+
}
69+
},
70+
{
71+
test: /\.(woff|woff2|eot|ttf|svg)$/,
72+
use: {
73+
loader: 'file-loader',
74+
options: {
75+
limit: 100000,
76+
name: 'assets/[name].[hash].[ext]'
77+
},
78+
}
79+
}
80+
],
81+
},
82+
plugins: [
83+
new CleanWebpackPlugin(['public/**'], {
84+
dry: true,
85+
verbose: true
86+
}),
87+
new HtmlWebpack({
88+
filename: 'index.html',
89+
inject: 'body',
90+
template: path.resolve(rootDir, 'src/app/entry', 'index.html')
91+
}),
92+
new webpack.optimize.CommonsChunkPlugin({
93+
name: 'vendor',
94+
minChunks: m => m.context && m.context.includes('node_modules')
95+
}),
96+
new webpack.optimize.CommonsChunkPlugin({
97+
name: 'runtime',
98+
chunks: ['vendor'],
99+
minChunks: Infinity
100+
}),
101+
new WebpackManifest({
102+
filename: 'chunk-manifest.json',
103+
manifestVariable: 'webpackManifest'
104+
}),
105+
new WebpackChunkHash(),
106+
new CopyWebpackPlugin([{from: 'src/data/', to: 'data/'}])
107+
],
108+
};
109+
};

config/webpack.dev.js

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
'use strict';
2+
/* global module */
3+
/* global require */
4+
5+
const commonConfig = require('./base.js');
6+
7+
module.exports = (env) => {
8+
const hotReplacementEntries = [
9+
require.resolve('webpack-dev-server/client') + '?http://localhost:5001',
10+
require.resolve('webpack/hot/only-dev-server')
11+
];
12+
return {
13+
devtool: 'eval',
14+
entry: commonConfig().entry.concat(hotReplacementEntries),
15+
output: commonConfig().output,
16+
module: commonConfig().module,
17+
plugins: commonConfig().plugins,
18+
resolve: commonConfig().resolve,
19+
devServer: {
20+
port: 5001,
21+
host: 'localhost',
22+
historyApiFallback: true,
23+
noInfo: false,
24+
headers: {'X-Custom-Header': 'yes'},
25+
quiet: false,
26+
compress: false,
27+
hot: true,
28+
stats: {colors: true},
29+
open: false,
30+
inline: false
31+
}
32+
};
33+
};

config/webpack.prod.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
'use strict';
2+
/* global module */
3+
/* global require */
4+
const webpackMerge = require('webpack-merge');
5+
const webpack = require('webpack');
6+
7+
const commonConfig = require('./base.js');
8+
9+
module.exports = (env) => {
10+
// noinspection JSUnresolvedFunction
11+
return webpackMerge(commonConfig(), {
12+
plugins: [
13+
new webpack.LoaderOptionsPlugin({
14+
minimize: true,
15+
debug: false
16+
}),
17+
new webpack.DefinePlugin({
18+
'process.env': {
19+
'NODE_ENV': JSON.stringify('production')
20+
}
21+
}),
22+
new webpack.optimize.UglifyJsPlugin({
23+
beautify: false,
24+
mangle: {
25+
screw_ie8: true,
26+
keep_fnames: true
27+
},
28+
compress: {
29+
screw_ie8: true
30+
},
31+
comments: false
32+
})
33+
]
34+
});
35+
};

favicon.ico

45.9 KB
Binary file not shown.

package.json

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
{
2+
"name": "ReactChat",
3+
"version": "1.0.0",
4+
"text": "",
5+
"main": "index.js",
6+
"scripts": {
7+
"test": "./node_modules/.bin/jest --env=dev --verbose",
8+
"serve:dev": "./node_modules/.bin/webpack-dev-server --env=dev --hot --profile --colors --no-inline",
9+
"build:dev": "./node_modules/.bin/webpack --env=dev --progress --profile --colors",
10+
"build:prod": "./node_modules/.bin/webpack --env=prod --progress --profile --colors"
11+
},
12+
"author": "",
13+
"license": "MIT",
14+
"devDependencies": {
15+
"autoprefixer": "^6.7.5",
16+
"babel-core": "^6.21.0",
17+
"babel-eslint": "^7.1.1",
18+
"babel-jest": "^19.0.0",
19+
"babel-loader": "^6.2.10",
20+
"babel-plugin-lodash": "^3.2.11",
21+
"babel-plugin-syntax-dynamic-import": "^6.18.0",
22+
"babel-polyfill": "^6.23.0",
23+
"babel-preset-es2015": "^6.18.0",
24+
"babel-preset-react": "^6.16.0",
25+
"chai": "^3.5.0",
26+
"chai-enzyme": "^0.6.1",
27+
"clean-webpack-plugin": "^0.1.14",
28+
"copy-webpack-plugin": "^4.0.1",
29+
"css-loader": "^0.26.2",
30+
"enzyme": "^2.7.1",
31+
"eslint": "^3.13.1",
32+
"eslint-plugin-react": "^6.9.0",
33+
"extract-text-webpack-plugin": "^2.1.0",
34+
"file-loader": "^0.10.1",
35+
"html-webpack-plugin": "^2.24.1",
36+
"isomorphic-fetch": "^2.2.1",
37+
"jest-cli": "^19.0.2",
38+
"json-loader": "^0.5.4",
39+
"mocha": "^3.2.0",
40+
"path": "^0.12.7",
41+
"postcss": "^5.2.5",
42+
"postcss-cssnext": "^2.9.0",
43+
"postcss-import": "^9.1.0",
44+
"postcss-loader": "^1.2.2",
45+
"precss": "^1.4.0",
46+
"react-addons-test-utils": "^15.4.2",
47+
"react-dev-utils": "^0.5.2",
48+
"react-hot-loader": "^1.3.1",
49+
"redux-devtools": "^3.3.2",
50+
"sinon": "^1.17.7",
51+
"source-map-loader": "^0.1.5",
52+
"style-loader": "^0.13.1",
53+
"webdriver-manager": "^12.0.2",
54+
"webpack": "^2.2.1",
55+
"webpack-chunk-hash": "^0.4.0",
56+
"webpack-dev-middleware": "^1.10.0",
57+
"webpack-dev-server": "^2.4.1",
58+
"webpack-hot-middleware": "^2.16.1",
59+
"webpack-manifest-plugin": "^1.1.0",
60+
"webpack-merge": "^4.0.0"
61+
},
62+
"dependencies": {
63+
"react": "^15.4.2",
64+
"react-addons-css-transition-group": "^15.4.2",
65+
"react-dom": "^15.4.2",
66+
"react-redux": "^5.0.2",
67+
"react-router": "^3.0.2",
68+
"redux": "^3.6.0",
69+
"redux-thunk": "^2.2.0"
70+
},
71+
"jest": {
72+
"automock": true,
73+
"unmockedModulePathPatterns": [
74+
"<rootDir>/node_modules/react",
75+
"<rootDir>/node_modules/react-dom",
76+
"<rootDir>/node_modules/react-addons-test-utils",
77+
"<rootDir>/node_modules/fbjs",
78+
"<rootDir>/node_modules/enzyme",
79+
"<rootDir>/node_modules/sinon",
80+
"<rootDir>/node_modules/redux",
81+
"<rootDir>/node_modules/react-redux"
82+
]
83+
}
84+
}

postcss.config.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
'use strict';
2+
/* global module */
3+
/* global require */
4+
5+
const postcss = require('postcss-import');
6+
const postcssNext = require('postcss-cssnext');
7+
const precss = require('precss');
8+
const autoprefixer = require('autoprefixer');
9+
10+
module.exports = {
11+
processors: [
12+
postcss(),
13+
postcssNext({
14+
browsers: ['last 2 versions', '> 5%']
15+
}),
16+
],
17+
plugins: [
18+
precss,
19+
autoprefixer
20+
]
21+
};

src/app/action/actions.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
'use strict';
2+
import * as Actions from './constants';
3+
4+
export const sendMessage = (message, conversation = 'kirsten-conversation') => {
5+
return {
6+
type: Actions.SEND_MESSAGE,
7+
payload: {message, conversation},
8+
};
9+
};

0 commit comments

Comments
 (0)