Working on pipeline stuff

This commit is contained in:
2019-06-07 20:27:58 +10:00
parent 9f508a4aca
commit b643dd62d1
7 changed files with 118 additions and 55 deletions
+2 -2
View File
@@ -8,8 +8,8 @@
"restart": "forever -a -o forever.log -e error.log restart server/index.js", "restart": "forever -a -o forever.log -e error.log restart server/index.js",
"stop": "forever stop server/index.js", "stop": "forever stop server/index.js",
"node": "node server/index.js", "node": "node server/index.js",
"webpack": "webpack --mode=development", "webpack": "webpack --mode=development --env=development",
"webpack-production": "webpack --mode=production", "webpack-production": "webpack --mode=production --env=production",
"pull": "git pull && npm run webpack-production && npm restart" "pull": "git pull && npm run webpack-production && npm restart"
}, },
"author": "Kayne Ruse", "author": "Kayne Ruse",
+13
View File
@@ -45,3 +45,16 @@ Event Ideas
* Capture the flag. * Capture the flag.
Badge Ideas
---
* alpha tester
* capture the flag
* king of the hill
* gold horde
* combat master
* Beta tester
* Spy Master
* Referral Linker
* Bug Hunter (Reward List: Hegemon)
+18 -9
View File
@@ -1,12 +1,21 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang = "en"> <html lang = "en">
<head> <head>
<meta charset = "UTF-8"> <meta charset = "UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="/styles/shared.css"/> <link rel="stylesheet" href="/styles/shared.css"/>
</head>
<body> <title>Kingdom Battles!</title>
<div id = "root"></div> <meta name="description" content="Build Your Kingdom!" />
<script src="/app.bundle.js"></script> <meta property="og:title" content="Kingdom Battles!" />
</body> <meta property="og:description" content="Build Your Kingdom!" />
<meta property="og:image" content="https://kingdombattles.com/img/flag.png" />
<!--
<link rel="shortcut icon" href="https://kingdombattles.com/favicon.ico" type="image/x-icon" />
-->
</head>
<body>
<div id = "root"></div>
<script src="/app.bundle.js"></script>
</body>
</html> </html>
+5
View File
@@ -76,6 +76,11 @@ app.get('/*app.bundle.js', (req, res) => {
res.sendFile(path.resolve(`${__dirname}/../public/${req.originalUrl.split('/').pop()}`)); res.sendFile(path.resolve(`${__dirname}/../public/${req.originalUrl.split('/').pop()}`));
}); });
//source map (for development)
app.get('/app.bundle.js.map', (req, res) => {
res.sendFile(path.resolve(__dirname + `/../public/${req.originalUrl}`));
});
//fallback //fallback
app.get('*', (req, res) => { app.get('*', (req, res) => {
res.sendFile(path.resolve(__dirname + '/../public/index.html')); res.sendFile(path.resolve(__dirname + '/../public/index.html'));
+3 -9
View File
@@ -1,7 +1,7 @@
import React from 'react'; import React from 'react';
import ReactDOM from 'react-dom'; import ReactDOM from 'react-dom';
import { Provider } from 'react-redux'; import { Provider } from 'react-redux';
import { createStore, applyMiddleware, compose } from 'redux'; import { createStore, applyMiddleware } from 'redux';
import thunk from 'redux-thunk'; import thunk from 'redux-thunk';
import DevTools from './dev_tools.jsx'; import DevTools from './dev_tools.jsx';
@@ -17,10 +17,7 @@ account = account ? JSON.parse(account) : {};
var store = createStore( var store = createStore(
reducer, reducer,
{ account: account }, //initial state { account: account }, //initial state
compose( applyMiddleware(thunk)
applyMiddleware(thunk),
DevTools.instrument()
)
); );
//persistence //persistence
@@ -31,10 +28,7 @@ store.subscribe(() => {
//start the process //start the process
ReactDOM.render( ReactDOM.render(
<Provider store={store}> <Provider store={store}>
<div> <App />
<App />
<DevTools />
</div>
</Provider>, </Provider>,
document.querySelector("#root") document.querySelector("#root")
); );
+40
View File
@@ -0,0 +1,40 @@
import React from 'react';
import ReactDOM from 'react-dom';
import { Provider } from 'react-redux';
import { createStore, applyMiddleware, compose } from 'redux';
import thunk from 'redux-thunk';
import DevTools from './dev_tools.jsx';
import App from './components/app.jsx';
import reducer from './reducers/reducer.js';
//persistence
let ITEM_NAME = 'account.kingdombattles';
let account = localStorage.getItem(ITEM_NAME);
account = account ? JSON.parse(account) : {};
var store = createStore(
reducer,
{ account: account }, //initial state
compose(
applyMiddleware(thunk),
DevTools.instrument()
)
);
//persistence
store.subscribe(() => {
localStorage.setItem(ITEM_NAME, JSON.stringify(store.getState().account));
});
//start the process
ReactDOM.render(
<Provider store={store}>
<div>
<App />
<DevTools />
</div>
</Provider>,
document.querySelector("#root")
);
+37 -35
View File
@@ -1,38 +1,40 @@
const TerserPlugin = require('terser-webpack-plugin'); const TerserPlugin = require('terser-webpack-plugin');
module.exports = { module.exports = env => {
entry: './src/index.jsx', return {
output: { entry: `./src/index${env === 'production' ? '' : '_dev'}.jsx`,
path: __dirname + '/public/', output: {
filename: 'app.bundle.js', path: __dirname + '/public/',
sourceMapFilename: 'app.js.map' filename: 'app.bundle.js',
}, sourceMapFilename: 'app.bundle.js.map'
devtool: 'source-map', },
module: { devtool: 'source-map',
rules: [ module: {
{ rules: [
test: /(\.js$|\.jsx$)/, {
exclude: /(node_modules)/, test: /(\.js$|\.jsx$)/,
use: { exclude: /(node_modules)/,
loader: 'babel-loader', use: {
options: { loader: 'babel-loader',
presets: ['@babel/preset-env', '@babel/preset-react'], options: {
plugins: ['react-loadable/babel', '@babel/plugin-syntax-dynamic-import'] presets: ['@babel/preset-env', '@babel/preset-react'],
} plugins: ['react-loadable/babel', '@babel/plugin-syntax-dynamic-import']
} }
} }
] }
}, ]
optimization: { },
minimize: process.env.production, optimization: {
minimizer: [ minimize: env === 'production',
new TerserPlugin({ minimizer: [
terserOptions: { new TerserPlugin({
output: { terserOptions: {
comments: false, output: {
}, comments: false,
}, },
}) },
] })
} ]
}
};
}; };