Skip to content

Commit d353afe

Browse files
committed
initial import
0 parents  commit d353afe

12 files changed

+406
-0
lines changed

.babelrc

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"presets": ["react", "es2015"],
3+
"plugins": [ "istanbul" ]
4+
}

.eslintrc

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
{
2+
"extends": "eslint:recommended",
3+
4+
"rules": {
5+
"indent": [2, 4, {"SwitchCase": 1}],
6+
"quotes": [1, "single"],
7+
"strict": [1, "global"],
8+
"global-strict": 0,
9+
"brace-style": [2, "1tbs"],
10+
"no-sparse-arrays": [1],
11+
"eqeqeq": [2],
12+
"no-else-return": [2],
13+
"no-extra-bind": [2],
14+
"curly": [2, "all"],
15+
"no-multi-spaces": [2],
16+
"no-invalid-this": [2],
17+
"no-useless-escape": [1],
18+
"no-useless-concat": [1],
19+
"no-useless-constructor": [1],
20+
"array-bracket-spacing": [1, "never"],
21+
"block-spacing": [1, "always"],
22+
"camelcase": [1],
23+
"comma-dangle": [1],
24+
"space-before-blocks": [1],
25+
"space-in-parens": [2, "never"],
26+
"no-multiple-empty-lines": [1],
27+
"eol-last": [2],
28+
"semi": [2],
29+
"react/display-name": 1,
30+
"react/jsx-boolean-value": 1,
31+
"react/jsx-no-undef": 1,
32+
"jsx-quotes": [1, "prefer-single"],
33+
"react/sort-prop-types": 1,
34+
"react/jsx-sort-props": 0,
35+
"react/jsx-uses-react": 1,
36+
"react/jsx-uses-vars": 1,
37+
"react/no-danger": 1,
38+
"react/no-did-mount-set-state": 1,
39+
"react/no-did-update-set-state": 1,
40+
"react/no-multi-comp": 1,
41+
"react/no-unknown-property": 1,
42+
"react/prop-types": 1,
43+
"react/react-in-jsx-scope": 1,
44+
"react/require-extension": 1,
45+
"react/self-closing-comp": 1,
46+
"react/sort-comp": 1,
47+
"react/wrap-multilines": 1
48+
},
49+
50+
"parser": "babel-eslint",
51+
52+
"env": {
53+
"browser": true,
54+
"node": true,
55+
"es6": true
56+
},
57+
58+
"plugins": ["react"],
59+
60+
"ecmaFeatures": {
61+
"jsx": true,
62+
"modules": false
63+
}
64+
}

.gitignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
bower_components
2+
node_modules
3+
public
4+
typings
5+
coverage

client/Application.jsx

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import React from 'react';
2+
import {render} from 'react-dom';
3+
4+
class Application extends React.Component {
5+
render() {
6+
return (<div>
7+
</div>);
8+
}
9+
}
10+
11+
if (!window.__karma__) {
12+
render(<Application />, document.getElementById('component'));
13+
}
14+
15+
Application.displayName = 'Application';
16+
17+
export default Application;

index.js

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
const path = require('path');
2+
const express = require('express');
3+
const webpack = require('webpack');
4+
const webpackMiddleware = require('webpack-dev-middleware');
5+
const webpackHotMiddleware = require('webpack-hot-middleware');
6+
const config = require('./webpack.config.js');
7+
8+
const isDeveloping = process.env.NODE_ENV !== 'production';
9+
const port = isDeveloping ? 4000 : process.env.PORT;
10+
const app = express();
11+
12+
if (isDeveloping) {
13+
const compiler = webpack(config);
14+
const middleware = webpackMiddleware(compiler, {
15+
publicPath: config.output.publicPath,
16+
contentBase: 'client',
17+
stats: {
18+
colors: true,
19+
hash: false,
20+
timings: true,
21+
chunks: false,
22+
chunkModules: false,
23+
modules: false
24+
}
25+
});
26+
27+
app.use(middleware);
28+
app.use(webpackHotMiddleware(compiler));
29+
app.get('*', function response(req, res) {
30+
res.write(middleware.fileSystem.readFileSync(path.join(__dirname, 'public/index.html')));
31+
res.end();
32+
});
33+
} else {
34+
app.use(express.static(__dirname + '/public'));
35+
app.get('*', function response(req, res) {
36+
res.sendFile(path.join(__dirname, 'public/index.html'));
37+
});
38+
}
39+
40+
app.listen(port, '0.0.0.0', function onStart(err) {
41+
if (err) {
42+
console.log(err);
43+
}
44+
console.info('==> 🌎 Listening on port %s. Open up http://0.0.0.0:%s/ in your browser.', port, port);
45+
});

