Fix ide support

This commit is contained in:
schmelczerandras 2020-10-07 18:35:32 +02:00
parent 1a3afe4dd0
commit e01400058d
14 changed files with 50 additions and 20 deletions

View file

@ -1,5 +1,3 @@
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.140.1/containers/typescript-node/.devcontainer/base.Dockerfile
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}

View file

@ -42,11 +42,11 @@
"workspaceMount": "source=${localWorkspaceFolder},target=/workspace,type=bind,consistency=cached", "workspaceMount": "source=${localWorkspaceFolder},target=/workspace,type=bind,consistency=cached",
"workspaceFolder": "/workspace", "workspaceFolder": "/workspace",
"mounts": [ "mounts": [
"source=decla-red-root-node_modules2,target=/workspace/node_modules,type=volume", "source=decla-red-root-node_modules-static,target=/workspace/node_modules,type=volume",
"source=decla-red-frontend-node_modules2,target=/workspace/frontend/node_modules,type=volume", "source=decla-red-frontend-node_modules-static,target=/workspace/frontend/node_modules,type=volume",
"source=decla-red-backend-node_modules2,target=/workspace/backend/node_modules,type=volume", "source=decla-red-backend-node_modules-static,target=/workspace/backend/node_modules,type=volume",
"source=decla-red-shared-node_modules2,target=/workspace/shared/node_modules,type=volume" "source=decla-red-shared-node_modules-static,target=/workspace/shared/node_modules,type=volume"
], ],
"forwardPorts": [3000, 8080], "forwardPorts": [3000, 8080],
"postCreateCommand": "sudo npm install && sudo npm run initialize && npm run build" "postCreateCommand": "chown node:node ./**/node_modules && sudo npm install && npm run initialize && npm run build"
} }

View file

@ -6,9 +6,9 @@
"author": "András Schmelczer <andras@schmelczer.dev> (https://schmelczer.dev/)", "author": "András Schmelczer <andras@schmelczer.dev> (https://schmelczer.dev/)",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
"build": "webpack --mode production", "build": "npx webpack --mode production",
"initialize": "npm install", "initialize": "npm install",
"start": "concurrently --kill-others \"webpack --mode development -w\" \"nodemon --legacy-watch dist/main.js\"", "start": "concurrently --kill-others \"npx webpack --mode development -w\" \"nodemon --legacy-watch dist/main.js\"",
"try-build": "npm run build && node dist/main.js" "try-build": "npm run build && node dist/main.js"
}, },
"dependencies": { "dependencies": {

View file

@ -33,6 +33,7 @@ module.exports = (env, argv) => ({
new TerserJSPlugin({ new TerserJSPlugin({
sourceMap: false, sourceMap: false,
test: /\.js$/, test: /\.js$/,
exclude: /node_modules/,
terserOptions: { terserOptions: {
keep_classnames: true, keep_classnames: true,
}, },
@ -65,6 +66,7 @@ module.exports = (env, argv) => ({
loader: 'ts', loader: 'ts',
target: 'es2015', target: 'es2015',
}, },
exclude: /node_modules/,
}, },
], ],
}, },

21
declared.code-workspace Normal file
View file

@ -0,0 +1,21 @@
{
"folders": [
{
"name": "Root",
"path": "."
},
{
"name": "Frontend",
"path": "./frontend"
},
{
"name": "Backend",
"path": "./backend"
},
{
"name": "Shared",
"path": "./shared"
}
],
"settings": {}
}

View file

@ -9,9 +9,9 @@
], ],
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
"build": "webpack --mode production", "build": "npx webpack --mode production",
"initialize": "npm install", "initialize": "npm install",
"start": "webpack-dev-server --mode development", "start": "npx webpack-dev-server --mode development",
"try-build": "npm run build && cd dist && python3 -m http.server 8080" "try-build": "npm run build && cd dist && python3 -m http.server 8080"
}, },
"browserslist": [ "browserslist": [

View file

@ -37,6 +37,7 @@ module.exports = (env, argv) => ({
new TerserJSPlugin({ new TerserJSPlugin({
sourceMap: false, sourceMap: false,
test: /\.js$/, test: /\.js$/,
exclude: /node_modules/,
terserOptions: { terserOptions: {
keep_classnames: true, keep_classnames: true,
}, },
@ -109,6 +110,7 @@ module.exports = (env, argv) => ({
loader: 'ts', loader: 'ts',
target: 'es2015', target: 'es2015',
}, },
exclude: /node_modules/,
}, },
], ],
}, },

View file

@ -38,6 +38,7 @@
"prettier": "^2.0.5", "prettier": "^2.0.5",
"sdf-2d": "^0.4.0", "sdf-2d": "^0.4.0",
"socket.io-client": "^2.3.1", "socket.io-client": "^2.3.1",
"typescript": "^3.9.7",
"uuid": "^8.2.0" "uuid": "^8.2.0"
} }
} }

View file

@ -8,11 +8,10 @@
"lib" "lib"
], ],
"scripts": { "scripts": {
"build": "webpack --mode production", "build-before": "npx webpack --mode production",
"build-before": "npm run build",
"initialize": "npm install", "initialize": "npm install",
"start": "webpack --mode development --watch", "start": "npx webpack --mode development --watch",
"try-build-before": "npm run build-before" "try-build-before": "npx webpack --mode production"
}, },
"devDependencies": { "devDependencies": {
"clean-webpack-plugin": "^3.0.0", "clean-webpack-plugin": "^3.0.0",

View file

@ -0,0 +1,3 @@
export type CommandExecutors = {
[type: string]: (command: any) => unknown;
};

View file

@ -1,9 +1,6 @@
import { CommandExecutors } from './command-executors';
import { Command } from './command'; import { Command } from './command';
export type CommandExecutors = {
[type: string]: (command: any) => unknown;
};
export abstract class CommandReceiver { export abstract class CommandReceiver {
protected commandExecutors: CommandExecutors = {}; protected commandExecutors: CommandExecutors = {};

View file

@ -5,6 +5,10 @@ import { serializable } from '../transport/serialization/serializable';
export class Circle { export class Circle {
constructor(public center: vec2, public radius: number) {} constructor(public center: vec2, public radius: number) {}
public distance(target: vec2): number {
return vec2.distance(this.center, target) - this.radius;
}
public toArray(): Array<any> { public toArray(): Array<any> {
return [this.center, this.radius]; return [this.center, this.radius];
} }

View file

@ -10,6 +10,7 @@ export * from './commands/types/set-view-area-action';
export * from './commands/types/primary-action'; export * from './commands/types/primary-action';
export * from './commands/types/secondary-action'; export * from './commands/types/secondary-action';
export * from './commands/command-receiver'; export * from './commands/command-receiver';
export * from './commands/command-executors';
export * from './commands/command-generator'; export * from './commands/command-generator';
export * from './commands/broadcast-commands'; export * from './commands/broadcast-commands';
export * from './helper/array'; export * from './helper/array';

View file

@ -1,5 +1,6 @@
{ {
"compilerOptions": { "compilerOptions": {
"outDir": "lib",
"sourceMap": true, "sourceMap": true,
"declaration": true, "declaration": true,
"declarationMap": true, "declarationMap": true,
@ -12,5 +13,6 @@
"module": "es6", "module": "es6",
"composite": true, "composite": true,
"lib": ["dom", "es2017"] "lib": ["dom", "es2017"]
} },
"include": ["**/src/**/*", "package.json"]
} }