Skip to content

Commit f3a105d

Browse files
committed
feat(init): hello world
1 parent e04625f commit f3a105d

40 files changed

+14797
-0
lines changed

.babelrc

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

.editorconfig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
root = true
2+
3+
[*]
4+
indent_style = space
5+
indent_size = 2
6+
end_of_line = lf
7+
charset = utf-8
8+
trim_trailing_whitespace = true
9+
insert_final_newline = true
10+
11+
[*.md]
12+
trim_trailing_whitespace = false

.eslintrc

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"parser": "babel-eslint",
3+
"plugins": [
4+
"react"
5+
],
6+
"parserOptions": {
7+
"ecmaVersion": 6,
8+
"sourceType": "module",
9+
"ecmaFeatures": {
10+
"jsx": true
11+
}
12+
},
13+
"env": {
14+
"browser": true,
15+
"amd": true,
16+
"es6": true,
17+
"node": true,
18+
"mocha": true
19+
},
20+
"rules": {
21+
"comma-dangle": 1,
22+
"quotes": [ 1, "single" ],
23+
"no-undef": 1,
24+
"global-strict": 0,
25+
"no-extra-semi": 1,
26+
"no-underscore-dangle": 0,
27+
"no-console": 1,
28+
"no-unused-vars": 1,
29+
"no-trailing-spaces": [1, { "skipBlankLines": true }],
30+
"no-unreachable": 1,
31+
"no-alert": 0,
32+
"react/jsx-uses-react": 1,
33+
"react/jsx-uses-vars": 1
34+
}
35+
}

.gitignore

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Logs
2+
logs
3+
*.log
4+
5+
# Runtime data
6+
pids
7+
*.pid
8+
*.seed
9+
10+
# Directory for instrumented libs generated by jscoverage/JSCover
11+
lib-cov
12+
13+
# Coverage directory used by tools like istanbul
14+
coverage
15+
16+
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
17+
.grunt
18+
19+
# node-waf configuration
20+
.lock-wscript
21+
22+
# Compiled binary addons (http://nodejs.org/api/addons.html)
23+
build/Release
24+
25+
# Dependency directory
26+
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
27+
node_modules
28+
29+
# Bower
30+
bower_components/
31+
32+
# IDE/Editor data
33+
.idea

.yo-rc.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"generator-react-webpack": {}
3+
}

cfg/base.js

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
'use strict';
2+
let path = require('path');
3+
let defaultSettings = require('./defaults');
4+
5+
// Additional npm or bower modules to include in builds
6+
// Add all foreign plugins you may need into this array
7+
// @example:
8+
// let npmBase = path.join(__dirname, '../node_modules');
9+
// let additionalPaths = [ path.join(npmBase, 'react-bootstrap') ];
10+
let additionalPaths = [];
11+
12+
module.exports = {
13+
additionalPaths: additionalPaths,
14+
port: defaultSettings.port,
15+
debug: true,
16+
devtool: 'eval',
17+
output: {
18+
path: path.join(__dirname, '/../dist/assets'),
19+
filename: 'app.js',
20+
publicPath: defaultSettings.publicPath
21+
},
22+
devServer: {
23+
contentBase: './src/',
24+
historyApiFallback: true,
25+
hot: true,
26+
port: defaultSettings.port,
27+
publicPath: defaultSettings.publicPath,
28+
noInfo: false
29+
},
30+
resolve: {
31+
extensions: ['', '.js', '.jsx'],
32+
alias: {
33+
actions: `${defaultSettings.srcPath}/actions/`,
34+
components: `${defaultSettings.srcPath}/components/`,
35+
sources: `${defaultSettings.srcPath}/sources/`,
36+
stores: `${defaultSettings.srcPath}/stores/`,
37+
styles: `${defaultSettings.srcPath}/styles/`,
38+
config: `${defaultSettings.srcPath}/config/` + process.env.REACT_WEBPACK_ENV,
39+
'react/lib/ReactMount': 'react-dom/lib/ReactMount'
40+
}
41+
},
42+
module: {}
43+
};