karma.config.js

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
var webpack = require('webpack');
2+
3+
module.exports = function (config) {
4+
config.set({
5+
basePath: '',
6+
frameworks: ['jasmine'],
7+
8+
files: [
9+
'test/tests.webpack.js'
10+
],
11+
12+
preprocessors: {
13+
'test/tests.webpack.js': ['webpack', 'sourcemap']
14+
},
15+
16+
reporters: ['dots', 'coverage'],
17+
18+
webpack: {
19+
devtool: 'inline-source-map',
20+
21+
module: {
22+
loaders: [
23+
{
24+
test: /\.jsx?/,
25+
loader: 'babel'
26+
}
27+
],
28+
// postLoaders: [{
29+
// test: /\.jsx$/,
30+
// exclude: /(spec|node_modules|bower_components)\//,
31+
// loader: 'istanbul-instrumenter'
32+
// }]
33+
}
34+
},
35+
webpackMiddleware: {
36+
noInfo: true
37+
},
38+
39+
coverageReporter: {
40+
type: 'html',
41+
dir: 'coverage/'
42+
},
43+
44+
port: 9876,
45+
46+
colors: true,
47+
48+
logLevel: config.LOG_INFO,
49+
50+
autoWatch: true,
51+
52+
browsers: ['PhantomJS'],
53+
54+
singleRun: false,
55+
56+
concurrency: Infinity
57+
})
58+
}

less/site.less

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
@import "~bootstrap/less/bootstrap";
2+
3+
body, html {
4+
overflow: hidden;
5+
}
6+
7+
body {
8+
padding-top: 50px;
9+
background-color: #1E1E1E;
10+
color: #C1C2C3
11+
}

package.json

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
{
2+
"name": "throneteki",
3+
"version": "1.0.0",
4+
"description": "A Game of Throne Second Edition Card Game Server",
5+
"main": "index.js",
6+
"scripts": {
7+
"test": "karma start karma.config.js"
8+
},
9+
"repository": {
10+
"type": "git",
11+
"url": "git+https://github.com/cryogen/throneteki.git"
12+
},
13+
"keywords": [
14+
"got",
15+
"game",
16+
"of",
17+
"thrones",
18+
"cardgame"
19+
],
20+
"author": "Stuart Walsh <[email protected]>",
21+
"license": "MIT",
22+
"bugs": {
23+
"url": "https://github.com/cryogen/throneteki/issues"
24+
},
25+
"homepage": "https://github.com/cryogen/throneteki#readme",
26+
"dependencies": {
27+
"bootstrap": "^3.3.7",
28+
"express": "^4.14.0",
29+
"react": "^15.3.1",
30+
"react-dom": "^15.3.1",
31+
"react-router": "^2.8.1"
32+
},
33+
"devDependencies": {
34+
"autoprefixer": "^6.4.1",
35+
"babel-core": "^6.14.0",
36+
"babel-loader": "^6.2.5",
37+
"babel-plugin-istanbul": "^2.0.1",
38+
"babel-preset-es2015": "^6.14.0",
39+
"babel-preset-react": "^6.11.1",
40+
"css-loader": "^0.25.0",
41+
"file-loader": "^0.9.0",
42+
"html-webpack-plugin": "^2.22.0",
43+
"jasmine-core": "^2.5.1",
44+
"karma": "^1.3.0",
45+
"karma-coverage": "^1.1.1",
46+
"karma-jasmine": "^1.0.2",
47+
"karma-phantomjs-launcher": "^1.0.2",
48+
"karma-sourcemap-loader": "^0.3.7",
49+
"karma-webpack": "^1.8.0",
50+
"less": "^2.7.1",
51+
"less-loader": "^2.2.3",
52+
"phantomjs": "^2.1.7",
53+
"precss": "^1.4.0",
54+
"pug": "^2.0.0-beta6",
55+
"pug-loader": "^2.3.0",
56+
"style-loader": "^0.13.1",
57+
"url-loader": "^0.5.7",
58+
"webpack": "^1.13.2",
59+
"webpack-dev-middleware": "^1.7.0",
60+
"webpack-hot-middleware": "^2.12.2"
61+
}
62+
}

