Skip to content

Commit 3fd74e7

Browse files
authored
Merge pull request #834 from sliceofbytes/update-angular
Update to Angular 8 and fix build scripts
2 parents cf7de7c + 8e435eb commit 3fd74e7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+858
-846
lines changed

.gitignore

+5
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,8 @@ Thumbs.db
3333

3434
# Folder config file
3535
Desktop.ini
36+
.angulardoc.json
37+
38+
39+
# VS Code
40+
.vscode

core.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ export * from './src/core/core';
33
// CustomEvent polyfill for IE9/10/11
44
(function () {
55

6-
if ( typeof window === "undefined" || typeof window['CustomEvent'] === "function" ) return false;
6+
if ( typeof window === "undefined" || typeof window['CustomEvent'] === "function" ) { return false; }
77

88
function CustomEvent ( event, params ) {
99
params = params || { bubbles: false, cancelable: false, detail: undefined };
10-
var evt = document.createEvent( 'CustomEvent' );
10+
let evt = document.createEvent( 'CustomEvent' );
1111
evt.initCustomEvent( event, params.bubbles, params.cancelable, params.detail );
1212
return evt;
1313
}

karma-test-shim.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ function isSpecFile(path) {
1717
}
1818

1919
function isBuiltFile(path) {
20-
var builtPath = '/base/src/';
20+
var builtPath = '/base/compiled/';
2121
return isJsFile(path) && (path.substr(0, builtPath.length) == builtPath);
2222
}
2323

@@ -41,7 +41,6 @@ System.config(
4141
'@angular/compiler': 'npm:@angular/compiler/bundles/compiler.umd.js',
4242
'@angular/platform-browser': 'npm:@angular/platform-browser/bundles/platform-browser.umd.js',
4343
'@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js',
44-
'@angular/http': 'npm:@angular/http/bundles/http.umd.js',
4544
'@angular/router': 'npm:@angular/router/bundles/router.umd.js',
4645
'@angular/forms': 'npm:@angular/forms/bundles/forms.umd.js',
4746

@@ -51,11 +50,10 @@ System.config(
5150
'@angular/compiler/testing': 'npm:@angular/compiler/bundles/compiler-testing.umd.js',
5251
'@angular/platform-browser/testing': 'npm:@angular/platform-browser/bundles/platform-browser-testing.umd.js',
5352
'@angular/platform-browser-dynamic/testing': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic-testing.umd.js',
54-
'@angular/http/testing': 'npm:@angular/http/bundles/http-testing.umd.js',
5553
'@angular/router/testing': 'npm:@angular/router/bundles/router-testing.umd.js',
5654
'@angular/forms/testing': 'npm:@angular/forms/bundles/forms-testing.umd.js',
5755

58-
'app': 'base/src'
56+
'app': 'base/compiled/src'
5957
},
6058
packages: {
6159
'rxjs/operators': { defaultExtension: 'js', main: 'index' },

karma.conf.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@ module.exports = function(config) {
2626

2727
{pattern: 'karma-test-shim.js', included: true, watched: true},
2828

29+
2930
// Our built application code
30-
{pattern: 'src/**/*.js', included: false, watched: true},
31+
{pattern: 'compiled/**/*.js', included: false, watched: true},
3132

3233
// paths loaded via Angular's component compiler
3334
// (these paths need to be rewritten, see proxies section)

package.json

+27-24
Original file line numberDiff line numberDiff line change
@@ -7,70 +7,73 @@
77
"url": "https://github.com/videogular/videogular2"
88
},
99
"peerDependencies": {
10-
"@angular/core": "^7.1.0",
10+
"@angular/core": "^8.0.0",
1111
"rxjs": "^6.3.0"
1212
},
1313
"devDependencies": {
14-
"@angular/animations": "^7.1.4",
15-
"@angular/common": "^7.1.4",
16-
"@angular/compiler": "^7.1.4",
17-
"@angular/compiler-cli": "^7.0.4",
18-
"@angular/core": "^7.1.4",
19-
"@angular/http": "^7.1.4",
20-
"@angular/platform-browser": "^7.1.4",
21-
"@angular/platform-browser-dynamic": "^7.1.4",
22-
"@angular/platform-server": "^7.1.4",
14+
"@angular/animations": "^8.0.0",
15+
"@angular/cli": "8.0.1",
16+
"@angular/common": "^8.0.0",
17+
"@angular/compiler": "^8.0.0",
18+
"@angular/compiler-cli": "^8.0.0",
19+
"@angular/core": "^8.0.0",
20+
"@angular/platform-browser": "^8.0.0",
21+
"@angular/platform-browser-dynamic": "^8.0.0",
22+
"@angular/platform-server": "^8.0.0",
2323
"@types/bluebird": "^3.5.25",
2424
"@types/core-js": "0.9.46",
2525
"@types/jasmine": "^3.3.1",
2626
"@types/node": "10.12.12",
27-
"codelyzer": "^4.5.0",
27+
"codelyzer": "5.1.0",
2828
"commitizen": "2.9.6",
2929
"core-js": "^2.6.0",
3030
"cz-conventional-changelog": "2.0.0",
3131
"es-module-loader": "2.3.0",
3232
"http-server": "0.11.1",
33-
"husky": "^1.3.0",
33+
"husky": "^2.4.0",
3434
"jasmine-core": "^3.3.0",
35-
"karma": "^3.1.3",
35+
"karma": "^4.1.0",
3636
"karma-chrome-launcher": "^2.2.0",
37-
"karma-firefox-launcher": "^1.1.0",
3837
"karma-coverage": "^1.1.2",
38+
"karma-firefox-launcher": "^1.1.0",
3939
"karma-jasmine": "^2.0.1",
4040
"karma-spec-reporter": "^0.0.32",
41-
"parallelshell": "2.0.0",
41+
"npm-run-all": "4.1.5",
4242
"reflect-metadata": "^0.1.10",
4343
"remap-istanbul": "0.9.5",
4444
"rimraf": "2.6.1",
45-
"rxjs": "^6.3.0",
45+
"rxjs": "6.5.2",
4646
"semantic-release": "6.3.2",
4747
"systemjs": "^0.20.19",
48-
"tslint": "^5.11.0",
49-
"typescript": "~3.1.1",
48+
"tslint": "5.17.0",
49+
"typescript": "~3.4.5",
5050
"validate-commit-msg": "2.12.1",
5151
"watch": "1.0.2",
52-
"zone.js": "^0.8.26"
52+
"zone.js": "0.9.1"
5353
},
5454
"scripts": {
55-
"commitmsg": "validate-commit-msg",
5655
"prebuild": "npm run clean",
5756
"build": "ngc",
5857
"postbuild": "npm test",
5958
"build:travis": "ngc",
6059
"postbuild:travis": "npm run test",
6160
"clean": "rimraf -rf ./src/**/*.js && rimraf -rf ./src/**/*.d.ts && rimraf -rf ./compiled",
62-
"precommit": "npm test",
6361
"commit": "git-cz",
6462
"coverage": "http-server -c-1 -o -s -p 9875 ./coverage",
65-
"start": "parallelshell \"npm run watch:ts\" \"npm run start:coverage-server\"",
63+
"start": "run-p \"watch:ts\" \"start:coverage-server\"",
6664
"start:coverage-server": "http-server -c-1 -o -p 9875 ./coverage",
6765
"test": "karma start karma.conf.js",
6866
"posttest": "remap-istanbul -i ./coverage/coverage-final.json -o coverage -t html",
6967
"report-coverage": "cat ./coverage/coverage-final.json | ./node_modules/.bin/remap-istanbul -o coverage-remapped.json",
7068
"semantic-release": "semantic-release pre && npm publish && semantic-release post",
7169
"watch:ts": "watch \"npm run build\" src",
72-
"parallelshell": "parallelshell",
73-
"lint": "tslint '**/*.ts' -e 'node_modules/**/*' -e 'compiled/**/**' --fix --noUnusedParameters --noUnusedLocals"
70+
"lint": "tslint -p tsconfig.json -c tslint.json --fix"
71+
},
72+
"husky": {
73+
"hooks": {
74+
"pre-commit": "npm test",
75+
"commit-msg": "validate-commit-msg"
76+
}
7477
},
7578
"engines": {
7679
"node": ">=10.9.0 <11.0.0"

src/buffering/vg-buffering.spec.ts

+36-38
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,45 @@
1-
import {VgBuffering} from "./vg-buffering";
2-
import {VgAPI} from "../core/services/vg-api";
3-
import {IPlayable} from "../core/vg-media/i-playable";
4-
import {ElementRef} from "@angular/core";
5-
import { VgStates } from "../core/states/vg-states";
1+
import { VgBuffering } from './vg-buffering';
2+
import { VgAPI } from '../core/services/vg-api';
3+
import { ElementRef } from '@angular/core';
64

75
describe('Buffering', () => {
8-
let vgBuffering:VgBuffering;
9-
let ref:ElementRef;
10-
let api:VgAPI;
6+
let vgBuffering: VgBuffering;
7+
let ref: ElementRef;
8+
let api: VgAPI;
119

12-
beforeEach(() => {
13-
ref = {
14-
nativeElement: {
15-
getAttribute: (name) => {
16-
return name;
17-
}
18-
}
19-
};
10+
beforeEach(() => {
11+
ref = {
12+
nativeElement: {
13+
getAttribute: (name) => {
14+
return name;
15+
}
16+
}
17+
};
2018

21-
api = new VgAPI();
22-
vgBuffering = new VgBuffering(ref, api);
23-
});
19+
api = new VgAPI();
20+
vgBuffering = new VgBuffering(ref, api);
21+
});
2422

25-
describe('onPlayerReady', ()=>{
26-
it('should subscribe to bufferDetected media events', ()=>{
27-
spyOn(api, 'getMediaById').and.returnValue({
28-
subscriptions: {
29-
bufferDetected: {subscribe: jasmine.createSpy('bufferDetected') }
30-
}
31-
});
32-
vgBuffering.onPlayerReady();
33-
expect(vgBuffering.target.subscriptions.bufferDetected.subscribe).toHaveBeenCalled();
34-
});
23+
describe('onPlayerReady', () => {
24+
it('should subscribe to bufferDetected media events', () => {
25+
spyOn(api, 'getMediaById').and.returnValue(<any>{
26+
subscriptions: {
27+
bufferDetected: { subscribe: jasmine.createSpy('bufferDetected') }
28+
}
29+
});
30+
vgBuffering.onPlayerReady();
31+
expect(vgBuffering.target.subscriptions.bufferDetected.subscribe).toHaveBeenCalled();
3532
});
33+
});
3634

37-
describe('isBuffering', ()=> {
38-
it('should show if buffer is detected', () => {
39-
vgBuffering.onUpdateBuffer(true);
40-
expect(vgBuffering.isBuffering).toBe(true);
41-
});
42-
it('should hide if buffer is not detected', () => {
43-
vgBuffering.onUpdateBuffer(false);
44-
expect(vgBuffering.isBuffering).toBe(false);
45-
});
35+
describe('isBuffering', () => {
36+
it('should show if buffer is detected', () => {
37+
vgBuffering.onUpdateBuffer(true);
38+
expect(vgBuffering.isBuffering).toBe(true);
39+
});
40+
it('should hide if buffer is not detected', () => {
41+
vgBuffering.onUpdateBuffer(false);
42+
expect(vgBuffering.isBuffering).toBe(false);
4643
});
44+
});
4745
});

src/buffering/vg-buffering.ts

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { Component, ElementRef, HostBinding, Input, OnDestroy, OnInit, ViewEncapsulation } from '@angular/core';
22
import { VgAPI } from '../core/services/vg-api';
33
import { IPlayable } from '../core/vg-media/i-playable';
4-
import { VgStates } from '../core/states/vg-states';
54
import { Subscription } from 'rxjs';
65

76
@Component({
@@ -106,13 +105,13 @@ export class VgBuffering implements OnInit, OnDestroy {
106105

107106
elem: HTMLElement;
108107
target: IPlayable;
109-
checkInterval: number = 50;
110-
currentPlayPos: number = 0;
111-
lastPlayPos: number = 0;
108+
checkInterval = 50;
109+
currentPlayPos = 0;
110+
lastPlayPos = 0;
112111

113112
subscriptions: Subscription[] = [];
114113

115-
@HostBinding('class.is-buffering') isBuffering: boolean = false;
114+
@HostBinding('class.is-buffering') isBuffering = false;
116115

117116
constructor(ref: ElementRef, public API: VgAPI) {
118117
this.elem = ref.nativeElement;

src/controls/vg-controls.ts

+7-9
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import {
2-
Component, Input, OnInit, ElementRef, HostBinding, AfterViewInit, ViewEncapsulation,
3-
EventEmitter, Output, OnDestroy
2+
Component, Input, OnInit, ElementRef, HostBinding, AfterViewInit, ViewEncapsulation, OnDestroy
43
} from '@angular/core';
54
import { Observable , Subscription } from 'rxjs';
65
import { VgAPI } from '../core/services/vg-api';
@@ -29,7 +28,7 @@ import {fromEvent} from 'rxjs';
2928
transition: bottom 1s;
3029
}
3130
32-
vg-controls.hide {
31+
vg-controls.hide {
3332
bottom: -50px;
3433
}
3534
`]
@@ -38,21 +37,20 @@ export class VgControls implements OnInit, AfterViewInit, OnDestroy {
3837
elem: HTMLElement;
3938
target: any;
4039

41-
@HostBinding('style.pointer-events') isAdsPlaying: string = 'initial';
42-
@HostBinding('class.hide') hideControls: boolean = false;
40+
@HostBinding('style.pointer-events') isAdsPlaying = 'initial';
41+
@HostBinding('class.hide') hideControls = false;
4342

4443
@Input() vgFor: string;
45-
@Input() vgAutohide: boolean = false;
46-
@Input() vgAutohideTime: number = 3;
44+
@Input() vgAutohide = false;
45+
@Input() vgAutohideTime = 3;
4746

4847
private timer: any;
49-
private hideTimer: any;
5048

5149
mouseMove$: Observable<any>;
5250
touchStart$: Observable<any>;
5351

5452
subscriptions: Subscription[] = [];
55-
53+
// @ts-ignore
5654
constructor(private API: VgAPI, private ref: ElementRef, private hidden: VgControlsHidden) {
5755
this.elem = ref.nativeElement;
5856
}

0 commit comments

Comments
 (0)