mirror of
https://github.com/OpenLiberty/liberty-bikes.git
synced 2025-01-30 10:40:13 +08:00
Merge pull request #101 from realModusOperandi/angular-6
Update to Angular 6
This commit is contained in:
commit
6eaf015c5e
@ -1,64 +0,0 @@
|
||||
{
|
||||
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
|
||||
"project": {
|
||||
"name": "frontend"
|
||||
},
|
||||
"apps": [
|
||||
{
|
||||
"root": "src",
|
||||
"outDir": "dist",
|
||||
"assets": [
|
||||
"assets",
|
||||
"favicon.ico"
|
||||
],
|
||||
"index": "index.html",
|
||||
"main": "main.ts",
|
||||
"polyfills": "polyfills.ts",
|
||||
"test": "test.ts",
|
||||
"tsconfig": "tsconfig.app.json",
|
||||
"testTsconfig": "tsconfig.spec.json",
|
||||
"prefix": "app",
|
||||
"styles": [
|
||||
"../node_modules/bootstrap/scss/bootstrap.scss",
|
||||
"styles.scss"
|
||||
],
|
||||
"scripts": [
|
||||
"../node_modules/bootstrap/dist/js/bootstrap.min.js"
|
||||
],
|
||||
"environmentSource": "environments/environment.ts",
|
||||
"environments": {
|
||||
"dev": "environments/environment.ts",
|
||||
"prod": "environments/environment.prod.ts"
|
||||
}
|
||||
}
|
||||
],
|
||||
"e2e": {
|
||||
"protractor": {
|
||||
"config": "./protractor.conf.js"
|
||||
}
|
||||
},
|
||||
"lint": [
|
||||
{
|
||||
"project": "src/tsconfig.app.json",
|
||||
"exclude": "**/node_modules/**"
|
||||
},
|
||||
{
|
||||
"project": "src/tsconfig.spec.json",
|
||||
"exclude": "**/node_modules/**"
|
||||
},
|
||||
{
|
||||
"project": "e2e/tsconfig.e2e.json",
|
||||
"exclude": "**/node_modules/**"
|
||||
}
|
||||
],
|
||||
"test": {
|
||||
"karma": {
|
||||
"config": "./karma.conf.js"
|
||||
}
|
||||
},
|
||||
"defaults": {
|
||||
"styleExt": "scss",
|
||||
"component": {
|
||||
}
|
||||
}
|
||||
}
|
129
frontend/prebuild/angular.json
Normal file
129
frontend/prebuild/angular.json
Normal file
@ -0,0 +1,129 @@
|
||||
{
|
||||
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
|
||||
"version": 1,
|
||||
"newProjectRoot": "projects",
|
||||
"projects": {
|
||||
"frontend": {
|
||||
"root": "",
|
||||
"sourceRoot": "src",
|
||||
"projectType": "application",
|
||||
"architect": {
|
||||
"build": {
|
||||
"builder": "@angular-devkit/build-angular:browser",
|
||||
"options": {
|
||||
"outputPath": "dist",
|
||||
"index": "src/index.html",
|
||||
"main": "src/main.ts",
|
||||
"tsConfig": "src/tsconfig.app.json",
|
||||
"polyfills": "src/polyfills.ts",
|
||||
"assets": [
|
||||
"src/assets",
|
||||
"src/favicon.ico"
|
||||
],
|
||||
"styles": [
|
||||
"node_modules/bootstrap/scss/bootstrap.scss",
|
||||
"src/styles.scss"
|
||||
],
|
||||
"scripts": [
|
||||
"node_modules/bootstrap/dist/js/bootstrap.min.js"
|
||||
]
|
||||
},
|
||||
"configurations": {
|
||||
"prod": {
|
||||
"fileReplacements": [
|
||||
{
|
||||
"replace": "src/environments/environment.ts",
|
||||
"with": "src/environments/environment.prod.ts"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"serve": {
|
||||
"builder": "@angular-devkit/build-angular:dev-server",
|
||||
"options": {
|
||||
"browserTarget": "frontend:build"
|
||||
},
|
||||
"configurations": {
|
||||
"prod": {
|
||||
"browserTarget": "frontend:build:prod"
|
||||
}
|
||||
}
|
||||
},
|
||||
"extract-i18n": {
|
||||
"builder": "@angular-devkit/build-angular:extract-i18n",
|
||||
"options": {
|
||||
"browserTarget": "frontend:build"
|
||||
}
|
||||
},
|
||||
"test": {
|
||||
"builder": "@angular-devkit/build-angular:karma",
|
||||
"options": {
|
||||
"main": "src/test.ts",
|
||||
"karmaConfig": "./karma.conf.js",
|
||||
"polyfills": "src/polyfills.ts",
|
||||
"tsConfig": "src/tsconfig.spec.json",
|
||||
"scripts": [
|
||||
"node_modules/bootstrap/dist/js/bootstrap.min.js"
|
||||
],
|
||||
"styles": [
|
||||
"node_modules/bootstrap/scss/bootstrap.scss",
|
||||
"src/styles.scss"
|
||||
],
|
||||
"assets": [
|
||||
"src/assets",
|
||||
"src/favicon.ico"
|
||||
]
|
||||
}
|
||||
},
|
||||
"lint": {
|
||||
"builder": "@angular-devkit/build-angular:tslint",
|
||||
"options": {
|
||||
"tsConfig": [
|
||||
"src/tsconfig.app.json",
|
||||
"src/tsconfig.spec.json"
|
||||
],
|
||||
"exclude": [
|
||||
"**/node_modules/**"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"frontend-e2e": {
|
||||
"root": "",
|
||||
"sourceRoot": "",
|
||||
"projectType": "application",
|
||||
"architect": {
|
||||
"e2e": {
|
||||
"builder": "@angular-devkit/build-angular:protractor",
|
||||
"options": {
|
||||
"protractorConfig": "./protractor.conf.js",
|
||||
"devServerTarget": "frontend:serve"
|
||||
}
|
||||
},
|
||||
"lint": {
|
||||
"builder": "@angular-devkit/build-angular:tslint",
|
||||
"options": {
|
||||
"tsConfig": [
|
||||
"e2e/tsconfig.e2e.json"
|
||||
],
|
||||
"exclude": [
|
||||
"**/node_modules/**"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"defaultProject": "frontend",
|
||||
"schematics": {
|
||||
"@schematics/angular:component": {
|
||||
"prefix": "app",
|
||||
"styleext": "scss"
|
||||
},
|
||||
"@schematics/angular:directive": {
|
||||
"prefix": "app"
|
||||
}
|
||||
}
|
||||
}
|
@ -4,19 +4,19 @@
|
||||
module.exports = function (config) {
|
||||
config.set({
|
||||
basePath: '',
|
||||
frameworks: ['jasmine', '@angular/cli'],
|
||||
frameworks: ['jasmine', '@angular-devkit/build-angular'],
|
||||
plugins: [
|
||||
require('karma-jasmine'),
|
||||
require('karma-chrome-launcher'),
|
||||
require('karma-jasmine-html-reporter'),
|
||||
require('karma-coverage-istanbul-reporter'),
|
||||
require('@angular/cli/plugins/karma')
|
||||
require('@angular-devkit/build-angular/plugins/karma')
|
||||
],
|
||||
client:{
|
||||
clearContext: false // leave Jasmine Spec Runner output visible in browser
|
||||
},
|
||||
coverageIstanbulReporter: {
|
||||
reports: [ 'html', 'lcovonly' ],
|
||||
dir: require('path').join(__dirname, 'coverage'), reports: [ 'html', 'lcovonly' ],
|
||||
fixWebpackSourcePaths: true
|
||||
},
|
||||
angularCli: {
|
||||
|
11409
frontend/prebuild/package-lock.json
generated
11409
frontend/prebuild/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -13,48 +13,49 @@
|
||||
},
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@angular/animations": "^5.2.10",
|
||||
"@angular/cli": "^1.7.4",
|
||||
"@angular/common": "^5.2.10",
|
||||
"@angular/compiler": "^5.2.10",
|
||||
"@angular/core": "^5.2.10",
|
||||
"@angular/forms": "^5.2.10",
|
||||
"@angular/http": "^5.2.10",
|
||||
"@angular/platform-browser": "^5.2.10",
|
||||
"@angular/platform-browser-dynamic": "^5.2.10",
|
||||
"@angular/router": "^5.2.10",
|
||||
"@ng-bootstrap/ng-bootstrap": "^1.1.2",
|
||||
"@types/createjs": "0.0.29",
|
||||
"angular-in-memory-web-api": "^0.5.4",
|
||||
"@angular/animations": "^6.0.2",
|
||||
"@angular/common": "^6.0.2",
|
||||
"@angular/compiler": "^6.0.2",
|
||||
"@angular/core": "^6.0.2",
|
||||
"@angular/forms": "^6.0.2",
|
||||
"@angular/http": "^6.0.2",
|
||||
"@angular/platform-browser": "^6.0.2",
|
||||
"@angular/platform-browser-dynamic": "^6.0.2",
|
||||
"@angular/router": "^6.0.2",
|
||||
"@ng-bootstrap/ng-bootstrap": "^2.0.0",
|
||||
"angular-in-memory-web-api": "^0.6.0",
|
||||
"autoprefixer": "^7.2.6",
|
||||
"bootstrap": "^4.1.0",
|
||||
"core-js": "^2.5.5",
|
||||
"createjs": "^1.0.1",
|
||||
"core-js": "^2.5.6",
|
||||
"createjs-module": "^0.8.3",
|
||||
"node-sass": "^4.8.3",
|
||||
"npm": "^5.8.0",
|
||||
"rxjs": "^5.5.10",
|
||||
"ng-event-source": "^1.0.10",
|
||||
"node-sass": "^4.9.0",
|
||||
"npm": "^5.10.0",
|
||||
"rxjs": "^6.1.0",
|
||||
"rxjs-compat": "^6.1.0",
|
||||
"web-animations-js": "^2.3.1",
|
||||
"zone.js": "^0.8.26"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@angular/compiler-cli": "^5.2.10",
|
||||
"@angular/language-service": "^5.2.10",
|
||||
"@types/jasmine": "~2.8.3",
|
||||
"@angular-devkit/build-angular": "^0.6.1",
|
||||
"@angular/cli": "^6.0.1",
|
||||
"@angular/compiler-cli": "^6.0.2",
|
||||
"@angular/language-service": "^6.0.2",
|
||||
"@types/jasmine": "^2.8.7",
|
||||
"@types/jasminewd2": "~2.0.2",
|
||||
"@types/node": "^6.0.106",
|
||||
"codelyzer": "^4.2.1",
|
||||
"@types/node": "^6.0.110",
|
||||
"codelyzer": "^4.3.0",
|
||||
"jasmine-core": "~2.8.0",
|
||||
"jasmine-spec-reporter": "~4.2.1",
|
||||
"karma": "~2.0.0",
|
||||
"karma": "^2.0.2",
|
||||
"karma-chrome-launcher": "~2.2.0",
|
||||
"karma-cli": "~1.0.1",
|
||||
"karma-coverage-istanbul-reporter": "^1.4.2",
|
||||
"karma-jasmine": "~1.1.0",
|
||||
"karma-jasmine": "^1.1.2",
|
||||
"karma-jasmine-html-reporter": "^0.2.2",
|
||||
"protractor": "~5.1.2",
|
||||
"ts-node": "~3.2.0",
|
||||
"tslint": "~5.9.1",
|
||||
"typescript": "~2.5.3"
|
||||
"typescript": ">=2.7.2 <2.8.0"
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ import { GameService } from '../game/game.service';
|
||||
import { Triangle } from '../geom/triangle';
|
||||
import { Point } from '../geom/point';
|
||||
import { LoginComponent } from '../login/login.component';
|
||||
import * as EventSource from 'eventsource';
|
||||
import { EventSourcePolyfill } from 'ng-event-source';
|
||||
import { environment } from './../../environments/environment';
|
||||
|
||||
@Component({
|
||||
@ -33,7 +33,7 @@ export class ControlsComponent implements OnInit, OnDestroy {
|
||||
leftPressed: boolean;
|
||||
downPressed: boolean;
|
||||
rightPressed: boolean;
|
||||
|
||||
|
||||
currentDirection: string;
|
||||
|
||||
private preventScrolling = (evt: TouchEvent) => {
|
||||
@ -152,7 +152,7 @@ export class ControlsComponent implements OnInit, OnDestroy {
|
||||
|
||||
window.requestAnimationFrame(() => this.draw());
|
||||
}
|
||||
|
||||
|
||||
processRequeue(newRoundId) {
|
||||
console.log(`Requeueing to round ${newRoundId}`);
|
||||
this.roundId = newRoundId;
|
||||
@ -354,7 +354,7 @@ export class ControlsComponent implements OnInit, OnDestroy {
|
||||
let nextRoundID: any = await this.http.get(`${environment.API_URL_GAME_ROUND}/${roundId}/requeue?isPlayer=true`, { responseType: 'text' }).toPromise();
|
||||
this.processRequeue(nextRoundID);
|
||||
} else {
|
||||
let queueCallback = new EventSource(`${environment.API_URL_PARTY}/${partyId}/queue`);
|
||||
let queueCallback = new EventSourcePolyfill(`${environment.API_URL_PARTY}/${partyId}/queue`);
|
||||
queueCallback.onmessage = msg => {
|
||||
let queueMsg = JSON.parse(msg.data);
|
||||
if (queueMsg.queuePosition) {
|
||||
@ -384,7 +384,7 @@ export class ControlsComponent implements OnInit, OnDestroy {
|
||||
this.gameService.send({ direction: `${newDir}` });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
verifyOpen() {
|
||||
if (!this.gameService.isOpen()) {
|
||||
console.log('GameService socket not open');
|
||||
|
@ -4,7 +4,7 @@ import { HttpClient, HttpHeaders } from '@angular/common/http';
|
||||
import { Meta } from '@angular/platform-browser';
|
||||
import { GameService } from './game.service';
|
||||
import { LoginComponent } from '../login/login.component';
|
||||
import * as EventSource from 'eventsource';
|
||||
import { EventSourcePolyfill } from 'ng-event-source';
|
||||
import { environment } from './../../environments/environment';
|
||||
import { Player } from '../entity/player';
|
||||
import { Obstacle } from '../entity/obstacle';
|
||||
@ -259,10 +259,10 @@ export class GameComponent implements OnInit, OnDestroy {
|
||||
this.processRequeue(nextRoundID);
|
||||
}, 5000);
|
||||
} else {
|
||||
this.processRequeue(nextRoundID);
|
||||
this.processRequeue(nextRoundID);
|
||||
}
|
||||
} else {
|
||||
let queueCallback = new EventSource(`${environment.API_URL_PARTY}/${partyId}/queue`);
|
||||
let queueCallback = new EventSourcePolyfill(`${environment.API_URL_PARTY}/${partyId}/queue`);
|
||||
queueCallback.onmessage = msg => {
|
||||
let queueMsg = JSON.parse(msg.data);
|
||||
if (queueMsg.queuePosition) {
|
||||
@ -315,7 +315,7 @@ export class GameComponent implements OnInit, OnDestroy {
|
||||
this.showLoader = false;
|
||||
}, (1000 * seconds));
|
||||
}
|
||||
|
||||
|
||||
verifyOpen() {
|
||||
if (!this.gameService.isOpen()) {
|
||||
console.log('GameService socket not open');
|
||||
|
@ -1,8 +1,8 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { SocketService } from '../net/socket.service';
|
||||
import { Subject } from 'rxjs/Subject';
|
||||
import { Subject } from 'rxjs';
|
||||
import { environment } from './../../environments/environment';
|
||||
import 'rxjs/add/operator/map';
|
||||
import { map } from 'rxjs/operators';
|
||||
|
||||
|
||||
|
||||
@ -18,20 +18,20 @@ export class GameService {
|
||||
|
||||
socketService.url = `${environment.API_URL_GAME_WS}/${this.roundId}`;
|
||||
this.messages = <Subject<Object>>socketService.socket
|
||||
.map((response: MessageEvent): any => {
|
||||
.pipe(map((response: MessageEvent): any => {
|
||||
//console.log(`Game service handling message: ${response.data}`);
|
||||
return JSON.parse(response.data);
|
||||
});
|
||||
}));
|
||||
}
|
||||
|
||||
public send(message: any) {
|
||||
this.messages.next(JSON.stringify(message));
|
||||
}
|
||||
|
||||
|
||||
public isOpen() {
|
||||
return this.socketService.socketOpen;
|
||||
}
|
||||
|
||||
|
||||
public close() {
|
||||
this.socketService.close();
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Subject } from 'rxjs/Subject';
|
||||
import { Subject } from 'rxjs';
|
||||
import { SocketService } from '../../net/socket.service';
|
||||
import { map } from 'rxjs/operators';
|
||||
|
||||
|
||||
@Injectable()
|
||||
@ -10,10 +11,10 @@ export class PlayersService {
|
||||
constructor(socketService: SocketService) {
|
||||
|
||||
this.messages = <Subject<Object>>socketService.socket
|
||||
.map((response: MessageEvent): any => {
|
||||
.pipe(map((response: MessageEvent): any => {
|
||||
//console.log(`Players service handling message: ${response.data}`);
|
||||
return JSON.parse(response.data);
|
||||
});
|
||||
}));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ import { Meta } from '@angular/platform-browser';
|
||||
import { Router, ActivatedRoute } from '@angular/router';
|
||||
import { HttpClient, HttpHeaders } from '@angular/common/http';
|
||||
import { Observable } from 'rxjs';
|
||||
import * as EventSource from 'eventsource';
|
||||
import { EventSourcePolyfill } from 'ng-event-source';
|
||||
import { trigger, animate, style, transition, group, query, stagger, state } from '@angular/animations';
|
||||
import { environment } from './../../environments/environment';
|
||||
import { PaneType } from '../slider/slider.component';
|
||||
@ -20,7 +20,7 @@ export class LoginComponent implements OnInit, OnDestroy {
|
||||
party: string;
|
||||
queuePosition: number;
|
||||
player = new Player();
|
||||
static queueCallback: EventSource;
|
||||
static queueCallback: EventSourcePolyfill;
|
||||
isFullDevice: boolean = !/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
|
||||
|
||||
constructor(
|
||||
@ -183,7 +183,7 @@ export class LoginComponent implements OnInit, OnDestroy {
|
||||
console.log(`enering queue for party ${this.party}`);
|
||||
if (LoginComponent.queueCallback)
|
||||
LoginComponent.queueCallback.close();
|
||||
LoginComponent.queueCallback = new EventSource(`${environment.API_URL_PARTY}/${this.party}/queue`);
|
||||
LoginComponent.queueCallback = new EventSourcePolyfill(`${environment.API_URL_PARTY}/${this.party}/queue`);
|
||||
this.setQueueOnMessage();
|
||||
LoginComponent.queueCallback.onerror = msg => {
|
||||
console.log('Error showing queue position: ' + JSON.stringify(msg.data));
|
||||
|
@ -1,9 +1,8 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Subject } from 'rxjs/Subject';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import { Observer } from 'rxjs/Observer';
|
||||
import { Subject, Observable, Observer } from 'rxjs';
|
||||
import 'rxjs/add/operator/share';
|
||||
|
||||
|
||||
@Injectable()
|
||||
export class SocketService {
|
||||
|
||||
|
@ -11,7 +11,8 @@
|
||||
]
|
||||
},
|
||||
"files": [
|
||||
"test.ts"
|
||||
"test.ts",
|
||||
"polyfills.ts"
|
||||
],
|
||||
"include": [
|
||||
"**/*.spec.ts",
|
||||
|
@ -17,8 +17,7 @@
|
||||
"eofline": true,
|
||||
"forin": true,
|
||||
"import-blacklist": [
|
||||
true,
|
||||
"rxjs",
|
||||
false,
|
||||
"rxjs/Rx"
|
||||
],
|
||||
"import-spacing": true,
|
||||
|
Loading…
Reference in New Issue
Block a user