Merge pull request #1040 from thecodingmachine/webpack5

Upgrading all dependencies in front
This commit is contained in:
David Négrier 2021-05-12 11:55:10 +02:00 committed by GitHub
commit 9bf34a5117
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 1035 additions and 1739 deletions

View file

@ -49,7 +49,7 @@ jobs:
- name: "Build" - name: "Build"
run: yarn run build run: yarn run build
env: env:
API_URL: "localhost:8080" PUSHER_URL: "//localhost:8080"
working-directory: "front" working-directory: "front"
- name: "Lint" - name: "Lint"

View file

@ -25,6 +25,15 @@
], ],
"rules": { "rules": {
"no-unused-vars": "off", "no-unused-vars": "off",
"@typescript-eslint/no-explicit-any": "error" "@typescript-eslint/no-explicit-any": "error",
// TODO: remove those ignored rules and write a stronger code!
"@typescript-eslint/no-floating-promises": "off",
"@typescript-eslint/no-unsafe-call": "off",
"@typescript-eslint/restrict-plus-operands": "off",
"@typescript-eslint/no-unsafe-assignment": "off",
"@typescript-eslint/no-unsafe-return": "off",
"@typescript-eslint/no-unsafe-member-access": "off",
"@typescript-eslint/restrict-template-expressions": "off"
} }
} }

View file