cfg/defaults.js

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
/**
2+
* Function that returns default values.
3+
* Used because Object.assign does a shallow instead of a deep copy.
4+
* Using [].push will add to the base array, so a require will alter
5+
* the base array output.
6+
*/
7+
'use strict';
8+
9+
const path = require('path');
10+
const srcPath = path.join(__dirname, '/../src');
11+
const dfltPort = 8000;
12+
13+
/**
14+
* Get the default modules object for webpack
15+
* @return {Object}
16+
*/
17+
function getDefaultModules() {
18+
return {
19+
preLoaders: [
20+
{
21+
test: /\.(js|jsx)$/,
22+
include: srcPath,
23+
loader: 'eslint-loader'
24+
}
25+
],
26+
loaders: [
27+
{
28+
test: /\.css$/,
29+
loader: 'style-loader!css-loader'
30+
},
31+
{
32+
test: /\.sass/,
33+
loader: 'style-loader!css-loader!sass-loader?outputStyle=expanded&indentedSyntax'
34+
},
35+
{
36+
test: /\.scss/,
37+
loader: 'style-loader!css-loader!sass-loader?outputStyle=expanded'
38+
},
39+
{
40+
test: /\.less/,
41+
loader: 'style-loader!css-loader!less-loader'
42+
},
43+
{
44+
test: /\.styl/,
45+
loader: 'style-loader!css-loader!stylus-loader'
46+
},
47+
{
48+
test: /\.(png|jpg|gif|woff|woff2)$/,
49+
loader: 'url-loader?limit=8192'
50+
},
51+
{
52+
test: /\.(mp4|ogg|svg)$/,
53+
loader: 'file-loader'
54+
}
55+
]
56+
};
57+
}
58+
59+
module.exports = {
60+
srcPath: srcPath,
61+
publicPath: '/assets/',
62+
port: dfltPort,
63+
getDefaultModules: getDefaultModules
64+
};

cfg/dev.js

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
'use strict';
2+
3+
let path = require('path');
4+
let webpack = require('webpack');
5+
let baseConfig = require('./base');
6+
let defaultSettings = require('./defaults');
7+
8+
// Add needed plugins here
9+
let BowerWebpackPlugin = require('bower-webpack-plugin');
10+
11+
let config = Object.assign({}, baseConfig, {
12+
entry: [
13+
'webpack-dev-server/client?http://127.0.0.1:' + defaultSettings.port,
14+
'webpack/hot/only-dev-server',
15+
'./src/index'
16+
],
17+
cache: true,
18+
devtool: 'eval-source-map',
19+
plugins: [
20+
new webpack.HotModuleReplacementPlugin(),
21+
new webpack.NoErrorsPlugin(),
22+
new BowerWebpackPlugin({
23+
searchResolveModulesDirectories: false
24+
})
25+
],
26+
module: defaultSettings.getDefaultModules()
27+
});
28+
29+
// Add needed loaders to the defaults here
30+
config.module.loaders.push({
31+
test: /\.(js|jsx)$/,
32+
loader: 'react-hot!babel-loader',
33+
include: [].concat(
34+
config.additionalPaths,
35+
[ path.join(__dirname, '/../src') ]
36+
)
37+
});
38+
39+
module.exports = config;

cfg/dist.js

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
'use strict';
2+
3+
let path = require('path');
4+
let webpack = require('webpack');
5+
6+
let baseConfig = require('./base');
7+
let defaultSettings = require('./defaults');
8+
9+
// Add needed plugins here
10+
let BowerWebpackPlugin = require('bower-webpack-plugin');
11+
12+
let config = Object.assign({}, baseConfig, {
13+
entry: path.join(__dirname, '../src/index'),
14+
cache: false,
15+
devtool: 'sourcemap',
16+
plugins: [
17+
new webpack.optimize.DedupePlugin(),
18+
new webpack.DefinePlugin({
19+
'process.env.NODE_ENV': '"production"'
20+
}),
21+
new BowerWebpackPlugin({
22+
searchResolveModulesDirectories: false
23+
}),
24+
new webpack.optimize.UglifyJsPlugin(),
25+
new webpack.optimize.OccurenceOrderPlugin(),
26+
new webpack.optimize.AggressiveMergingPlugin(),
27+
new webpack.NoErrorsPlugin()
28+
],
29+
module: defaultSettings.getDefaultModules()
30+
});
31+
32+
// Add needed loaders to the defaults here
33+
config.module.loaders.push({
34+
test: /\.(js|jsx)$/,
35+
loader: 'babel',
36+
include: [].concat(
37+
config.additionalPaths,
38+
[ path.join(__dirname, '/../src') ]
39+
)
40+
});
41+
42+
module.exports = config;

