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)
+9
View File
@@ -4,6 +4,15 @@
<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"/>
<title>Kingdom Battles!</title>
<meta name="description" content="Build Your Kingdom!" />
<meta property="og:title" content="Kingdom Battles!" />
<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> </head>
<body> <body>
<div id = "root"></div> <div id = "root"></div>
+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'));
+2 -8
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")
);
+6 -4
View File
@@ -1,11 +1,12 @@
const TerserPlugin = require('terser-webpack-plugin'); const TerserPlugin = require('terser-webpack-plugin');
module.exports = { module.exports = env => {
entry: './src/index.jsx', return {
entry: `./src/index${env === 'production' ? '' : '_dev'}.jsx`,
output: { output: {
path: __dirname + '/public/', path: __dirname + '/public/',
filename: 'app.bundle.js', filename: 'app.bundle.js',
sourceMapFilename: 'app.js.map' sourceMapFilename: 'app.bundle.js.map'
}, },
devtool: 'source-map', devtool: 'source-map',
module: { module: {
@@ -24,7 +25,7 @@ module.exports = {
] ]
}, },
optimization: { optimization: {
minimize: process.env.production, minimize: env === 'production',
minimizer: [ minimizer: [
new TerserPlugin({ new TerserPlugin({
terserOptions: { terserOptions: {
@@ -36,3 +37,4 @@ module.exports = {
] ]
} }
}; };
};