modernize dependencies

This commit is contained in:
41666 2018-11-01 01:36:39 -05:00
parent ea51d94c16
commit 5a1fc526db
22 changed files with 8578 additions and 22658 deletions

View file

@ -1,3 +1,4 @@
/Server/.env /Server/.env
/Server/public
/Server/node_modules /Server/node_modules
/UI/node_modules /UI/node_modules

1
.gitignore vendored
View file

@ -5,3 +5,4 @@ Server/\.env
Server/prod\.env Server/prod\.env
Server/test\.env Server/test\.env
UI~

View file

@ -1,10 +1,10 @@
FROM node:9.3 AS builder FROM node:10 AS builder
ENV NODE_ENV production ENV NODE_ENV production
RUN npm i -g yarn RUN npm i -g yarn
COPY . /src COPY . /src
RUN cd /src/UI && yarn && yarn build && cd /src/Server && yarn && mkdir public && mv /src/UI/build/* public RUN cd /src/UI && yarn && yarn build && cd /src/Server && yarn && mkdir public && mv /src/UI/build/* public
FROM mhart/alpine-node:9.3 FROM mhart/alpine-node:10
ENV NODE_ENV production ENV NODE_ENV production
WORKDIR /dist WORKDIR /dist
EXPOSE 6769 EXPOSE 6769

View file

@ -8,6 +8,7 @@ const _io = require('socket.io')
const path = require('path') const path = require('path')
const router = require('koa-better-router')().loadMethods() const router = require('koa-better-router')().loadMethods()
const Roleypoly = require('./Roleypoly') const Roleypoly = require('./Roleypoly')
const ksuid = require('ksuid')
// monkey patch async-reduce because F U T U R E // monkey patch async-reduce because F U T U R E
Array.prototype.areduce = async function (predicate, acc = []) { // eslint-disable-line Array.prototype.areduce = async function (predicate, acc = []) { // eslint-disable-line
@ -88,7 +89,8 @@ async function start () {
key: 'roleypoly:sess', key: 'roleypoly:sess',
maxAge: 'session', maxAge: 'session',
siteOnly: true, siteOnly: true,
store: M.ctx.sessions store: M.ctx.sessions,
genid: () => { return ksuid.randomSync().string }
}, app)) }, app))
await M.mountRoutes() await M.mountRoutes()

4717
Server/package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -9,30 +9,30 @@
"pm2": "pm2" "pm2": "pm2"
}, },
"dependencies": { "dependencies": {
"chalk": "^2.3.0", "chalk": "^2.4.1",
"discord.js": "^11.2.1", "discord.js": "^11.4.2",
"dotenv": "^4.0.0", "dotenv": "^6.1.0",
"erlpack": "github:discordapp/erlpack", "erlpack": "github:discordapp/erlpack",
"eslint": "^4.14.0", "eslint": "^5.8.0",
"eslint-config-standard": "^11.0.0-beta.0", "eslint-config-standard": "^12.0.0",
"glob": "^7.1.2", "glob": "^7.1.3",
"immutable": "^3.8.2", "immutable": "^3.8.2",
"koa": "^2.4.1", "koa": "^2.6.1",
"koa-better-router": "^2.1.1", "koa-better-router": "^2.1.1",
"koa-bodyparser": "^4.2.0", "koa-bodyparser": "^4.2.1",
"koa-send": "^4.1.2", "koa-send": "^5.0.0",
"koa-session": "^5.5.1", "koa-session": "^5.10.0",
"koa-compress": "^2.0.0", "koa-compress": "^3.0.0",
"koa-static": "^4.0.2", "koa-static": "^5.0.0",
"ksuid": "^0.4.0", "ksuid": "^1.1.3",
"lru-cache": "^4.1.1", "lru-cache": "^4.1.3",
"pg": "^7.4.0", "pg": "^7.6.0",
"pg-hstore": "^2.3.2", "pg-hstore": "^2.3.2",
"pm2": "^2.9.1", "pm2": "^2.9.3",
"sequelize": "^4.28.6", "sequelize": "^4.41.0",
"socket.io": "^2.0.4", "socket.io": "^2.1.1",
"superagent": "^3.8.2", "superagent": "^4.0.0-beta.5",
"uuid": "^3.1.0", "uuid": "^3.3.2",
"uws": "^9.14.0" "uws": "10.148.1"
} }
} }

View file

@ -6,7 +6,7 @@ class SessionsService extends Service {
this.Session = ctx.M.Session this.Session = ctx.M.Session
} }
async get (id) { async get (id, {rolling}) {
const user = await this.Session.findOne({ where: { id } }) const user = await this.Session.findOne({ where: { id } })
if (user === null) { if (user === null) {
@ -16,12 +16,14 @@ class SessionsService extends Service {
return user.data return user.data
} }
async set (id, data, maxAge) { async set (id, data, {maxAge, rolling, changed}) {
let session = await this.Session.findOne({ where: { id } }) let session = await this.Session.findOne({ where: { id } })
if (session === null) { if (session === null) {
session = this.Session.build({ id }) session = this.Session.build({ id })
} }
console.log(maxAge)
session.data = data session.data = data
session.maxAge = maxAge session.maxAge = maxAge

File diff suppressed because it is too large Load diff

View file

@ -1,4 +0,0 @@
REACT_APP_DECORATORS=true
REACT_APP_BABEL_STAGE_0=true
REACT_APP_SASS=true
REACT_APP_SASS_MODULES=true

View file

@ -1,8 +0,0 @@
module.exports = {
"extends": ["standard", "plugin:react/recommended"],
"plugins": [ "react", "node", "promise", "import" ],
"parser": "babel-eslint",
"parserOptions": {
"jsx": true
}
};

4
UI/.gitignore vendored
View file

@ -1,7 +1,9 @@
# See https://help.github.com/ignore-files/ for more about ignoring files. # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# dependencies # dependencies
/node_modules /node_modules
/.pnp
.pnp.js
# testing # testing
/coverage /coverage

File diff suppressed because it is too large Load diff

4
UI/config-overrides.js Normal file
View file

@ -0,0 +1,4 @@
const { override, addDecoratorsLegacy } = require('customize-cra')
module.exports = override(
addDecoratorsLegacy()
)

10472
UI/package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -1,56 +1,60 @@
{ {
"name": "roleypoly", "name": "crav2",
"version": "0.1.0", "version": "0.1.0",
"private": true, "private": true,
"dependencies": { "dependencies": {
"color": "^2.0.1", "color": "^3.1.0",
"custom-react-scripts": "0.2.1",
"history": "^4.7.2", "history": "^4.7.2",
"immutable": "^3.8.2", "immutable": "^3.8.2",
"moment": "^2.20.1", "moment": "^2.22.2",
"prop-types": "^15.6.0", "prop-types": "^15.6.2",
"react": "^16.2.0", "react": "^16.6.0",
"react-custom-scrollbars": "^4.2.1", "react-custom-scrollbars": "^4.2.1",
"react-dnd": "^2.5.4", "react-dnd": "^2.5.4",
"react-dnd-html5-backend": "^2.5.4", "react-dnd-html5-backend": "^2.5.4",
"react-dom": "^16.2.0", "react-dom": "^16.6.0",
"react-immutable-proptypes": "^2.1.0", "react-immutable-proptypes": "^2.1.0",
"react-redux": "^5.0.6", "react-redux": "^5.1.0",
"react-router": "^4.2.0", "react-router": "^4.3.1",
"react-router-dom": "^4.2.2", "react-router-dom": "^4.3.1",
"react-router-redux": "^5.0.0-alpha.8", "react-router-redux": "^5.0.0-alpha.8",
"react-scripts": "2.1.1",
"react-typist": "^2.0.4", "react-typist": "^2.0.4",
"react-typist-cycle": "^0.1.2", "react-typist-cycle": "^0.1.2",
"redux": "^3.7.2", "redux": "^4.0.1",
"redux-logger": "^3.0.6", "redux-logger": "^3.0.6",
"redux-thunk": "^2.2.0", "redux-thunk": "^2.3.0",
"superagent": "^3.8.2", "superagent": "^4.0.0-beta.5",
"uuid": "^3.1.0" "uuid": "^3.3.2"
}, },
"scripts": { "scripts": {
"start": "react-scripts start", "start": "react-app-rewired start",
"build": "react-scripts build", "build": "react-app-rewired build",
"test": "react-scripts test --env=jsdom", "test": "react-app-rewired test",
"eject": "react-scripts eject" "eject": "react-app-rewired eject"
}, },
"homepage": "https://rp.kat.cafe", "eslintConfig": {
"proxy": { "extends": "react-app"
"/api": {
"target": "http://localhost:6769"
},
"/api/socket.io": {
"target": "ws://localhost:6769/socket.io",
"ws": true
}
}, },
"browserslist": [
">0.2%",
"not dead",
"not ie <= 11",
"not op_mini all"
],
"proxy": "http://localhost:6769",
"devDependencies": { "devDependencies": {
"eslint": "^4.14.0", "@babel/plugin-proposal-decorators": "^7.1.2",
"eslint-config-standard": "^11.0.0-beta.0", "customize-cra": "^0.2.1",
"eslint-plugin-import": "^2.8.0", "eslint-config-standard": "^12.0.0",
"eslint-plugin-node": "^5.2.1", "eslint-plugin-import": "^2.14.0",
"eslint-plugin-promise": "^3.6.0", "eslint-plugin-node": "^8.0.0",
"eslint-plugin-react": "^7.5.1", "eslint-plugin-promise": "^4.0.1",
"eslint-plugin-standard": "^3.0.1", "eslint-plugin-react": "^7.11.1",
"eslint-plugin-standard": "^4.0.0",
"node-sass-chokidar": "^1.3.4",
"react-app-rewire-scss": "^1.0.2",
"react-app-rewired": "^1.6.2",
"redux-devtools": "^3.4.1", "redux-devtools": "^3.4.1",
"redux-devtools-dock-monitor": "^1.1.3", "redux-devtools-dock-monitor": "^1.1.3",
"redux-devtools-log-monitor": "^1.4.0" "redux-devtools-log-monitor": "^1.4.0"

View file

@ -1,15 +1,15 @@
{ {
"short_name": "React App", "short_name": "roleypoly",
"name": "Create React App Sample", "name": "roleypoly",
"icons": [ "icons": [
{ {
"src": "favicon.ico", "src": "favicon.png",
"sizes": "64x64 32x32 24x24 16x16", "sizes": "128x128 64x64 32x32 24x24 16x16",
"type": "image/x-icon" "type": "image/png"
} }
], ],
"start_url": "./index.html", "start_url": "./index.html",
"display": "standalone", "display": "standalone",
"theme_color": "#000000", "theme_color": "#ab9b9a",
"background_color": "#ffffff" "background_color": "#453e3d"
} }

View file

@ -12,6 +12,12 @@ class OauthCallback extends Component {
redirect: '/s' redirect: '/s'
} }
stopped = false
componentDidUnmount () {
this.stopped = true
}
async componentDidMount () { async componentDidMount () {
// handle stuff in the url // handle stuff in the url
const sp = new URLSearchParams(this.props.location.search) const sp = new URLSearchParams(this.props.location.search)
@ -25,14 +31,15 @@ class OauthCallback extends Component {
const stateToken = sp.get('state') const stateToken = sp.get('state')
const state = JSON.parse(window.sessionStorage.getItem('state') || 'null') const state = JSON.parse(window.sessionStorage.getItem('state') || 'null')
if (state !== null && state.state === stateToken && state.redirect != undefined) { if (state !== null && state.state === stateToken && state.redirect != null) {
this.setState({ redirect: state.redirect }) this.setState({ redirect: state.redirect })
} }
this.props.history.replace(this.props.location.pathname) this.props.history.replace(this.props.location.pathname)
let counter = 0 let counter = 0
const retry = async () => { const retry = async () => {
if (this.stopped) return
try { try {
const rsp = await superagent.get('/api/auth/user') const rsp = await superagent.get('/api/auth/user')
this.props.dispatch({ this.props.dispatch({
@ -43,7 +50,7 @@ class OauthCallback extends Component {
this.setState({ notReady: false }) this.setState({ notReady: false })
} catch (e) { } catch (e) {
counter++ counter++
if (counter > 100) { if (counter > 10) {
this.setState({ message: "i couldn't log you in. :c" }) this.setState({ message: "i couldn't log you in. :c" })
} else { } else {
setTimeout(() => { retry() }, 250) setTimeout(() => { retry() }, 250)

View file

@ -3,16 +3,29 @@ import { DragSource } from 'react-dnd'
import Role from './index' import Role from './index'
@DragSource(Symbol.for('dnd: role'), { // @DragSource(Symbol.for('dnd: role'), {
beginDrag ({ role, categoryId }) { // beginDrag ({ role, categoryId }) {
return { role, category: categoryId } // return { role, category: categoryId }
} // }
}, // },
(connect, monitor) => ({ // (connect, monitor) => ({
connectDragSource: connect.dragSource(), // connectDragSource: connect.dragSource(),
isDragging: monitor.isDragging() // isDragging: monitor.isDragging()
})) // }))
export default class DraggableRole extends Component { export default
@DragSource(
Symbol.for('dnd: role'),
{
beginDrag ({ role, categoryId }) {
return { role, category: categoryId }
}
},
(connect, monitor) => ({
connectDragSource: connect.dragSource(),
isDragging: monitor.isDragging()
})
)
class DraggableRole extends Component {
render () { render () {
return <Role {...this.props} type='drag' /> return <Role {...this.props} type='drag' />
} }

View file

@ -12,9 +12,10 @@ import ServerLanding from '../components/servers/ServerLanding'
const aaa = (props) => (<div>{ JSON.stringify(props) }</div>) const aaa = (props) => (<div>{ JSON.stringify(props) }</div>)
@withRouter export default
@connect(({ appState, user }) => ({ ready: appState.ready, user })) @withRouter
export default class AppRouter extends Component { @connect(({ appState, user }) => ({ ready: appState.ready, user }))
class AppRouter extends Component {
render () { render () {
const isLoggedIn = this.props.user.get('isLoggedIn') const isLoggedIn = this.props.user.get('isLoggedIn')

View file

@ -13,7 +13,7 @@ const configureStore = (preloadedState, history) => {
preloadedState, preloadedState,
compose( compose(
applyMiddleware(thunk, routerMiddleware(history), createLogger()), applyMiddleware(thunk, routerMiddleware(history), createLogger()),
DevTools.instrument() // DevTools.instrument()
) )
) )

10494
UI/yarn.lock

File diff suppressed because it is too large Load diff

View file

@ -2,12 +2,13 @@
docker-compose up -d docker-compose up -d
cd Server pushd Server
yarn yarn
yarn dev yarn dev
cd .. popd
cd UI pushd UI
yarn yarn
yarn start yarn start
popd