Skip to content

Commit 16f1ac4

Browse files
committed
Initial Commit
0 parents  commit 16f1ac4

12 files changed

+330
-0
lines changed

.babelrc

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"presets": ["react", "es2015"],
3+
"env": {
4+
"development": {
5+
"presets": ["react-hmre"]
6+
}
7+
}
8+
}

.editorconfig

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

.eslintrc

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
{
2+
"extends": [
3+
"eslint:recommended",
4+
"plugin:import/errors",
5+
"plugin:import/warnings"
6+
],
7+
"plugins": [
8+
"react"
9+
],
10+
"parserOptions": {
11+
"ecmaVersion": 6,
12+
"sourceType": "module",
13+
"ecmaFeatures": {
14+
"jsx": true
15+
}
16+
},
17+
"env": {
18+
"es6": true,
19+
"browser": true,
20+
"node": true,
21+
"jquery": true,
22+
"mocha": true
23+
},
24+
"rules": {
25+
"quotes": 0,
26+
"no-console": 1,
27+
"no-debugger": 1,
28+
"no-var": 1,
29+
"semi": [1, "always"],
30+
"no-trailing-spaces": 0,
31+
"eol-last": 0,
32+
"no-unused-vars": 0,
33+
"no-underscore-dangle": 0,
34+
"no-alert": 0,
35+
"no-lone-blocks": 0,
36+
"jsx-quotes": 1,
37+
"react/display-name": [ 1, {"ignoreTranspilerName": false }],
38+
"react/forbid-prop-types": [1, {"forbid": ["any"]}],
39+
"react/jsx-boolean-value": 1,
40+
"react/jsx-closing-bracket-location": 0,
41+
"react/jsx-curly-spacing": 1,
42+
"react/jsx-indent-props": 0,
43+
"react/jsx-key": 1,
44+
"react/jsx-max-props-per-line": 0,
45+
"react/jsx-no-bind": 1,
46+
"react/jsx-no-duplicate-props": 1,
47+
"react/jsx-no-literals": 0,
48+
"react/jsx-no-undef": 1,
49+
"react/jsx-pascal-case": 1,
50+
"react/jsx-sort-prop-types": 0,
51+
"react/jsx-sort-props": 0,
52+
"react/jsx-uses-react": 1,
53+
"react/jsx-uses-vars": 1,
54+
"react/no-danger": 1,
55+
"react/no-did-mount-set-state": 1,
56+
"react/no-did-update-set-state": 1,
57+
"react/no-direct-mutation-state": 1,
58+
"react/no-multi-comp": 1,
59+
"react/no-set-state": 0,
60+
"react/no-unknown-property": 1,
61+
"react/prefer-es6-class": 1,
62+
"react/prop-types": 1,
63+
"react/react-in-jsx-scope": 1,
64+
"react/require-extension": 1,
65+
"react/self-closing-comp": 1,
66+
"react/sort-comp": 1,
67+
"react/wrap-multilines": 1
68+
}
69+
}

.gitignore

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
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+
#dist folder
30+
dist
31+
32+
#Webstorm metadata
33+
.idea
34+
35+
# Mac files
36+
.DS_Store

package.json

+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
{
2+
"name": "ps-redux",
3+
"version": "1.0.0",
4+
"description": "Starter kit for React and Redux Pluralsight course by Cory House",
5+
"scripts": {
6+
"prestart": "babel-node tools/startMessage.js",
7+
"start": "npm-run-all --parallel test:watch open:src lint:watch",
8+
"open:src": "babel-node tools/srcServer.js",
9+
"lint": "node_modules/.bin/esw webpack.config.* src tools",
10+
"lint:watch": "npm run lint -- --watch",
11+
"test": "mocha --reporter progress tools/testSetup.js src/**/*.test.js",
12+
"test:watch": "npm run test -- --watch"
13+
},
14+
"author": "Cory House",
15+
"license": "MIT",
16+
"dependencies": {
17+
"babel-polyfill": "6.7.4",
18+
"bootstrap": "3.3.6",
19+
"jquery": "2.2.3",
20+
"react": "15.0.1",
21+
"react-dom": "15.0.1",
22+
"react-redux": "4.4.5",
23+
"react-router": "2.2.2",
24+
"react-router-redux": "4.0.2",
25+
"redux": "3.4.0",
26+
"redux-thunk": "2.0.1",
27+
"toastr": "2.1.2"
28+
},
29+
"devDependencies": {
30+
"babel-cli": "6.7.5",
31+
"babel-core": "6.7.6",
32+
"babel-loader": "6.2.4",
33+
"babel-plugin-react-display-name": "2.0.0",
34+
"babel-preset-es2015": "6.6.0",
35+
"babel-preset-react": "6.5.0",
36+
"babel-preset-react-hmre": "1.1.1",
37+
"babel-register": "6.7.2",
38+
"colors": "1.1.2",
39+
"cross-env": "1.0.7",
40+
"css-loader": "0.23.1",
41+
"enzyme": "2.2.0",
42+
"eslint": "2.7.0",
43+
"eslint-loader": "1.3.0",
44+
"eslint-plugin-import": "1.4.0",
45+
"eslint-plugin-react": "4.3.0",
46+
"eventsource-polyfill": "0.9.6",
47+
"expect": "1.16.0",
48+
"express": "4.13.4",
49+
"extract-text-webpack-plugin": "1.0.1",
50+
"file-loader": "0.8.5",
51+
"jsdom": "8.3.1",
52+
"mocha": "2.4.5",
53+
"nock": "8.0.0",
54+
"npm-run-all": "1.7.0",
55+
"open": "0.0.5",
56+
"react-addons-test-utils": "15.0.1",
57+
"redux-immutable-state-invariant": "1.2.2",
58+
"redux-mock-store": "1.0.2",
59+
"rimraf": "2.5.2",
60+
"style-loader": "0.13.1",
61+
"url-loader": "0.5.7",
62+
"webpack": "1.13.0",
63+
"webpack-dev-middleware": "1.6.1",
64+
"webpack-hot-middleware": "2.10.0"
65+
},
66+
"repository": {
67+
"type": "git",
68+
"url": "https://github.com/coryhouse/pluralsight-redux-starter"
69+
}
70+
}