cfg/test.js

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
'use strict';
2+
3+
let path = require('path');
4+
let srcPath = path.join(__dirname, '/../src/');
5+
6+
let baseConfig = require('./base');
7+
8+
// Add needed plugins here
9+
let BowerWebpackPlugin = require('bower-webpack-plugin');
10+
11+
module.exports = {
12+
devtool: 'eval',
13+
module: {
14+
preLoaders: [
15+
{
16+
test: /\.(js|jsx)$/,
17+
loader: 'isparta-instrumenter-loader',
18+
include: [
19+
path.join(__dirname, '/../src')
20+
]
21+
}
22+
],
23+
loaders: [
24+
{
25+
test: /\.(png|jpg|gif|woff|woff2|css|sass|scss|less|styl)$/,
26+
loader: 'null-loader'
27+
},
28+
{
29+
test: /\.(js|jsx)$/,
30+
loader: 'babel-loader',
31+
include: [].concat(
32+
baseConfig.additionalPaths,
33+
[
34+
path.join(__dirname, '/../src'),
35+
path.join(__dirname, '/../test')
36+
]
37+
)
38+
}
39+
]
40+
},
41+
resolve: {
42+
extensions: [ '', '.js', '.jsx' ],
43+
alias: {
44+
actions: srcPath + 'actions/',
45+
helpers: path.join(__dirname, '/../test/helpers'),
46+
components: srcPath + 'components/',
47+
sources: srcPath + 'sources/',
48+
stores: srcPath + 'stores/',
49+
styles: srcPath + 'styles/',
50+
config: srcPath + 'config/' + process.env.REACT_WEBPACK_ENV
51+
}
52+
},
53+
plugins: [
54+
new BowerWebpackPlugin({
55+
searchResolveModulesDirectories: false
56+
})
57+
]
58+
};

dist/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# About the dist folder
2+
After building the dist version of your project, the generated files are stored in this folder. You should keep it under version control.

dist/static/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# static
2+
3+
Files and directories that you put in `static` will be copied to the
4+
`dist/static` directory during the build step. Use it to provide
5+
arbitrary static assets that can be referenced by path in your
6+
application.

dist/static/favicon.ico

4.19 KB
Binary file not shown.

karma.conf.js

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
var webpackCfg = require('./webpack.config');
2+
3+
// Set node environment to testing
4+
process.env.NODE_ENV = 'test';
5+
6+
module.exports = function(config) {
7+
config.set({
8+
basePath: '',
9+
browsers: [ 'PhantomJS' ],
10+
files: [
11+
'test/loadtests.js'
12+
],
13+
port: 8000,
14+
captureTimeout: 60000,
15+
frameworks: [ 'mocha', 'chai' ],
16+
client: {
17+
mocha: {}
18+
},
19+
singleRun: true,
20+
reporters: [ 'mocha', 'coverage' ],
21+
preprocessors: {
22+
'test/loadtests.js': [ 'webpack', 'sourcemap' ]
23+
},
24+
webpack: webpackCfg,
25+
webpackServer: {
26+
noInfo: true
27+
},
28+
coverageReporter: {
29+
dir: 'coverage/',
30+
reporters: [
31+
{ type: 'html' },
32+
{ type: 'text' }
33+
]
34+
}
35+
});
36+
};

0 commit comments

Comments
 (0)