Move Typescript source to src folders
This commit is contained in:
parent
8577e36852
commit
18123d7a9d
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"extends": "@tsconfig/node14/tsconfig.json",
|
"extends": "@tsconfig/node14/tsconfig.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"rootDir": ".",
|
"rootDir": "src",
|
||||||
"outDir": "dist"
|
"outDir": "dist"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"extends": "@tsconfig/node14/tsconfig.json",
|
"extends": "@tsconfig/node14/tsconfig.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"rootDir": ".",
|
"rootDir": "src",
|
||||||
"outDir": "dist"
|
"outDir": "dist"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"extends": "@tsconfig/node14/tsconfig.json",
|
"extends": "@tsconfig/node14/tsconfig.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"rootDir": ".",
|
"rootDir": "src",
|
||||||
"outDir": "dist"
|
"outDir": "dist"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"extends": "@tsconfig/node14/tsconfig.json",
|
"extends": "@tsconfig/node14/tsconfig.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"rootDir": ".",
|
"rootDir": "src",
|
||||||
"outDir": "dist"
|
"outDir": "dist"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"extends": "@tsconfig/node14/tsconfig.json",
|
"extends": "@tsconfig/node14/tsconfig.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"rootDir": ".",
|
"rootDir": "src",
|
||||||
"outDir": "dist"
|
"outDir": "dist"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"extends": "@tsconfig/node14/tsconfig.json",
|
"extends": "@tsconfig/node14/tsconfig.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"rootDir": ".",
|
"rootDir": "src",
|
||||||
"outDir": "dist"
|
"outDir": "dist"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -173,23 +173,53 @@ export function buildDeck(age: number, numPlayers: number) {
|
|||||||
export interface Wonder {
|
export interface Wonder {
|
||||||
name: string
|
name: string
|
||||||
innateResource: Resource
|
innateResource: Resource
|
||||||
|
//stages: Structure[]
|
||||||
}
|
}
|
||||||
|
|
||||||
const wonderList: Wonder[] = [
|
const wonderList: Wonder[] = [
|
||||||
{ name: 'Great Pyramid of Giza A', innateResource: 'stone' },
|
{
|
||||||
{ name: 'Great Pyramid of Giza B', innateResource: 'stone' },
|
name: 'Great Pyramid of Giza A',
|
||||||
{ name: 'Hanging Gardens of Babylon A', innateResource: 'brick' },
|
innateResource: 'stone'
|
||||||
{ name: 'Hanging Gardens of Babylon B', innateResource: 'brick' },
|
}, {
|
||||||
{ name: 'Temple of Artemis at Ephesus A', innateResource: 'paper' },
|
name: 'Great Pyramid of Giza B',
|
||||||
{ name: 'Temple of Artemis at Ephesus B', innateResource: 'paper' },
|
innateResource: 'stone'
|
||||||
{ name: 'Statue of Zeus at Olympia A', innateResource: 'wood' },
|
}, {
|
||||||
{ name: 'Statue of Zeus at Olympia B', innateResource: 'wood' },
|
name: 'Hanging Gardens of Babylon A',
|
||||||
{ name: 'Mausoleum at Halicarnassus A', innateResource: 'cloth' },
|
innateResource: 'brick'
|
||||||
{ name: 'Mausoleum at Halicarnassus B', innateResource: 'cloth' },
|
}, {
|
||||||
{ name: 'Colossus of Rhodes A', innateResource: 'ore' },
|
name: 'Hanging Gardens of Babylon B',
|
||||||
{ name: 'Colossus of Rhodes B', innateResource: 'ore' },
|
innateResource: 'brick'
|
||||||
{ name: 'Lighthouse of Alexandria A', innateResource: 'glass' },
|
}, {
|
||||||
{ name: 'Lighthouse of Alexandria B', innateResource: 'glass' },
|
name: 'Temple of Artemis at Ephesus A',
|
||||||
|
innateResource: 'paper'
|
||||||
|
}, {
|
||||||
|
name: 'Temple of Artemis at Ephesus B',
|
||||||
|
innateResource: 'paper'
|
||||||
|
}, {
|
||||||
|
name: 'Statue of Zeus at Olympia A',
|
||||||
|
innateResource: 'wood'
|
||||||
|
}, {
|
||||||
|
name: 'Statue of Zeus at Olympia B',
|
||||||
|
innateResource: 'wood'
|
||||||
|
}, {
|
||||||
|
name: 'Mausoleum at Halicarnassus A',
|
||||||
|
innateResource: 'cloth'
|
||||||
|
}, {
|
||||||
|
name: 'Mausoleum at Halicarnassus B',
|
||||||
|
innateResource: 'cloth'
|
||||||
|
}, {
|
||||||
|
name: 'Colossus of Rhodes A',
|
||||||
|
innateResource: 'ore'
|
||||||
|
}, {
|
||||||
|
name: 'Colossus of Rhodes B',
|
||||||
|
innateResource: 'ore'
|
||||||
|
}, {
|
||||||
|
name: 'Lighthouse of Alexandria A',
|
||||||
|
innateResource: 'glass'
|
||||||
|
}, {
|
||||||
|
name: 'Lighthouse of Alexandria B',
|
||||||
|
innateResource: 'glass'
|
||||||
|
},
|
||||||
]
|
]
|
||||||
export const wonders = new Map(wonderList.map(w => [w.name, w]))
|
export const wonders = new Map(wonderList.map(w => [w.name, w]))
|
||||||
|
|
||||||
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"extends": "@tsconfig/node14/tsconfig.json",
|
"extends": "@tsconfig/node14/tsconfig.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"rootDir": ".",
|
"rootDir": "src",
|
||||||
"outDir": "dist"
|
"outDir": "dist"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,23 +0,0 @@
|
|||||||
{
|
|
||||||
"env": {
|
|
||||||
"es2021": true,
|
|
||||||
"node": true
|
|
||||||
},
|
|
||||||
"extends": [
|
|
||||||
"standard"
|
|
||||||
],
|
|
||||||
"parser": "@typescript-eslint/parser",
|
|
||||||
"parserOptions": {
|
|
||||||
"ecmaVersion": 12,
|
|
||||||
"sourceType": "module"
|
|
||||||
},
|
|
||||||
"plugins": [
|
|
||||||
"@typescript-eslint"
|
|
||||||
],
|
|
||||||
"rules": {
|
|
||||||
"comma-dangle": ["error", "only-multiline"],
|
|
||||||
"padded-blocks": "warn",
|
|
||||||
"no-multiple-empty-lines": "warn",
|
|
||||||
"space-before-function-paren": "off"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,20 +0,0 @@
|
|||||||
FROM node:16-alpine
|
|
||||||
|
|
||||||
RUN apk add --no-cache tini
|
|
||||||
|
|
||||||
RUN yarn global add lerna
|
|
||||||
|
|
||||||
WORKDIR /opt/wonders-server
|
|
||||||
COPY packages/ketchup-common/package.json packages/ketchup-common/
|
|
||||||
COPY packages/ketchup-server/package.json packages/ketchup-server/
|
|
||||||
COPY packages/wonders-common/package.json packages/wonders-common/
|
|
||||||
COPY packages/wonders-server/package.json packages/wonders-server/
|
|
||||||
COPY package.json yarn.lock lerna.json ./
|
|
||||||
RUN lerna bootstrap
|
|
||||||
|
|
||||||
COPY . ./
|
|
||||||
RUN lerna run build
|
|
||||||
|
|
||||||
ENTRYPOINT ["tini", "--"]
|
|
||||||
CMD ["node", "packages/wonders-server"]
|
|
||||||
EXPOSE 80
|
|
||||||
@ -1,22 +0,0 @@
|
|||||||
import WebSocket from 'ws'
|
|
||||||
import KetchupServer from 'ketchup-server'
|
|
||||||
import { initial, reducer } from 'wonders-common'
|
|
||||||
|
|
||||||
const port = parseInt(process.env.PORT ?? '80')
|
|
||||||
|
|
||||||
const wss = new WebSocket.Server({ port })
|
|
||||||
|
|
||||||
const ks = new KetchupServer(initial, reducer)
|
|
||||||
|
|
||||||
wss.on('connection', ws => {
|
|
||||||
ks.addRemoteClient(ws)
|
|
||||||
})
|
|
||||||
|
|
||||||
console.log(`Listening on ${port}`)
|
|
||||||
|
|
||||||
function shutdown() {
|
|
||||||
console.log('Shutting down')
|
|
||||||
wss.close()
|
|
||||||
}
|
|
||||||
process.on('SIGINT', shutdown)
|
|
||||||
process.on('SIGTERM', shutdown)
|
|
||||||
@ -1,36 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "wonders-server",
|
|
||||||
"version": "0.1.3",
|
|
||||||
"description": "WebSocket-based rollback state synchronization server.",
|
|
||||||
"main": "dist/index.js",
|
|
||||||
"license": "MIT",
|
|
||||||
"private": true,
|
|
||||||
"dependencies": {
|
|
||||||
"ketchup-server": "^0.1.1",
|
|
||||||
"lodash": "^4.17.20",
|
|
||||||
"wonders-common": "^0.1.1",
|
|
||||||
"ts-node": "^9.1.1",
|
|
||||||
"ws": "^7.4.2"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"@tsconfig/node14": "^1.0.0",
|
|
||||||
"@types/jest": "^26.0.20",
|
|
||||||
"@types/lodash": "^4.14.168",
|
|
||||||
"@types/node": "^14.14.22",
|
|
||||||
"@types/ws": "^7.4.0",
|
|
||||||
"@typescript-eslint/eslint-plugin": "^4.14.1",
|
|
||||||
"@typescript-eslint/parser": "^4.14.1",
|
|
||||||
"eslint": "^7.18.0",
|
|
||||||
"jest": "^26.6.3",
|
|
||||||
"ts-jest": "^26.5.0",
|
|
||||||
"typescript": "^4.1.3"
|
|
||||||
},
|
|
||||||
"optionalDependencies": {
|
|
||||||
"bufferutil": "^4.0.3",
|
|
||||||
"utf-8-validate": "^5.0.4"
|
|
||||||
},
|
|
||||||
"scripts": {
|
|
||||||
"build": "tsc",
|
|
||||||
"start": "node dist"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,7 +0,0 @@
|
|||||||
{
|
|
||||||
"extends": "@tsconfig/node14/tsconfig.json",
|
|
||||||
"compilerOptions": {
|
|
||||||
"rootDir": ".",
|
|
||||||
"outDir": "dist"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue
Block a user