views/index.pug

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
extends /layout
2+
3+
block content
4+
#component

views/layout.pug

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
doctype html
2+
html
3+
head
4+
meta(charset="utf-8")
5+
meta(http-equiv="X-UA-Compatible", content="IE=edge")
6+
meta(name='viewport', content='width=device-width, initial-scale=1')
7+
title= title
8+
body
9+
nav(class="navbar navbar-inverse navbar-fixed-top")
10+
.container-fluid
11+
.navbar-header
12+
button.navbar-toggle.collapsed(type="button" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar")
13+
span.sr-only
14+
span.sr-only Toggle navigation
15+
span.icon-bar
16+
span.icon-bar
17+
span.icon-bar
18+
a.navbar-brand(href="#") Throneteki
19+
#navbar.collapse.navbar-collapse
20+
ul.nav.navbar-nav
21+
// { name: "Home", path: '#' }
22+
each menuItem in []
23+
if(menu == menuItem.name)
24+
li.active
25+
a(href=menuItem.path)= menuItem.name
26+
else
27+
li
28+
a(href=menuItem.path)= menuItem.name
29+
.container-fluid
30+
block content

webpack.config.js

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
var webpack = require('webpack');
2+
var path = require('path');
3+
var HtmlWebpackPlugin = require('html-webpack-plugin');
4+
var precss = require('precss');
5+
var autoprefixer = require('autoprefixer');
6+
7+
var BUILD_DIR = path.resolve(__dirname, 'public');
8+
var APP_DIR = path.resolve(__dirname, 'client');
9+
var LESS_DIR = path.resolve(__dirname, 'less');
10+
11+
var config = {
12+
devtool: 'source-map',
13+
entry: [
14+
'webpack-hot-middleware/client?reload=true',
15+
path.join(__dirname, 'client/Application.jsx'),
16+
LESS_DIR + '/site.less'
17+
],
18+
output: {
19+
path: BUILD_DIR,
20+
filename: 'bundle.js',
21+
publicPath: '/'
22+
},
23+
plugins: [
24+
new HtmlWebpackPlugin({
25+
template: '!!pug!views/index.pug',
26+
inject: 'body',
27+
filename: 'index.html'
28+
}),
29+
new webpack.optimize.OccurenceOrderPlugin(),
30+
new webpack.HotModuleReplacementPlugin(),
31+
new webpack.NoErrorsPlugin(),
32+
new webpack.DefinePlugin({
33+
'process.env.NODE_ENV': JSON.stringify('development')
34+
})
35+
],
36+
module: {
37+
loaders: [{
38+
test: /\.jsx?/,
39+
include: APP_DIR,
40+
loader: 'babel'
41+
}, {
42+
test: /\.less$/,
43+
loader: 'style!css!less'
44+
}, {
45+
test: /.(png|woff(2)?|eot|ttf|svg)(\?[a-z0-9=\.]+)?$/, loader: 'url-loader?limit=100000'
46+
}]
47+
},
48+
postcss: function() {
49+
return [precss, autoprefixer];
50+
}
51+
};
52+
53+
module.exports = config;

0 commit comments

Comments
 (0)