@ -7,22 +7,21 @@
"@types/google-protobuf": "^3.7.3", "@types/google-protobuf": "^3.7.3",
"@types/jasmine": "^3.5.10", "@types/jasmine": "^3.5.10",
"@types/quill": "^1.3.7", "@types/quill": "^1.3.7",
"@typescript-eslint/eslint-plugin": "^2.26.0", "@typescript-eslint/eslint-plugin": "^4.23.0",
"@typescript-eslint/parser": "^2.26.0", "@typescript-eslint/parser": "^4.23.0",
"css-loader": "^5.1.3", "css-loader": "^5.2.4",
"eslint": "^6.8.0", "eslint": "^7.26.0",
"html-webpack-plugin": "^4.3.0", "html-webpack-plugin": "^5.3.1",
"jasmine": "^3.5.0", "jasmine": "^3.5.0",
"mini-css-extract-plugin": "^1.3.9", "mini-css-extract-plugin": "^1.6.0",
"sass": "^1.32.8", "sass": "^1.32.12",
"sass-loader": "10.1.1", "sass-loader": "^11.1.0",
"ts-loader": "^6.2.2", "ts-loader": "^9.1.2",
"ts-node": "^8.10.2", "ts-node": "^9.1.1",
"typescript": "^3.8.3", "typescript": "^4.2.4",
"webpack": "^4.42.1", "webpack": "^5.37.0",
"webpack-cli": "^3.3.11", "webpack-cli": "^4.7.0",
"webpack-dev-server": "^3.10.3", "webpack-dev-server": "^3.11.2"
"webpack-merge": "^4.2.2"
}, },
"dependencies": { "dependencies": {
"@types/simple-peer": "^9.6.0", "@types/simple-peer": "^9.6.0",
@ -36,12 +35,11 @@
"quill": "1.3.6", "quill": "1.3.6",
"rxjs": "^6.6.3", "rxjs": "^6.6.3",
"simple-peer": "^9.6.2", "simple-peer": "^9.6.2",
"socket.io-client": "^2.3.0", "socket.io-client": "^2.3.0"
"webpack-require-http": "^0.4.3"
}, },
"scripts": { "scripts": {
"start": "webpack-dev-server --open", "start": "webpack serve --open",
"build": "webpack --config webpack.prod.js", "build": "NODE_ENV=production webpack",
"test": "ts-node node_modules/jasmine/bin/jasmine --config=jasmine.json", "test": "ts-node node_modules/jasmine/bin/jasmine --config=jasmine.json",
"lint": "node_modules/.bin/eslint src/ . --ext .ts", "lint": "node_modules/.bin/eslint src/ . --ext .ts",
"fix": "node_modules/.bin/eslint --fix src/ . --ext .ts" "fix": "node_modules/.bin/eslint --fix src/ . --ext .ts"

View file

@ -1,6 +1,5 @@
import { Subject } from "rxjs"; import { Subject } from "rxjs";
import { ChatEvent, isChatEvent } from "./Events/ChatEvent"; import { ChatEvent, isChatEvent } from "./Events/ChatEvent";
import * as crypto from "crypto";
import { HtmlUtils } from "../WebRtc/HtmlUtils"; import { HtmlUtils } from "../WebRtc/HtmlUtils";
import { EnterLeaveEvent } from "./Events/EnterLeaveEvent"; import { EnterLeaveEvent } from "./Events/EnterLeaveEvent";
import { isOpenPopupEvent, OpenPopupEvent } from "./Events/OpenPopupEvent"; import { isOpenPopupEvent, OpenPopupEvent } from "./Events/OpenPopupEvent";
@ -176,7 +175,7 @@ class IframeListener {
} }
private getIFrameId(scriptUrl: string): string { private getIFrameId(scriptUrl: string): string {
return 'script' + crypto.createHash('md5').update(scriptUrl).digest("hex"); return 'script' + btoa(scriptUrl);
} }
unregisterScript(scriptUrl: string): void { unregisterScript(scriptUrl: string): void {

View file

@ -1,7 +1,6 @@
const DEBUG_MODE: boolean = process.env.DEBUG_MODE == "true"; const DEBUG_MODE: boolean = process.env.DEBUG_MODE == "true";
const START_ROOM_URL : string = process.env.START_ROOM_URL || '/_/global/maps.workadventure.localhost/Floor0/floor0.json'; const START_ROOM_URL : string = process.env.START_ROOM_URL || '/_/global/maps.workadventure.localhost/Floor0/floor0.json';
// For compatibility reasons with older versions, API_URL is the old host name of PUSHER_URL const PUSHER_URL = process.env.PUSHER_URL || '//pusher.workadventure.localhost';
const PUSHER_URL = process.env.PUSHER_URL || (process.env.API_URL ? '//'+process.env.API_URL : "//pusher.workadventure.localhost");
const UPLOADER_URL = process.env.UPLOADER_URL || '//uploader.workadventure.localhost'; const UPLOADER_URL = process.env.UPLOADER_URL || '//uploader.workadventure.localhost';
const ADMIN_URL = process.env.ADMIN_URL || "//workadventure.localhost"; const ADMIN_URL = process.env.ADMIN_URL || "//workadventure.localhost";
const STUN_SERVER: string = process.env.STUN_SERVER || "stun:stun.l.google.com:19302"; const STUN_SERVER: string = process.env.STUN_SERVER || "stun:stun.l.google.com:19302";

View file

@ -151,7 +151,7 @@ export class GameScene extends DirtyScene implements CenterListener {
private GlobalMessageManager!: GlobalMessageManager; private GlobalMessageManager!: GlobalMessageManager;
public ConsoleGlobalMessageManager!: ConsoleGlobalMessageManager; public ConsoleGlobalMessageManager!: ConsoleGlobalMessageManager;
private connectionAnswerPromise: Promise<RoomJoinedMessageInterface>; private connectionAnswerPromise: Promise<RoomJoinedMessageInterface>;
private connectionAnswerPromiseResolve!: (value?: RoomJoinedMessageInterface | PromiseLike<RoomJoinedMessageInterface>) => void; private connectionAnswerPromiseResolve!: (value: RoomJoinedMessageInterface | PromiseLike<RoomJoinedMessageInterface>) => void;
// A promise that will resolve when the "create" method is called (signaling loading is ended) // A promise that will resolve when the "create" method is called (signaling loading is ended)
private createPromise: Promise<void>; private createPromise: Promise<void>;
private createPromiseResolve!: (value?: void | PromiseLike<void>) => void; private createPromiseResolve!: (value?: void | PromiseLike<void>) => void;

View file

@ -32,7 +32,7 @@ class CoWebsiteManager {
private resizing: boolean = false; private resizing: boolean = false;
private cowebsiteMainDom: HTMLDivElement; private cowebsiteMainDom: HTMLDivElement;
private cowebsiteAsideDom: HTMLDivElement; private cowebsiteAsideDom: HTMLDivElement;
get width(): number { get width(): number {
return this.cowebsiteDiv.clientWidth; return this.cowebsiteDiv.clientWidth;
} }
@ -137,14 +137,14 @@ class CoWebsiteManager {
if (allowPolicy) { if (allowPolicy) {
iframe.allow = allowPolicy; iframe.allow = allowPolicy;
} }
const onloadPromise = new Promise((resolve) => { const onloadPromise = new Promise<void>((resolve) => {
iframe.onload = () => resolve(); iframe.onload = () => resolve();
}); });
if (allowApi) { if (allowApi) {
iframeListener.registerIframe(iframe); iframeListener.registerIframe(iframe);
} }
this.cowebsiteMainDom.appendChild(iframe); this.cowebsiteMainDom.appendChild(iframe);
const onTimeoutPromise = new Promise((resolve) => { const onTimeoutPromise = new Promise<void>((resolve) => {
setTimeout(() => resolve(), 2000); setTimeout(() => resolve(), 2000);
}); });
this.currentOperationPromise = this.currentOperationPromise.then(() =>Promise.race([onloadPromise, onTimeoutPromise])).then(() => { this.currentOperationPromise = this.currentOperationPromise.then(() =>Promise.race([onloadPromise, onTimeoutPromise])).then(() => {

View file

@ -4,7 +4,7 @@
"sourceMap": true, "sourceMap": true,
"moduleResolution": "node", "moduleResolution": "node",
"module": "CommonJS", "module": "CommonJS",
"target": "ES2015", "target": "ES2017",
"declaration": false, "declaration": false,
"downlevelIteration": true, "downlevelIteration": true,
"jsx": "react", "jsx": "react",

View file

@ -3,12 +3,17 @@ const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin'); const HtmlWebpackPlugin = require('html-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin'); const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const mode = process.env.NODE_ENV ?? 'development';
const isProduction = mode === 'production';
const isDevelopment = !isProduction;
module.exports = { module.exports = {
entry: { entry: {
'main': './src/index.ts', 'main': './src/index.ts',
'iframe_api': './src/iframe_api.ts' 'iframe_api': './src/iframe_api.ts'
}, },
devtool: 'inline-source-map', mode: mode,
devtool: isDevelopment ? 'inline-source-map' : 'source-map',
devServer: { devServer: {
contentBase: './dist', contentBase: './dist',
host: '0.0.0.0', host: '0.0.0.0',
@ -46,9 +51,9 @@ module.exports = {
path: path.resolve(__dirname, 'dist'), path: path.resolve(__dirname, 'dist'),
publicPath: '/' publicPath: '/'
}, },
externals:[ /*externals:[
require('webpack-require-http') require('webpack-require-http')
], ],*/
plugins: [ plugins: [
new MiniCssExtractPlugin({filename: 'style.[contenthash].css'}), new MiniCssExtractPlugin({filename: 'style.[contenthash].css'}),
new HtmlWebpackPlugin( new HtmlWebpackPlugin(
@ -81,7 +86,9 @@ module.exports = {
'TURN_PASSWORD': null, 'TURN_PASSWORD': null,
'JITSI_URL': null, 'JITSI_URL': null,
'JITSI_PRIVATE_MODE': null, 'JITSI_PRIVATE_MODE': null,
'START_ROOM_URL': null 'START_ROOM_URL': null,
'MAX_USERNAME_LENGTH': 8,
'MAX_PER_GROUP': 4
}) })
], ],

View file

@ -1,7 +0,0 @@
const merge = require('webpack-merge');
const common = require('./webpack.config.js');
module.exports = merge(common, {
mode: 'production',
devtool: 'source-map'
});

File diff suppressed because it is too large Load diff