Add lerna

This commit is contained in:
schmelczerandras 2020-10-06 11:47:07 +02:00
parent d40c538ac5
commit 51a8e2a629
23 changed files with 137 additions and 214 deletions

View file

@ -1,10 +1,7 @@
# Path to your oh-my-zsh installation. # Path to your oh-my-zsh installation.
export ZSH="/root/.oh-my-zsh" export ZSH="/root/.oh-my-zsh"
# Set name of the theme to load --- if set to "random", it will # https://typewritten.dev/#/git_status_indicators
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
ZSH_THEME="typewritten" ZSH_THEME="typewritten"
# Which plugins would you like to load? # Which plugins would you like to load?

View file

@ -3,15 +3,11 @@
ARG VARIANT="14-buster" ARG VARIANT="14-buster"
FROM mcr.microsoft.com/vscode/devcontainers/typescript-node:0-${VARIANT} FROM mcr.microsoft.com/vscode/devcontainers/typescript-node:0-${VARIANT}
# [Optional] Uncomment this section to install additional OS packages. RUN apt update && export DEBIAN_FRONTEND=noninteractive \
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ && apt -y install --no-install-recommends git-lfs \
# && apt-get -y install --no-install-recommends <your-package-list-here> && rm -rf /var/lib/apt/lists/*
# [Optional] Uncomment if you want to install an additional version of node using nvm RUN git lfs install
# ARG EXTRA_NODE_VERSION=10
# RUN su node -c "source /usr/local/share/nvm/nvm.sh && nvm install ${EXTRA_NODE_VERSION}"
# [Optional] Uncomment if you want to install more global node packages
RUN npm install -g lerna RUN npm install -g lerna
ENV ZSH_CUSTOM /root/.oh-my-zsh/ ENV ZSH_CUSTOM /root/.oh-my-zsh/

View file