src/index.html

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<title>Pluralsight Admin</title>
5+
</head>
6+
<body>
7+
<h1>React and Redux in ES6 on Pluralsight</h1>
8+
<div id="app"></div>
9+
<script src="/bundle.js"></script>
10+
</body>
11+
</html>

src/index.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
console.log('hi');

src/index.test.js

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import expect from 'expect';
2+
3+
describe('Our first test', () => {
4+
it('should pass', () => {
5+
expect(true).toEqual(true);
6+
});
7+
});

tools/srcServer.js

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import express from 'express';
2+
import webpack from 'webpack';
3+
import path from 'path';
4+
import config from '../webpack.config.dev';
5+
import open from 'open';
6+
7+
/*eslint-disable no-console */
8+
9+
const port = 3000;
10+
const app = express();
11+
const compiler = webpack(config);
12+
13+
app.use(require('webpack-dev-middleware')(compiler, {
14+
noInfo: true,
15+
publicPath: config.output.publicPath
16+
}));
17+
18+
app.use(require('webpack-hot-middleware')(compiler));
19+
20+
app.get('*', function (req, res) {
21+
res.sendFile(path.join(__dirname, '../src/index.html'));
22+
});
23+
24+
app.listen(port, function (err) {
25+
if (err) {
26+
console.log(err);
27+
} else {
28+
open(`http://localhost:${port}`);
29+
}
30+
});

tools/startMessage.js

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import colors from 'colors';
2+
3+
/*eslint-disable no-console */
4+
5+
console.log('Starting app in dev mode...'.green);
6+

tools/testSetup.js

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
// Tests are placed alongside files under test.
2+
// This file does the following:
3+
// 1. Registers babel for transpiling our code for testing
4+
// 2. Disables Webpack-specific features that Mocha doesn't understand.
5+
// 3. Requires jsdom so we can test via an in-memory DOM in Node
6+
// 4. Sets up global vars that mimic a browser.
7+
8+
/*eslint-disable no-var*/
9+
10+
// This assures the .babelrc dev config (which includes
11+
// hot module reloading code) doesn't apply for tests.
12+
process.env.NODE_ENV = 'production'; // this assures the .babelrc dev config doesn't apply.
13+
14+
// Register babel so that it will transpile ES6 to ES5
15+
// before our tests run.
16+
require('babel-register')();
17+
18+
// Disable webpack-specific features for tests since
19+
// Mocha doesn't know what to do with them.
20+
require.extensions['.css'] = function () {return null;};
21+
require.extensions['.png'] = function () {return null;};
22+
require.extensions['.jpg'] = function () {return null;};
23+
24+
// Configure JSDOM and set global variables
25+
// to simulate a browser environment for tests.
26+
var jsdom = require('jsdom').jsdom;
27+
28+
var exposedProperties = ['window', 'navigator', 'document'];
29+
30+
global.document = jsdom('');
31+
global.window = document.defaultView;
32+
Object.keys(document.defaultView).forEach((property) => {
33+
if (typeof global[property] === 'undefined') {
34+
exposedProperties.push(property);
35+
global[property] = document.defaultView[property];
36+
}
37+
});
38+
39+
global.navigator = {
40+
userAgent: 'node.js'
41+
};
42+
43+
documentRef = document; //eslint-disable-line no-undef

webpack.config.dev.js

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import webpack from 'webpack';
2+
import path from 'path';
3+
4+
export default {
5+
debug: true,
6+
devtool: 'cheap-module-eval-source-map',
7+
noInfo: false,
8+
entry: [
9+
'eventsource-polyfill', // necessary for hot reloading with IE
10+
'webpack-hot-middleware/client',
11+
'./src/index'
12+
],
13+
target: 'web',
14+
output: {
15+
path: __dirname + '/dist', // Note: Physical files are only output by the production build task `npm run build`.
16+
publicPath: '/',
17+
filename: 'bundle.js'
18+
},
19+
devServer: {
20+
contentBase: './src'
21+
},
22+
plugins: [
23+
new webpack.HotModuleReplacementPlugin(),
24+
new webpack.NoErrorsPlugin()
25+
],
26+
module: {
27+
loaders: [
28+
{ test: /\.js$/, include: path.join(__dirname, 'src'), loaders: ['babel', 'eslint'] },
29+
{ test: /(\.css)$/, loaders: ['style', 'css']},
30+
{ test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, loader: "file" },
31+
{ test: /\.(woff|woff2)$/, loader:"url?prefix=font/&limit=5000" },
32+
{ test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, loader: "url?limit=10000&mimetype=application/octet-stream" },
33+
{ test: /\.svg(\?v=\d+\.\d+\.\d+)?$/, loader: "url?limit=10000&mimetype=image/svg+xml" }
34+
]
35+
}
36+
};

0 commit comments

Comments
 (0)