Skip to content

Commit

Permalink
Initial react & redux rewrite commit
Browse files Browse the repository at this point in the history
  • Loading branch information
stylesuxx committed Feb 5, 2017
1 parent f875a07 commit 869d759
Show file tree
Hide file tree
Showing 104 changed files with 4,651 additions and 0 deletions.
21 changes: 21 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"presets": [
["es2015", { "modules": false }],
"react",
"airbnb"
],
"plugins": [
"transform-decorators-legacy",
"transform-object-rest-spread",
"react-hot-loader/babel"
],
"env": {
"test": {
"plugins": [
"transform-decorators-legacy",
"transform-object-rest-spread",
"istanbul"
]
}
}
}
12 changes: 12 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false
32 changes: 32 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"parser": "babel-eslint",
"env": {
"browser": true,
"node": true,
"mocha": true
},
"extends": "airbnb",
"rules": {
"comma-dangle": ["off"],
"import/extensions": 0,
"no-unused-vars": ["warn"],
"object-curly-spacing": ["off"],
"padded-blocks": ["off"],
"react/jsx-closing-bracket-location": ["off"],
"react/jsx-filename-extension": [1, { "extensions": [".js", ".jsx"] }],
"react/jsx-space-before-closing": ["off"],
"react/prefer-stateless-function": ["off"],
"no-underscore-dangle": [ "error", { "allowAfterThis": true }],
"import/no-unresolved": ["error", {
"ignore": [
"config",
"components/",
"stores/",
"actions/",
"sources/",
"styles/",
"images/"
]
}]
}
}
36 changes: 36 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Logs
logs
*.log

# Runtime data
pids
*.pid
*.seed

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directory
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
node_modules

# Bower
bower_components/

# Dist folder
dist/

# IDE/Editor data
.idea/
9 changes: 9 additions & 0 deletions .yo-rc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"generator-react-webpack": {
"appName": "liftoff-track-and-race-generator",
"style": "scss",
"cssmodules": true,
"postcss": false,
"generatedWithVersion": 4
}
}
223 changes: 223 additions & 0 deletions conf/webpack/Base.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,223 @@
'use strict'; // eslint-disable-line

/**
* Webpack configuration base class
*/
const fs = require('fs');
const path = require('path');

const npmBase = path.join(__dirname, '../../node_modules');

class WebpackBaseConfig {

constructor() {
this._config = {};
}

/**
* Get the list of included packages
* @return {Array} List of included packages
*/
get includedPackages() {
return [].map((pkg) => fs.realpathSync(path.join(npmBase, pkg)));
}

/**
* Set the config data.
* This will always return a new config
* @param {Object} data Keys to assign
* @return {Object}
*/
set config(data) {
this._config = Object.assign({}, this.defaultSettings, data);
return this._config;
}

/**
* Get the global config
* @return {Object} config Final webpack config
*/
get config() {
return this._config;
}

/**
* Get the environment name
* @return {String} The current environment
*/
get env() {
return 'dev';
}

/**
* Get the absolute path to src directory
* @return {String}
*/
get srcPathAbsolute() {
return path.resolve('./src');
}

/**
* Get the absolute path to tests directory
* @return {String}
*/
get testPathAbsolute() {
return path.resolve('./test');
}

/**
* Get the default settings
* @return {Object}
*/
get defaultSettings() {
const cssModulesQuery = {
modules: true,
importLoaders: 1,
localIdentName: '[name]-[local]-[hash:base64:5]'
};

return {
context: this.srcPathAbsolute,
devtool: 'eval',
devServer: {
contentBase: './src/',
publicPath: '/assets/',
historyApiFallback: true,
hot: true,
inline: true,
port: 8000
},
entry: './index.js',
module: {
rules: [
{
enforce: 'pre',
test: /\.js?$/,
include: this.srcPathAbsolute,
loader: 'babel-loader',
query: {
presets: ['es2015']
}
},
{
test: /^.((?!cssmodule).)*\.css$/,
loaders: [
{ loader: 'style-loader' },
{ loader: 'css-loader' }
]
},
{
test: /\.(png|jpg|gif|mp4|ogg|svg|woff|woff2)$/,
loader: 'file-loader'
},
{
test: /^.((?!cssmodule).)*\.(sass|scss)$/,
loaders: [
{ loader: 'style-loader' },
{ loader: 'css-loader' },
{ loader: 'sass-loader' }
]
},
{
test: /^.((?!cssmodule).)*\.less$/,
loaders: [
{ loader: 'style-loader' },
{ loader: 'css-loader' },
{ loader: 'less-loader' }
]
},
{
test: /^.((?!cssmodule).)*\.styl$/,
loaders: [
{ loader: 'style-loader' },
{ loader: 'css-loader' },
{ loader: 'stylus-loader' }
]
},
{
test: /\.json$/,
loader: 'json-loader'
},
{
test: /\.(js|jsx)$/,
include: [].concat(
this.includedPackages,
[this.srcPathAbsolute]
),
loaders: [
// Note: Moved this to .babelrc
{ loader: 'babel-loader' }
]
},
{
test: /\.cssmodule\.(sass|scss)$/,
loaders: [
{ loader: 'style-loader' },
{
loader: 'css-loader',
query: cssModulesQuery
},
{ loader: 'sass-loader' }
]
},
{
test: /\.cssmodule\.css$/,
loaders: [
{ loader: 'style-loader' },
{
loader: 'css-loader',
query: cssModulesQuery
}
]
},
{
test: /\.cssmodule\.less$/,
loaders: [
{ loader: 'style-loader' },
{
loader: 'css-loader',
query: cssModulesQuery
},
{ loader: 'less-loader' }
]
},
{
test: /\.cssmodule\.styl$/,
loaders: [
{ loader: 'style-loader' },
{
loader: 'css-loader',
query: cssModulesQuery
},
{ loader: 'stylus-loader' }
]
}
]
},
output: {
path: path.resolve('./dist/assets'),
filename: 'app.js',
publicPath: './assets/'
},
plugins: [],
resolve: {
alias: {
actions: `${this.srcPathAbsolute}/actions/`,
components: `${this.srcPathAbsolute}/components/`,
config: `${this.srcPathAbsolute}/config/${this.env}.js`,
images: `${this.srcPathAbsolute}/images/`,
sources: `${this.srcPathAbsolute}/sources/`,
stores: `${this.srcPathAbsolute}/stores/`,
styles: `${this.srcPathAbsolute}/styles/`
},
extensions: ['.js', '.jsx'],
modules: [
this.srcPathAbsolute,
'node_modules'
]
}
};
}
}

module.exports = WebpackBaseConfig;
30 changes: 30 additions & 0 deletions conf/webpack/Dev.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
'use strict';

/**
* Default dev server configuration.
*/
const webpack = require('webpack');
const WebpackBaseConfig = require('./Base');

class WebpackDevConfig extends WebpackBaseConfig {

constructor() {
super();
this.config = {
devtool: 'cheap-module-source-map',
entry: [
'webpack-dev-server/client?http://0.0.0.0:8000/',
'webpack/hot/only-dev-server',
'react-hot-loader/patch',
'./client.js'
],
plugins: [
new webpack.HotModuleReplacementPlugin(),
new webpack.NoEmitOnErrorsPlugin(),
new webpack.NamedModulesPlugin()
]
};
}
}

module.exports = WebpackDevConfig;
Loading

0 comments on commit 869d759

Please sign in to comment.