@ -4,7 +4,6 @@
"name": "Node.js & TypeScript", "name": "Node.js & TypeScript",
"build": { "build": {
"dockerfile": "Dockerfile", "dockerfile": "Dockerfile",
// Update 'VARIANT' to pick a Node version: 10, 12, 14
"args": { "args": {
"VARIANT": "14" "VARIANT": "14"
} }
@ -12,14 +11,24 @@
// Set *default* container specific settings.json values on container create. // Set *default* container specific settings.json values on container create.
"settings": { "settings": {
"terminal.integrated.shell.linux": "/bin/zsh", "terminal.integrated.shell.linux": "/bin/zsh",
"workbench.sideBar.location": "right" "workbench.sideBar.location": "right",
"files.exclude": {
"**/node_modules": true,
"**/package-lock.json": true
}
}, },
// Add the IDs of extensions you want installed when the container is created. // Add the IDs of extensions you want installed when the container is created.
"extensions": [ "extensions": [
"dbaeumer.vscode-eslint", "dbaeumer.vscode-eslint",
"ms-vscode.vscode-typescript-tslint-plugin" "ms-vscode.vscode-typescript-tslint-plugin"
], ],
// Use 'forwardPorts' to make a list of ports inside the container available locally. "workspaceMount": "source=${localWorkspaceFolder},target=/workspace,type=bind,consistency=cached",
"mounts": [
"source=decla-red-root-node_modules,target=/workspace/node_modules,type=volume",
"source=decla-red-frontend-node_modules,target=/workspace/frontend/node_modules,type=volume",
"source=decla-red-backend-node_modules,target=/workspace/backend/node_modules,type=volume",
"source=decla-red-shared-node_modules,target=/workspace/shared/node_modules,type=volume",
],
"forwardPorts": [ "forwardPorts": [
3000, 3000,
8080 8080

1
.gitattributes vendored
View file

@ -1 +1,2 @@
*.psd filter=lfs diff=lfs merge=lfs -text *.psd filter=lfs diff=lfs merge=lfs -text
* text=auto

View file

@ -1,52 +1,33 @@
{ {
"name": "decla.red-server", "name": "decla.red-server",
"version": "0.0.0",
"description": "Game server for decla.red", "description": "Game server for decla.red",
"private": true, "private": true,
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
"start": "concurrently --kill-others \"webpack --mode development -w\" \"npx nodemon dist/main.js\"", "start": "concurrently --kill-others \"webpack --mode development -w\" \"nodemon --legacy-watch dist/main.js\"",
"lint": "npx eslint --fix \"src/**/*.ts\" && npx prettier --write \"src/**/*.ts\"", "lint": "eslint --fix \"src/**/*.ts\" && prettier --write \"src/**/*.ts\"",
"build": "webpack --mode production" "build": "webpack --mode production"
}, },
"keywords": [], "keywords": [],
"author": "András Schmelczer <andras@schmelczer.dev> (https://schmelczer.dev/)", "author": "András Schmelczer <andras@schmelczer.dev> (https://schmelczer.dev/)",
"devDependencies": { "devDependencies": {
"@types/express": "^4.17.8",
"@types/gl-matrix": "^2.4.5",
"@types/node": "^14.11.2",
"@typescript-eslint/eslint-plugin": "^3.9.1",
"@typescript-eslint/parser": "^3.9.1",
"clean-webpack-plugin": "^3.0.0",
"concurrently": "^5.3.0",
"eslint": "^7.2.0",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-import": "^2.21.2",
"eslint-plugin-prettier": "^3.1.4",
"eslint-plugin-unused-imports": "^0.1.3",
"firebase": "^7.22.0",
"gl-matrix": "^3.3.0",
"nodemon": "^2.0.4", "nodemon": "^2.0.4",
"prettier": "^2.0.5", "concurrently": "^5.3.0",
"terser-webpack-plugin": "^2.3.5",
"ts-loader": "^8.0.1",
"typescript": "^3.8.3",
"@types/uuid": "^8.0.0",
"uuid": "^8.2.0",
"webpack": "^4.43.0", "webpack": "^4.43.0",
"webpack-cli": "^3.3.11", "webpack-cli": "^3.3.11",
"terser-webpack-plugin": "^2.3.5",
"webpack-dev-server": "^3.10.3", "webpack-dev-server": "^3.10.3",
"file-loader": "^6.1.0", "clean-webpack-plugin": "^3.0.0",
"@types/cors": "^2.8.7", "raw-loader": "^4.0.1",
"@types/socket.io": "^2.1.11", "resolve-url-loader": "^3.1.1",
"webpack-node-externals": "^2.5.2", "ts-loader": "^8.0.1"
"shared": "file:../shared"
}, },
"dependencies": { "dependencies": {
"cors": "^2.8.5", "cors": "^2.8.5",
"express": "^4.17.1", "express": "^4.17.1",
"http": "0.0.1-security", "http": "0.0.1-security",
"socket.io": "^2.3.0", "socket.io": "^2.3.0",
"uws": "^10.148.1" "uws": "^10.148.1",
"webpack-node-externals": "^2.5.2"
} }
} }

View file

@ -1,29 +1,31 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<script
src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/2.3.1/socket.io.js"
integrity="sha512-AcZyhRP/tbAEsXCCGlziPun5iFvcSUpEz2jKkx0blkYKbxU81F+iq8FURwPn1sYFeksJ+sDDrI5XujsqSobWdQ=="
crossorigin="anonymous"
></script>
<title>Server info</title>
</head>
<body></body>
<script>
const socket = io({
transports: ['websocket'],
});
socket.on('reconnect_attempt', () => { <head>
socket.io.opts.transports = ['polling', 'websocket']; <meta charset="UTF-8" />
}); <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/2.3.1/socket.io.js"
integrity="sha512-AcZyhRP/tbAEsXCCGlziPun5iFvcSUpEz2jKkx0blkYKbxU81F+iq8FURwPn1sYFeksJ+sDDrI5XujsqSobWdQ=="
crossorigin="anonymous"></script>
<title>Server info</title>
socket.emit('join', 'insights'); </head>
socket.on('insights', (message) => { <body></body>
document.body.innerText += message; <script>
}); const socket = io({
</script> transports: ['websocket'],
</html> });
socket.on('reconnect_attempt', () => {
socket.io.opts.transports = ['polling', 'websocket'];
});
socket.emit('join', 'insights');
socket.on('insights', (message) => {
document.body.innerText += message;
});
</script>
</html>

View file

@ -71,7 +71,6 @@ export class PhysicalContainer {
private createGroupForCommand(commandType: string) { private createGroupForCommand(commandType: string) {
const objectsReactingToCommand = []; const objectsReactingToCommand = [];
console.log(commandType);
this.objects.forEach((o, _) => { this.objects.forEach((o, _) => {
if (o.reactsToCommand(commandType)) { if (o.reactsToCommand(commandType)) {
objectsReactingToCommand.push(o); objectsReactingToCommand.push(o);

View file

@ -23,8 +23,7 @@ module.exports = {
}, },
devtool: 'source-map', devtool: 'source-map',
watchOptions: { watchOptions: {
aggregateTimeout: 600, poll: true
ignored: /node_modules/,
}, },
optimization: { optimization: {
minimize: true, minimize: true,

View file

@ -1 +0,0 @@
**/*.js

View file

@ -1,29 +0,0 @@
{
"root": true,
"env": {
"browser": true,
"es2020": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"prettier",
"prettier/@typescript-eslint"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 11,
"sourceType": "module"
},
"plugins": ["unused-imports", "@typescript-eslint", "prettier"],
"rules": {
"prettier/prettier": "error",
"no-unused-vars": "off",
"unused-imports/no-unused-imports-ts": "error",
"@typescript-eslint/no-unused-vars": ["warn", { "argsIgnorePattern": "^_" }],
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-non-null-assertion": "off"
}
}

View file

@ -1,7 +0,0 @@
{
"trailingComma": "es5",
"printWidth": 90,
"tabWidth": 2,
"singleQuote": true,
"endOfLine": "lf"
}

View file

@ -1,6 +1,5 @@
{ {
"name": "decla.red", "name": "decla.red-frontend",
"version": "0.0.0",
"description": "![logo](media/declared.png)", "description": "![logo](media/declared.png)",
"private": true, "private": true,
"main": "index.js", "main": "index.js",
@ -16,54 +15,29 @@
"autoprefixer": {} "autoprefixer": {}
} }
}, },
"browserslist": [
"defaults"
],
"sideEffects": [
"*.scss"
],
"devDependencies": { "devDependencies": {
"@types/gl-matrix": "^2.4.5", "webpack": "^4.43.0",
"@types/uuid": "^8.0.0", "webpack-cli": "^3.3.11",
"@typescript-eslint/eslint-plugin": "^3.9.1", "terser-webpack-plugin": "^2.3.5",
"@typescript-eslint/parser": "^3.9.1", "webpack-dev-server": "^3.10.3",
"autoprefixer": "^9.8.5",
"clean-webpack-plugin": "^3.0.0", "clean-webpack-plugin": "^3.0.0",
"css-loader": "^3.5.2",
"cssnano": "^4.1.10",
"eslint": "^7.2.0",
"sdf-2d": "^0.4.0",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-import": "^2.21.2",
"eslint-plugin-prettier": "^3.1.4",
"eslint-plugin-unused-imports": "^0.1.3",
"gl-matrix": "^3.3.0",
"html-webpack-inline-source-plugin": "0.0.10", "html-webpack-inline-source-plugin": "0.0.10",
"html-webpack-plugin": "^3.2.0", "html-webpack-plugin": "^3.2.0",
"image-webpack-loader": "^6.0.0", "image-webpack-loader": "^6.0.0",
"mini-css-extract-plugin": "^0.9.0", "mini-css-extract-plugin": "^0.9.0",
"optimize-css-assets-webpack-plugin": "^5.0.3", "optimize-css-assets-webpack-plugin": "^5.0.3",
"postcss-loader": "^3.0.0", "postcss-loader": "^3.0.0",
"prettier": "^2.0.5",
"raw-loader": "^4.0.1", "raw-loader": "^4.0.1",
"resolve-url-loader": "^3.1.1", "resolve-url-loader": "^3.1.1",
"responsive-loader": "^1.2.0",
"sass": "^1.26.3", "sass": "^1.26.3",
"sass-loader": "^9.0.2", "sass-loader": "^9.0.2",
"sharp": "^0.25.4",
"style-loader": "^1.1.4",
"svg-url-loader": "^6.0.0", "svg-url-loader": "^6.0.0",
"terser-webpack-plugin": "^2.3.5", "ts-loader": "^8.0.1"
"ts-loader": "^8.0.1", },
"typescript": "^3.8.3", "browserslist": [
"uuid": "^8.2.0", "defaults"
"file-loader": "^6.1.0", ],
"webpack": "^4.43.0", "sideEffects": [
"webpack-cli": "^3.3.11", "*.scss"
"webpack-dev-server": "^3.10.3", ]
"firebase": "^7.22.0",
"@types/socket.io-client": "^1.4.34",
"socket.io-client": "^2.3.1",
"shared": "file:../shared"
}
} }

View file

@ -1,22 +1,21 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head>
<meta charset="utf-8" />
<meta <head>
name="viewport" <meta charset="utf-8" />
content="width=device-width,initial-scale=1,viewport-fit=cover" <meta name="viewport" content="width=device-width,initial-scale=1,viewport-fit=cover" />
/> <meta name="theme-color" content="#b7455e" />
<meta name="theme-color" content="#b7455e" />
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" /> <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
<link rel="icon" href="/favicon.ico" type="image/x-icon" /> <link rel="icon" href="/favicon.ico" type="image/x-icon" />
<title>decla.red</title> <title>decla.red</title>
</head> </head>
<body>
<noscript>Javascript is required for this website.</noscript> <body>
<div id="overlay"></div> <noscript>Javascript is required for this website.</noscript>
<canvas id="main"></canvas> <div id="overlay"></div>
</body> <canvas id="main"></canvas>
</html> </body>
</html>

View file

@ -21,13 +21,14 @@ module.exports = {
filename: '[name].[contenthash].js', filename: '[name].[contenthash].js',
path: PATHS.bundles, path: PATHS.bundles,
}, },
devtool: 'source-map', devtool: 'source-map',
watchOptions: {
ignored: /node_modules/,
},
devServer: { devServer: {
host: '0.0.0.0', host: '0.0.0.0',
disableHostCheck: true, disableHostCheck: true,
watchOptions: {
poll: true
},
}, },
optimization: { optimization: {
minimize: true, minimize: true,

8
lerna.json Normal file
View file

@ -0,0 +1,8 @@
{
"packages": [
"frontend",
"shared",
"backend"
],
"version": "0.0.0"
}

39
package.json Normal file
View file

@ -0,0 +1,39 @@
{
"name": "root",
"private": true,
"scripts": {
"start": "lerna run --parallel start"
},
"devDependencies": {
"@types/cors": "^2.8.7",
"@types/express": "^4.17.8",
"@types/node": "^14.11.2",
"@types/socket.io": "^2.1.11",
"@types/socket.io-client": "^1.4.34",
"@types/uuid": "^8.0.0",
"@typescript-eslint/eslint-plugin": "^3.9.1",
"@typescript-eslint/parser": "^3.9.1",
"autoprefixer": "^9.8.5",
"lerna": "^3.22.1",
"css-loader": "^3.5.2",
"cssnano": "^4.1.10",
"eslint": "^7.2.0",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-import": "^2.21.2",
"eslint-plugin-prettier": "^3.1.4",
"eslint-plugin-unused-imports": "^0.1.3",
"file-loader": "^6.1.0",
"firebase": "^7.22.0",
"gl-matrix": "^3.3.0",
"prettier": "^2.0.5",
"sdf-2d": "^0.4.0",
"socket.io-client": "^2.3.1",
"typescript": "^3.8.3",
"uuid": "^8.2.0"
},
"dependencies": {
"decla.red-frontend": "file:frontend",
"decla.red-server": "file:backend",
"shared": "file:shared"
}
}

View file

@ -1 +0,0 @@
**/*.js

View file

@ -1,29 +0,0 @@
{
"root": true,
"env": {
"browser": true,
"es2020": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"prettier",
"prettier/@typescript-eslint"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 11,
"sourceType": "module"
},
"plugins": ["unused-imports", "@typescript-eslint", "prettier"],
"rules": {
"prettier/prettier": "error",
"no-unused-vars": "off",
"unused-imports/no-unused-imports-ts": "error",
"@typescript-eslint/no-unused-vars": ["warn", { "argsIgnorePattern": "^_" }],
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-non-null-assertion": "off"
}
}

View file

@ -1,7 +0,0 @@
{
"trailingComma": "es5",
"printWidth": 90,
"tabWidth": 2,
"singleQuote": true,
"endOfLine": "lf"
}

View file

@ -1,17 +1,9 @@
{ {
"name": "shared", "name": "shared",
"version": "0.0.0", "private": true,
"description": "Shared library between backend and frontend", "description": "Shared library between backend and frontend",
"main": "src/main.ts", "main": "src/main.ts",
"scripts": { "scripts": {
"test": "echo \"Error: no test specified\" && exit 1" "test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"devDependencies": {
"@types/gl-matrix": "^3.2.0",
"@types/uuid": "^8.0.0",
"gl-matrix": "^3.3.0",
"uuid": "^8.2.0"
} }
} }