From 68dbfff0b06d5971c7195c4a075240b01ee6f90c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5kon=20L=C3=B8vdal?= Date: Sun, 21 Jun 2020 14:11:31 +0200 Subject: [PATCH 1/4] docs(DevelopmentWorkflow.md): update quick-setup link --- DevelopmentWorkflow.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DevelopmentWorkflow.md b/DevelopmentWorkflow.md index b24fcbfb8..5df7f425b 100644 --- a/DevelopmentWorkflow.md +++ b/DevelopmentWorkflow.md @@ -20,7 +20,7 @@ Install your native toolchain and NativeScript as described in the docs: -https://docs.nativescript.org/setup/quick-setup +https://docs.nativescript.org/angular/start/quick-setup ### Clone repository From 8c85f02ebce79b8bf93718e11936ba192afc4466 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5kon=20L=C3=B8vdal?= Date: Sun, 21 Jun 2020 18:15:34 +0200 Subject: [PATCH 2/4] test: remove reprecated/removed tslint rules --- nativescript-angular/tslint.json | 4 ---- 1 file changed, 4 deletions(-) diff --git a/nativescript-angular/tslint.json b/nativescript-angular/tslint.json index 161f8e9d4..6b9fe8b83 100644 --- a/nativescript-angular/tslint.json +++ b/nativescript-angular/tslint.json @@ -5,12 +5,9 @@ "rules":{ "directive-selector": [true, "attribute", "ns", "camelCase"], "component-selector": [true, "element", "", "camelCase"], - "use-input-property-decorator": true, - "use-output-property-decorator": true, "no-input-rename": true, "no-output-rename": true, "use-pipe-transform-interface": true, - "pipe-naming": [true, "camelCase", "ns"], "component-class-suffix": true, "directive-class-suffix": true, "member-access": false, @@ -60,7 +57,6 @@ "no-string-literal": false, "no-switch-case-fall-through": true, "no-unused-expression": true, - "no-unused-variable": true, "no-var-keyword": true, "radix": false, "switch-default": true, From 1f343d8dfd865fe3076fce9bd42b6c057223ba29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5kon=20L=C3=B8vdal?= Date: Sun, 21 Jun 2020 18:31:34 +0200 Subject: [PATCH 3/4] style: fix indentation in platform-common.ts --- nativescript-angular/platform-common.ts | 130 ++++++++++++------------ 1 file changed, 65 insertions(+), 65 deletions(-) diff --git a/nativescript-angular/platform-common.ts b/nativescript-angular/platform-common.ts index bcd329721..a0783faf4 100644 --- a/nativescript-angular/platform-common.ts +++ b/nativescript-angular/platform-common.ts @@ -76,8 +76,8 @@ export interface HmrOptions { // tslint:enable:max-line-length export interface AppLaunchView extends View { - startAnimation?: () => void; - cleanup?: () => void; + startAnimation?: () => void; + cleanup?: () => void; } export interface AppOptions { @@ -209,50 +209,50 @@ export class NativeScriptPlatformRef extends PlatformRef { } if (this.appOptions && this.appOptions.launchView) { - launchView = this.appOptions.launchView; - if (this.appOptions.launchView.startAnimation) { - setTimeout(() => { - // ensure launch animation is executed after launchView added to view stack - this.appOptions.launchView.startAnimation(); - }); - } + launchView = this.appOptions.launchView; + if (this.appOptions.launchView.startAnimation) { + setTimeout(() => { + // ensure launch animation is executed after launchView added to view stack + this.appOptions.launchView.startAnimation(); + }); + } } else { - launchView = new GridLayout(); - // Custom launch view color (useful when doing async app intializers where you don't want a flash of undesirable color) - launchView.backgroundColor = new Color(this.appOptions && this.appOptions.backgroundColor ? this.appOptions.backgroundColor : '#fff'); + launchView = new GridLayout(); + // Custom launch view color (useful when doing async app intializers where you don't want a flash of undesirable color) + launchView.backgroundColor = new Color(this.appOptions && this.appOptions.backgroundColor ? this.appOptions.backgroundColor : '#fff'); } args.root = launchView; setRootPage(launchView); // Launch Angular app this._bootstrapper().then( - moduleRef => { - - if (isLogEnabled()) { - bootstrapLog(`Angular bootstrap bootstrap done. uptime: ${uptime()}`); - } - - rootContent = launchView; - if (launchView && launchView.cleanup) { - // cleanup any custom launch views - launchView.cleanup(); - } - - lastBootstrappedModule = new WeakRef(moduleRef); - }, - err => { - - const errorMessage = err.message + "\n\n" + err.stack; - if (isLogEnabled()) { - bootstrapLogError("ERROR BOOTSTRAPPING ANGULAR"); - } - if (isLogEnabled()) { - bootstrapLogError(errorMessage); - } - - rootContent = this.createErrorUI(errorMessage); - } - ); + moduleRef => { + + if (isLogEnabled()) { + bootstrapLog(`Angular bootstrap bootstrap done. uptime: ${uptime()}`); + } + + rootContent = launchView; + if (launchView && launchView.cleanup) { + // cleanup any custom launch views + launchView.cleanup(); + } + + lastBootstrappedModule = new WeakRef(moduleRef); + }, + err => { + + const errorMessage = err.message + "\n\n" + err.stack; + if (isLogEnabled()) { + bootstrapLogError("ERROR BOOTSTRAPPING ANGULAR"); + } + if (isLogEnabled()) { + bootstrapLogError(errorMessage); + } + + rootContent = this.createErrorUI(errorMessage); + } + ); } ); const exitCallback = profile( @@ -293,32 +293,32 @@ export class NativeScriptPlatformRef extends PlatformRef { } this._bootstrapper().then( - moduleRef => { - if (isLogEnabled()) { - bootstrapLog("Angular livesync done."); - } - onAfterLivesync.next({ moduleRef }); - - lastBootstrappedModule = new WeakRef(moduleRef); - applicationRerun({ - create: () => getRootPage(), - }); - }, - error => { - if (isLogEnabled()) { - bootstrapLogError("ERROR LIVESYNC BOOTSTRAPPING ANGULAR"); - } - const errorMessage = error.message + "\n\n" + error.stack; - if (isLogEnabled()) { - bootstrapLogError(errorMessage); - } - - applicationRerun({ - create: () => this.createErrorUI(errorMessage), - }); - onAfterLivesync.next({ error }); - } - ); + moduleRef => { + if (isLogEnabled()) { + bootstrapLog("Angular livesync done."); + } + onAfterLivesync.next({ moduleRef }); + + lastBootstrappedModule = new WeakRef(moduleRef); + applicationRerun({ + create: () => getRootPage(), + }); + }, + error => { + if (isLogEnabled()) { + bootstrapLogError("ERROR LIVESYNC BOOTSTRAPPING ANGULAR"); + } + const errorMessage = error.message + "\n\n" + error.stack; + if (isLogEnabled()) { + bootstrapLogError(errorMessage); + } + + applicationRerun({ + create: () => this.createErrorUI(errorMessage), + }); + onAfterLivesync.next({ error }); + } + ); } private createErrorUI(message: string): View { From 541300103b2b9b501ef4474464903ab443d14ebc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5kon=20L=C3=B8vdal?= Date: Sun, 21 Jun 2020 18:28:15 +0200 Subject: [PATCH 4/4] fix: fix tslint errors --- nativescript-angular/directives/templated-items-comp.ts | 2 ++ nativescript-angular/platform-common.ts | 8 +++++--- nativescript-angular/router/router.module.ts | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/nativescript-angular/directives/templated-items-comp.ts b/nativescript-angular/directives/templated-items-comp.ts index 373ebcad5..5113e559c 100644 --- a/nativescript-angular/directives/templated-items-comp.ts +++ b/nativescript-angular/directives/templated-items-comp.ts @@ -19,10 +19,12 @@ import { ViewContainerRef, ɵisListLikeIterable as isListLikeIterable } from "@angular/core"; +// tslint:disable: max-line-length // TODO: refactor core module imports to allow this to work properly // import { View, LayoutBase, KeyedTemplate, ItemEventData, TemplatedItemsView, ObservableArray } from "@nativescript/core"; // Ivy entry points get out of order and will cause issues like this: // node_modules/@nativescript/core/ui/html-view/html-view-common.js:26:0: JS ERROR TypeError: undefined is not an object (evaluating 'color_1.Color.equals') if not using deep imports like the following for the moment +// tslint:enable: max-line-length import { ItemEventData, TemplatedItemsView } from "@nativescript/core/ui/list-view"; import { View, KeyedTemplate } from "@nativescript/core/ui/core/view"; import { LayoutBase } from "@nativescript/core/ui/layouts/layout-base"; diff --git a/nativescript-angular/platform-common.ts b/nativescript-angular/platform-common.ts index a0783faf4..c8a0c2438 100644 --- a/nativescript-angular/platform-common.ts +++ b/nativescript-angular/platform-common.ts @@ -13,7 +13,7 @@ import "nativescript-intl"; import { TextView } from "@nativescript/core/ui/text-view"; import { Color, View } from "@nativescript/core/ui/core/view"; import { Frame } from "@nativescript/core/ui/frame"; -import { GridLayout } from '@nativescript/core/ui/layouts/grid-layout'; +import { GridLayout } from "@nativescript/core/ui/layouts/grid-layout"; import { Type, @@ -218,8 +218,10 @@ export class NativeScriptPlatformRef extends PlatformRef { } } else { launchView = new GridLayout(); - // Custom launch view color (useful when doing async app intializers where you don't want a flash of undesirable color) - launchView.backgroundColor = new Color(this.appOptions && this.appOptions.backgroundColor ? this.appOptions.backgroundColor : '#fff'); + // Custom launch view color (useful when doing async app intializers + // where you don't want a flash of undesirable color). + const bgCol = this.appOptions && this.appOptions.backgroundColor ? this.appOptions.backgroundColor : "#fff"; + launchView.backgroundColor = new Color(bgCol); } args.root = launchView; setRootPage(launchView); diff --git a/nativescript-angular/router/router.module.ts b/nativescript-angular/router/router.module.ts index 7d4b4a08f..ef11742cc 100644 --- a/nativescript-angular/router/router.module.ts +++ b/nativescript-angular/router/router.module.ts @@ -39,7 +39,7 @@ export class NativeScriptRouterModule { return { ngModule: NativeScriptRouterModule, providers: [ - ...RouterModule.forRoot(routes, config).providers, + ...RouterModule.forRoot(routes, config).providers, { provide: NSLocationStrategy, useFactory: provideLocationStrategy,