From 4f8bd47ae2c01b919e20f020aa9a387d31efe97c Mon Sep 17 00:00:00 2001 From: "BLACKBAUD\\Trevor.Burch" Date: Tue, 25 Jun 2019 12:19:00 -0400 Subject: [PATCH 1/3] Upgrade library to run Sky 3 locally --- .nvmrc | 2 +- package.json | 59 +++++++++++++++++-- skyuxconfig.json | 6 ++ .../modules/flyout/flyout.component.spec.ts | 7 ++- .../public/modules/flyout/flyout.component.ts | 10 ++-- .../public/modules/flyout/flyout.module.ts | 5 ++ .../modules/flyout/flyout.service.spec.ts | 6 +- tsconfig.json | 2 +- tslint.json | 2 +- 9 files changed, 81 insertions(+), 18 deletions(-) diff --git a/.nvmrc b/.nvmrc index 0312896..c68ea6f 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -lts/dubnium +lts/dubnium \ No newline at end of file diff --git a/package.json b/package.json index e519717..213452e 100644 --- a/package.json +++ b/package.json @@ -28,14 +28,61 @@ "@angular/core": ">=4.3.6", "@angular/forms": ">=4.3.6", "@angular/router": ">=4.3.6", - "@skyux/core": "^3.5.1", - "@skyux/i18n": "^3.5.0", - "@skyux/indicators": "^3.0.0" + "@skyux-sdk/builder": "^3.7.0", + "@skyux/core": "^3.6.0", + "@skyux/flyout": "^3.2.0", + "@skyux/i18n": "^3.6.1", + "@skyux/indicators": "^3.0.3", + "@skyux/lists": "^3.3.0", + "@skyux/modals": "^3.0.4", + "@skyux/popovers": "^3.1.1", + "@skyux/router": "^3.1.1", + "@skyux/toast": "^3.0.4" }, "dependencies": {}, "devDependencies": { - "@blackbaud/skyux": "2.49.1", - "@blackbaud/skyux-builder": "1.34.1", - "@skyux-sdk/builder-plugin-skyux": "1.0.0" + "@angular/animations": "7.2.15", + "@angular/common": "7.2.15", + "@angular/compiler": "7.2.15", + "@angular/compiler-cli": "7.2.15", + "@angular/core": "7.2.15", + "@angular/forms": "7.2.15", + "@angular/http": "7.2.15", + "@angular/platform-browser": "7.2.15", + "@angular/platform-browser-dynamic": "7.2.15", + "@angular/router": "7.2.15", + "@blackbaud/auth-client": "2.15.1", + "@pact-foundation/pact": "7.4.0", + "@pact-foundation/pact-web": "7.4.0", + "@skyux-sdk/builder": "3.7.0", + "@skyux-sdk/builder-plugin-skyux": "1.0.0", + "@skyux-sdk/e2e": "3.1.2", + "@skyux-sdk/pact": "3.2.1", + "@skyux-sdk/testing": "3.1.0", + "@skyux/animations": "3.0.0", + "@skyux/assets": "3.0.0", + "@skyux/config": "3.5.0", + "@skyux/core": "3.6.0", + "@skyux/flyout": "3.2.0", + "@skyux/forms": "3.2.0", + "@skyux/http": "3.4.1", + "@skyux/i18n": "3.6.1", + "@skyux/indicators": "3.0.3", + "@skyux/inline-form": "3.0.0", + "@skyux/lists": "3.3.0", + "@skyux/modals": "3.0.4", + "@skyux/omnibar-interop": "3.1.0", + "@skyux/popovers": "3.1.1", + "@skyux/router": "3.1.1", + "@skyux/theme": "3.7.0", + "@skyux/toast": "3.0.4", + "@types/core-js": "2.5.2", + "codelyzer": "4.5.0", + "rxjs": "6.5.2", + "rxjs-compat": "6.5.2", + "ts-node": "8.3.0", + "tslint": "5.18.0", + "typescript": "3.2.4", + "zone.js": "0.8.28" } } diff --git a/skyuxconfig.json b/skyuxconfig.json index 0d29e20..3bcf5e4 100644 --- a/skyuxconfig.json +++ b/skyuxconfig.json @@ -1,4 +1,5 @@ { + "$schema": "./node_modules/@skyux/config/skyuxconfig-schema.json", "name": "skyux-flyout", "mode": "easy", "compileMode": "aot", @@ -15,5 +16,10 @@ "unit": { "browserSet": "paranoid" } + }, + "app": { + "styles": [ + "@skyux/theme/css/sky.css" + ] } } diff --git a/src/app/public/modules/flyout/flyout.component.spec.ts b/src/app/public/modules/flyout/flyout.component.spec.ts index e1be84a..5d4c092 100644 --- a/src/app/public/modules/flyout/flyout.component.spec.ts +++ b/src/app/public/modules/flyout/flyout.component.spec.ts @@ -20,7 +20,8 @@ import { } from '@skyux-sdk/testing'; import { - Observable + Observable, + throwError } from 'rxjs'; import { @@ -511,7 +512,7 @@ describe('Flyout component', () => { it('should have the sky-flyout-help-shim class if the help widget is present', fakeAsync(() => { - spyOn(window.document, 'getElementById').and.returnValue({}); + spyOn(window.document, 'getElementById').and.returnValue({} as HTMLElement); openFlyout({}); const headerElement = getFlyoutHeaderElement(); expect(headerElement.classList.contains('sky-flyout-help-shim')).toBeTruthy(); @@ -564,7 +565,7 @@ describe('Flyout component', () => { fixture.detectChanges(); tick(); spyOn(SkyUIConfigService.prototype, 'setConfig') - .and.returnValue(Observable.throw({ message: 'Test error' })); + .and.returnValue(throwError({ message: 'Test error' })); resizeFlyout(1000, 1100); diff --git a/src/app/public/modules/flyout/flyout.component.ts b/src/app/public/modules/flyout/flyout.component.ts index 52d19ab..9a55ac6 100644 --- a/src/app/public/modules/flyout/flyout.component.ts +++ b/src/app/public/modules/flyout/flyout.component.ts @@ -8,7 +8,6 @@ import { Injector, OnDestroy, OnInit, - ReflectiveInjector, Type, ViewChild, ViewContainerRef @@ -31,6 +30,7 @@ import { Subject } from 'rxjs/Subject'; +import 'rxjs/add/observable/merge'; import 'rxjs/add/operator/takeUntil'; import { @@ -220,9 +220,11 @@ export class SkyFlyoutComponent implements OnDestroy, OnInit { this.config.iteratorPreviousButtonDisabled = this.config.iteratorPreviousButtonDisabled || false; const factory = this.resolver.resolveComponentFactory(component); - const providers = ReflectiveInjector.resolve(this.config.providers); - const injector = ReflectiveInjector.fromResolvedProviders(providers, this.injector); - const componentRef = this.target.createComponent(factory, undefined, injector); + const hostInjector = Injector.create({ + providers: this.config.providers, + parent: this.injector + }); + const componentRef = this.target.createComponent(factory, undefined, hostInjector); this.flyoutInstance = this.createFlyoutInstance(componentRef.instance); diff --git a/src/app/public/modules/flyout/flyout.module.ts b/src/app/public/modules/flyout/flyout.module.ts index 2511557..6de7d2b 100644 --- a/src/app/public/modules/flyout/flyout.module.ts +++ b/src/app/public/modules/flyout/flyout.module.ts @@ -10,6 +10,10 @@ import { FormsModule } from '@angular/forms'; +import { + BrowserAnimationsModule +} from '@angular/platform-browser/animations'; + import { RouterModule } from '@angular/router'; @@ -60,6 +64,7 @@ import { SkyWindowRefService ], imports: [ + BrowserAnimationsModule, CommonModule, FormsModule, RouterModule, diff --git a/src/app/public/modules/flyout/flyout.service.spec.ts b/src/app/public/modules/flyout/flyout.service.spec.ts index 2165bf1..ce2ff40 100644 --- a/src/app/public/modules/flyout/flyout.service.spec.ts +++ b/src/app/public/modules/flyout/flyout.service.spec.ts @@ -95,8 +95,9 @@ describe('Flyout service', () => { ); it('should expose a method to remove the flyout from the DOM', () => { - spyOn(window, 'setTimeout').and.callFake((fun: Function) => { + spyOn(window, 'setTimeout').and.callFake((fun: any) => { fun(); + return 0; }); service.open(SkyFlyoutHostsTestComponent); applicationRef.tick(); @@ -110,8 +111,9 @@ describe('Flyout service', () => { ); it('should dispose of any open host if the service is destroyed', () => { - spyOn(window, 'setTimeout').and.callFake((fun: Function) => { + spyOn(window, 'setTimeout').and.callFake((fun: any) => { fun(); + return 0; }); service.open(SkyFlyoutHostsTestComponent); applicationRef.tick(); diff --git a/tsconfig.json b/tsconfig.json index bf4fc47..18f8fcd 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,5 +1,5 @@ { - "extends": "./node_modules/@blackbaud/skyux-builder/tsconfig", + "extends": "./node_modules/@skyux-sdk/builder/tsconfig", "compilerOptions": { "module": "commonjs" }, diff --git a/tslint.json b/tslint.json index 141cb48..6481847 100644 --- a/tslint.json +++ b/tslint.json @@ -1,3 +1,3 @@ { - "extends": "@blackbaud/skyux-builder/tslint" + "extends": "@skyux-sdk/builder/tslint" } From 40c0e4fe924785b1336e6dff176bca783c028da3 Mon Sep 17 00:00:00 2001 From: "BLACKBAUD\\Trevor.Burch" Date: Tue, 25 Jun 2019 13:06:47 -0400 Subject: [PATCH 2/3] Fixed Angular 4 compatibility issues --- .../modules/flyout/flyout.component.spec.ts | 13 ++++++++++--- .../public/modules/flyout/flyout.component.ts | 17 ++++++++++++----- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/src/app/public/modules/flyout/flyout.component.spec.ts b/src/app/public/modules/flyout/flyout.component.spec.ts index 5d4c092..a86aab4 100644 --- a/src/app/public/modules/flyout/flyout.component.spec.ts +++ b/src/app/public/modules/flyout/flyout.component.spec.ts @@ -20,10 +20,11 @@ import { } from '@skyux-sdk/testing'; import { - Observable, - throwError + Observable } from 'rxjs'; +import 'rxjs/add/observable/throw'; + import { SkyFlyoutConfig } from './types'; @@ -564,8 +565,14 @@ describe('Flyout component', () => { openFlyout({ defaultWidth: 500, settingsKey: 'testKey' }); fixture.detectChanges(); tick(); + + /* tslint:disable:deprecation */ + /** + * NOTE: We need to update this to use the new throwError Observable creation function + */ spyOn(SkyUIConfigService.prototype, 'setConfig') - .and.returnValue(throwError({ message: 'Test error' })); + .and.returnValue(Observable.throw({ message: 'Test error' })); + /* tslint:enable:deprecation */ resizeFlyout(1000, 1100); diff --git a/src/app/public/modules/flyout/flyout.component.ts b/src/app/public/modules/flyout/flyout.component.ts index 9a55ac6..e54d956 100644 --- a/src/app/public/modules/flyout/flyout.component.ts +++ b/src/app/public/modules/flyout/flyout.component.ts @@ -8,6 +8,7 @@ import { Injector, OnDestroy, OnInit, + ReflectiveInjector, Type, ViewChild, ViewContainerRef @@ -220,11 +221,17 @@ export class SkyFlyoutComponent implements OnDestroy, OnInit { this.config.iteratorPreviousButtonDisabled = this.config.iteratorPreviousButtonDisabled || false; const factory = this.resolver.resolveComponentFactory(component); - const hostInjector = Injector.create({ - providers: this.config.providers, - parent: this.injector - }); - const componentRef = this.target.createComponent(factory, undefined, hostInjector); + + /* tslint:disable:deprecation */ + /** + * NOTE: We need to update this to use the new Injector.create(options) method + * after Angular 4 support is dropped. + */ + const providers = ReflectiveInjector.resolve(this.config.providers); + const injector = ReflectiveInjector.fromResolvedProviders(providers, this.injector); + /* tslint:enable:deprecation */ + + const componentRef = this.target.createComponent(factory, undefined, injector); this.flyoutInstance = this.createFlyoutInstance(componentRef.instance); From e2598dd56c41e6d5007b883e3da19ec416ab3955 Mon Sep 17 00:00:00 2001 From: "BLACKBAUD\\Trevor.Burch" Date: Tue, 25 Jun 2019 13:28:45 -0400 Subject: [PATCH 3/3] Fixed peer dependencies --- package.json | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/package.json b/package.json index 213452e..5431eda 100644 --- a/package.json +++ b/package.json @@ -28,16 +28,9 @@ "@angular/core": ">=4.3.6", "@angular/forms": ">=4.3.6", "@angular/router": ">=4.3.6", - "@skyux-sdk/builder": "^3.7.0", - "@skyux/core": "^3.6.0", - "@skyux/flyout": "^3.2.0", - "@skyux/i18n": "^3.6.1", - "@skyux/indicators": "^3.0.3", - "@skyux/lists": "^3.3.0", - "@skyux/modals": "^3.0.4", - "@skyux/popovers": "^3.1.1", - "@skyux/router": "^3.1.1", - "@skyux/toast": "^3.0.4" + "@skyux/core": "^3.5.1", + "@skyux/i18n": "^3.5.0", + "@skyux/indicators": "^3.0.0" }, "dependencies": {}, "devDependencies": {