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/public
/Server/node_modules
/UI/node_modules

1
.gitignore vendored
View file

@ -5,3 +5,4 @@ Server/\.env
Server/prod\.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
RUN npm i -g yarn
COPY . /src
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
WORKDIR /dist
EXPOSE 6769

View file

@ -8,6 +8,7 @@ const _io = require('socket.io')
const path = require('path')
const router = require('koa-better-router')().loadMethods()
const Roleypoly = require('./Roleypoly')
const ksuid = require('ksuid')
// monkey patch async-reduce because F U T U R E
Array.prototype.areduce = async function (predicate, acc = []) { // eslint-disable-line
@ -88,7 +89,8 @@ async function start () {
key: 'roleypoly:sess',
maxAge: 'session',
siteOnly: true,
store: M.ctx.sessions
store: M.ctx.sessions,
genid: () => { return ksuid.randomSync().string }
}, app))
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"
},
"dependencies": {
"chalk": "^2.3.0",
"discord.js": "^11.2.1",
"dotenv": "^4.0.0",
"chalk": "^2.4.1",
"discord.js": "^11.4.2",
"dotenv": "^6.1.0",
"erlpack": "github:discordapp/erlpack",
"eslint": "^4.14.0",
"eslint-config-standard": "^11.0.0-beta.0",
"glob": "^7.1.2",
"eslint": "^5.8.0",
"eslint-config-standard": "^12.0.0",
"glob": "^7.1.3",
"immutable": "^3.8.2",
"koa": "^2.4.1",
"koa": "^2.6.1",
"koa-better-router": "^2.1.1",
"koa-bodyparser": "^4.2.0",
"koa-send": "^4.1.2",
"koa-session": "^5.5.1",
"koa-compress": "^2.0.0",
"koa-static": "^4.0.2",
"ksuid": "^0.4.0",
"lru-cache": "^4.1.1",
"pg": "^7.4.0",
"koa-bodyparser": "^4.2.1",
"koa-send": "^5.0.0",
"koa-session": "^5.10.0",
"koa-compress": "^3.0.0",
"koa-static": "^5.0.0",
"ksuid": "^1.1.3",
"lru-cache": "^4.1.3",
"pg": "^7.6.0",
"pg-hstore": "^2.3.2",
"pm2": "^2.9.1",
"sequelize": "^4.28.6",
"socket.io": "^2.0.4",
"superagent": "^3.8.2",
"uuid": "^3.1.0",
"uws": "^9.14.0"
"pm2": "^2.9.3",
"sequelize": "^4.41.0",
"socket.io": "^2.1.1",
"superagent": "^4.0.0-beta.5",
"uuid": "^3.3.2",
"uws": "10.148.1"
}
}

View file

@ -6,7 +6,7 @@ class SessionsService extends Service {
this.Session = ctx.M.Session
}
async get (id) {
async get (id, {rolling}) {
const user = await this.Session.findOne({ where: { id } })
if (user === null) {
@ -16,12 +16,14 @@ class SessionsService extends Service {
return user.data
}
async set (id, data, maxAge) {
async set (id, data, {maxAge, rolling, changed}) {
let session = await this.Session.findOne({ where: { id } })
if (session === null) {
session = this.Session.build({ id })
}
console.log(maxAge)
session.data = data
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
/node_modules
/.pnp
.pnp.js
# testing
/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",
"private": true,
"dependencies": {
"color": "^2.0.1",
"custom-react-scripts": "0.2.1",
"color": "^3.1.0",
"history": "^4.7.2",
"immutable": "^3.8.2",
"moment": "^2.20.1",
"prop-types": "^15.6.0",
"react": "^16.2.0",
"moment": "^2.22.2",
"prop-types": "^15.6.2",
"react": "^16.6.0",
"react-custom-scrollbars": "^4.2.1",
"react-dnd": "^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-redux": "^5.0.6",
"react-router": "^4.2.0",
"react-router-dom": "^4.2.2",
"react-redux": "^5.1.0",
"react-router": "^4.3.1",
"react-router-dom": "^4.3.1",
"react-router-redux": "^5.0.0-alpha.8",
"react-scripts": "2.1.1",
"react-typist": "^2.0.4",
"react-typist-cycle": "^0.1.2",
"redux": "^3.7.2",
"redux": "^4.0.1",
"redux-logger": "^3.0.6",
"redux-thunk": "^2.2.0",
"superagent": "^3.8.2",
"uuid": "^3.1.0"
"redux-thunk": "^2.3.0",
"superagent": "^4.0.0-beta.5",
"uuid": "^3.3.2"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
"start": "react-app-rewired start",
"build": "react-app-rewired build",
"test": "react-app-rewired test",
"eject": "react-app-rewired eject"
},
"homepage": "https://rp.kat.cafe",
"proxy": {
"/api": {
"target": "http://localhost:6769"
},
"/api/socket.io": {
"target": "ws://localhost:6769/socket.io",
"ws": true
}
"eslintConfig": {
"extends": "react-app"
},
"browserslist": [
">0.2%",
"not dead",
"not ie <= 11",
"not op_mini all"
],
"proxy": "http://localhost:6769",
"devDependencies": {
"eslint": "^4.14.0",
"eslint-config-standard": "^11.0.0-beta.0",
"eslint-plugin-import": "^2.8.0",
"eslint-plugin-node": "^5.2.1",
"eslint-plugin-promise": "^3.6.0",
"eslint-plugin-react": "^7.5.1",
"eslint-plugin-standard": "^3.0.1",
"@babel/plugin-proposal-decorators": "^7.1.2",
"customize-cra": "^0.2.1",
"eslint-config-standard": "^12.0.0",
"eslint-plugin-import": "^2.14.0",
"eslint-plugin-node": "^8.0.0",
"eslint-plugin-promise": "^4.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-dock-monitor": "^1.1.3",
"redux-devtools-log-monitor": "^1.4.0"

View file

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

View file

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

View file

@ -3,16 +3,29 @@ import { DragSource } from 'react-dnd'
import Role from './index'
@DragSource(Symbol.for('dnd: role'), {
beginDrag ({ role, categoryId }) {
return { role, category: categoryId }
}
},
(connect, monitor) => ({
connectDragSource: connect.dragSource(),
isDragging: monitor.isDragging()
}))
export default class DraggableRole extends Component {
// @DragSource(Symbol.for('dnd: role'), {
// beginDrag ({ role, categoryId }) {
// return { role, category: categoryId }
// }
// },
// (connect, monitor) => ({
// connectDragSource: connect.dragSource(),
// isDragging: monitor.isDragging()
// }))
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 () {
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>)
@withRouter
@connect(({ appState, user }) => ({ ready: appState.ready, user }))
export default class AppRouter extends Component {
export default
@withRouter
@connect(({ appState, user }) => ({ ready: appState.ready, user }))
class AppRouter extends Component {
render () {
const isLoggedIn = this.props.user.get('isLoggedIn')

View file

@ -13,7 +13,7 @@ const configureStore = (preloadedState, history) => {
preloadedState,
compose(
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
cd Server
pushd Server
yarn
yarn dev
cd ..
popd
cd UI
pushd UI
yarn
yarn start
yarn start
popd