From 3ce67a408864728e095eaf698a346ec2c05b342e Mon Sep 17 00:00:00 2001 From: "Patrik J. Braun" Date: Tue, 22 May 2018 20:27:07 -0400 Subject: [PATCH] upgrading to angular 6 --- .angular-cli.json | 60 -------- angular.json | 132 ++++++++++++++++++ frontend/app/app.component.ts | 4 +- frontend/app/app.module.ts | 4 +- frontend/app/frame/frame.component.ts | 2 +- frontend/app/gallery/gallery.component.ts | 2 +- frontend/app/gallery/gallery.service.ts | 2 +- .../photo/photo.grid.gallery.component.html | 2 +- .../lightbox/lightbox.gallery.component.ts | 4 +- frontend/app/gallery/share.service.ts | 2 +- .../network/autehentication.service.spec.ts | 51 +++---- .../model/network/authentication.service.ts | 2 +- .../app/model/network/network.service.spec.ts | 2 - .../app/model/network/user.service.spec.ts | 43 +++--- frontend/app/model/notification.service.ts | 10 +- .../basic/basic.settings.component.ts | 6 - .../indexing/indexing.settings.component.ts | 3 +- .../indexing/indexing.settings.service.ts | 2 +- frontend/app/settings/settings.service.ts | 2 +- frontend/polyfills.ts | 2 +- gulpfile.js | 22 +-- karma.conf.js | 6 +- package.json | 64 +++++---- tslint.json | 1 - 24 files changed, 248 insertions(+), 182 deletions(-) delete mode 100644 .angular-cli.json create mode 100644 angular.json diff --git a/.angular-cli.json b/.angular-cli.json deleted file mode 100644 index 2d6f4b5..0000000 --- a/.angular-cli.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "$schema": "./node_modules/@angular/cli/lib/config/schema.json", - "project": { - "name": "pigallery2" - }, - "apps": [ - { - "root": "frontend", - "outDir": "dist", - "assets": [ - "assets", - "config_inject.ejs" - ], - "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/ng2-toastr/bundles/ng2-toastr.min.css", - "../node_modules/bootstrap/dist/css/bootstrap.css", - "../node_modules/open-iconic/font/css/open-iconic-bootstrap.css", - "styles.css" - ], - "scripts": [], - "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" - }, - { - "project": "src/tsconfig.spec.json" - }, - { - "project": "test/e2e/tsconfig.e2e.json" - } - ], - "test": { - "karma": { - "config": "./karma.conf.js" - } - }, - "defaults": { - "styleExt": "css", - "component": {} - } -} diff --git a/angular.json b/angular.json new file mode 100644 index 0000000..2558d27 --- /dev/null +++ b/angular.json @@ -0,0 +1,132 @@ +{ + "$schema": "./node_modules/@angular/cli/lib/config/schema.json", + "version": 1, + "newProjectRoot": "projects", + "projects": { + "pigallery2": { + "root": "", + "sourceRoot": "frontend", + "projectType": "application", + "architect": { + "build": { + "builder": "@angular-devkit/build-angular:browser", + "options": { + "outputPath": "dist", + "index": "frontend/index.html", + "main": "frontend/main.ts", + "tsConfig": "frontend/tsconfig.app.json", + "polyfills": "frontend/polyfills.ts", + "assets": [ + "frontend/assets" + ], + "styles": [ + "node_modules/ngx-toastr/toastr.css", + "node_modules/bootstrap/dist/css/bootstrap.css", + "node_modules/open-iconic/font/css/open-iconic-bootstrap.css", + "frontend/styles.css" + ], + "scripts": [] + }, + "configurations": { + "production": { + "optimization": true, + "outputHashing": "all", + "sourceMap": false, + "extractCss": true, + "namedChunks": false, + "aot": true, + "extractLicenses": true, + "vendorChunk": false, + "buildOptimizer": true, + "fileReplacements": [ + { + "replace": "frontend/environments/environment.ts", + "with": "frontend/environments/environment.prod.ts" + } + ] + } + } + }, + "serve": { + "builder": "@angular-devkit/build-angular:dev-server", + "options": { + "browserTarget": "pigallery2:build" + }, + "configurations": { + "production": { + "browserTarget": "pigallery2:build:production" + } + } + }, + "extract-i18n": { + "builder": "@angular-devkit/build-angular:extract-i18n", + "options": { + "browserTarget": "pigallery2:build" + } + }, + "test": { + "builder": "@angular-devkit/build-angular:karma", + "options": { + "main": "frontend/test.ts", + "karmaConfig": "./karma.conf.js", + "polyfills": "frontend/polyfills.ts", + "tsConfig": "frontend/tsconfig.spec.json", + "scripts": [], + "styles": [ + "node_modules/ng2-toastr/bundles/ng2-toastr.min.css", + "node_modules/bootstrap/dist/css/bootstrap.css", + "node_modules/open-iconic/font/css/open-iconic-bootstrap.css", + "frontend/styles.css" + ], + "assets": [ + "frontend/assets" + ] + } + }, + "lint": { + "builder": "@angular-devkit/build-angular:tslint", + "options": { + "tsConfig": [ + "src/tsconfig.app.json", + "src/tsconfig.spec.json" + ], + "exclude": [] + } + } + } + }, + "pigallery2-e2e": { + "root": "", + "sourceRoot": "", + "projectType": "application", + "architect": { + "e2e": { + "builder": "@angular-devkit/build-angular:protractor", + "options": { + "protractorConfig": "./protractor.conf.js", + "devServerTarget": "pigallery2:serve" + } + }, + "lint": { + "builder": "@angular-devkit/build-angular:tslint", + "options": { + "tsConfig": [ + "test/e2e/tsconfig.e2e.json" + ], + "exclude": [] + } + } + } + } + }, + "defaultProject": "pigallery2", + "schematics": { + "@schematics/angular:component": { + "prefix": "app", + "styleext": "css" + }, + "@schematics/angular:directive": { + "prefix": "app" + } + } +} diff --git a/frontend/app/app.component.ts b/frontend/app/app.component.ts index 396bee5..0a6dfd0 100644 --- a/frontend/app/app.component.ts +++ b/frontend/app/app.component.ts @@ -20,9 +20,7 @@ export class AppComponent implements OnInit, OnDestroy { constructor(private _router: Router, private _authenticationService: AuthenticationService, private _shareService: ShareService, - private _title: Title, vcr: ViewContainerRef, - notificationService: NotificationService) { - notificationService.setRootViewContainerRef(vcr); + private _title: Title) { } async ngOnInit() { diff --git a/frontend/app/app.module.ts b/frontend/app/app.module.ts index 8d17716..5744168 100644 --- a/frontend/app/app.module.ts +++ b/frontend/app/app.module.ts @@ -44,7 +44,7 @@ import {ShareLoginComponent} from './sharelogin/share-login.component'; import {ShareService} from './gallery/share.service'; import {ModalModule} from 'ngx-bootstrap/modal'; import {DatabaseSettingsComponent} from './settings/database/database.settings.component'; -import {ToastModule} from 'ng2-toastr/ng2-toastr'; +import {ToastrModule} from 'ngx-toastr'; import {BrowserAnimationsModule} from '@angular/platform-browser/animations'; import {NotificationService} from './model/notification.service'; import {JWBootstrapSwitchModule} from 'jw-bootstrap-switch-ng2'; @@ -116,7 +116,7 @@ export function translationsFactory(locale: string) { ClipboardModule, JWBootstrapSwitchModule, TooltipModule.forRoot(), - ToastModule.forRoot(), + ToastrModule.forRoot(), ModalModule.forRoot(), CollapseModule.forRoot(), BsDropdownModule.forRoot(), diff --git a/frontend/app/frame/frame.component.ts b/frontend/app/frame/frame.component.ts index 77b37cb..29a0633 100644 --- a/frontend/app/frame/frame.component.ts +++ b/frontend/app/frame/frame.component.ts @@ -3,7 +3,7 @@ import {RouterLink} from '@angular/router'; import {AuthenticationService} from '../model/network/authentication.service'; import {UserDTO, UserRoles} from '../../../common/entities/UserDTO'; import {Config} from '../../../common/config/public/Config'; -import {BehaviorSubject} from 'rxjs/BehaviorSubject'; +import {BehaviorSubject} from 'rxjs'; import {NotificationService} from '../model/notification.service'; import {ShareService} from '../gallery/share.service'; diff --git a/frontend/app/gallery/gallery.component.ts b/frontend/app/gallery/gallery.component.ts index ca558e0..d379c17 100644 --- a/frontend/app/gallery/gallery.component.ts +++ b/frontend/app/gallery/gallery.component.ts @@ -11,7 +11,7 @@ import {SearchResultDTO} from '../../../common/entities/SearchResultDTO'; import {ShareService} from './share.service'; import {NavigationService} from '../model/navigation.service'; import {UserRoles} from '../../../common/entities/UserDTO'; -import {interval} from 'rxjs/observable/interval'; +import {interval} from 'rxjs'; import {ContentWrapper} from '../../../common/entities/ConentWrapper'; import {PageHelper} from '../model/page.helper'; diff --git a/frontend/app/gallery/gallery.service.ts b/frontend/app/gallery/gallery.service.ts index 4220dce..8127b28 100644 --- a/frontend/app/gallery/gallery.service.ts +++ b/frontend/app/gallery/gallery.service.ts @@ -4,7 +4,7 @@ import {ContentWrapper} from '../../../common/entities/ConentWrapper'; import {DirectoryDTO} from '../../../common/entities/DirectoryDTO'; import {SearchTypes} from '../../../common/entities/AutoCompleteItem'; import {GalleryCacheService} from './cache.gallery.service'; -import {BehaviorSubject} from 'rxjs/BehaviorSubject'; +import {BehaviorSubject} from 'rxjs'; import {SharingDTO} from '../../../common/entities/SharingDTO'; import {Config} from '../../../common/config/public/Config'; import {ShareService} from './share.service'; diff --git a/frontend/app/gallery/grid/photo/photo.grid.gallery.component.html b/frontend/app/gallery/grid/photo/photo.grid.gallery.component.html index e63f393..49d6cf4 100644 --- a/frontend/app/gallery/grid/photo/photo.grid.gallery.component.html +++ b/frontend/app/gallery/grid/photo/photo.grid.gallery.component.html @@ -31,7 +31,7 @@ #{{keyword}} #{{keyword}} - , + , diff --git a/frontend/app/gallery/lightbox/lightbox.gallery.component.ts b/frontend/app/gallery/lightbox/lightbox.gallery.component.ts index d34e164..102e308 100644 --- a/frontend/app/gallery/lightbox/lightbox.gallery.component.ts +++ b/frontend/app/gallery/lightbox/lightbox.gallery.component.ts @@ -15,11 +15,9 @@ import {GalleryPhotoComponent} from '../grid/photo/photo.grid.gallery.component' import {Dimension} from '../../model/IRenderable'; import {FullScreenService} from '../fullscreen.service'; import {OverlayService} from '../overlay.service'; -import {Subscription} from 'rxjs/Subscription'; import {animate, AnimationBuilder, AnimationPlayer, style} from '@angular/animations'; import {GalleryLightboxPhotoComponent} from './photo/photo.lightbox.gallery.component'; -import {Observable} from 'rxjs/Observable'; -import {timer} from 'rxjs/observable/timer'; +import {Observable, Subscription, timer} from 'rxjs'; import {filter} from 'rxjs/operators'; @Component({ diff --git a/frontend/app/gallery/share.service.ts b/frontend/app/gallery/share.service.ts index 1350b7a..3256b03 100644 --- a/frontend/app/gallery/share.service.ts +++ b/frontend/app/gallery/share.service.ts @@ -2,7 +2,7 @@ import {Injectable} from '@angular/core'; import {NetworkService} from '../model/network/network.service'; import {CreateSharingDTO, SharingDTO} from '../../../common/entities/SharingDTO'; import {Router, RoutesRecognized} from '@angular/router'; -import {BehaviorSubject} from 'rxjs/BehaviorSubject'; +import {BehaviorSubject} from 'rxjs'; @Injectable() export class ShareService { diff --git a/frontend/app/model/network/autehentication.service.spec.ts b/frontend/app/model/network/autehentication.service.spec.ts index e0ad245..bc18d98 100644 --- a/frontend/app/model/network/autehentication.service.spec.ts +++ b/frontend/app/model/network/autehentication.service.spec.ts @@ -1,7 +1,6 @@ import {inject, TestBed} from '@angular/core/testing'; import {UserService} from './user.service'; import {UserDTO} from '../../../../common/entities/UserDTO'; -import 'rxjs/Rx'; import {LoginCredential} from '../../../../common/entities/LoginCredential'; import {AuthenticationService} from './authentication.service'; import {NetworkService} from './network.service'; @@ -34,33 +33,35 @@ describe('AuthenticationService', () => { }); - it('should call UserDTO service login', inject([AuthenticationService, UserService], (authService, userService) => { - spyOn(userService, 'login').and.callThrough(); + it('should call UserDTO service login', inject([AuthenticationService, UserService], + async (authService, userService) => { + spyOn(userService, 'login').and.callThrough(); - expect(userService.login).not.toHaveBeenCalled(); - authService.login(); - expect(userService.login).toHaveBeenCalled(); - })); + expect(userService.login).not.toHaveBeenCalled(); + await authService.login(); + expect(userService.login).toHaveBeenCalled(); + })); - it('should have NO Authenticated use', inject([AuthenticationService], (authService: AuthenticationService) => { - expect(authService.user.value).toBe(null); - expect(authService.isAuthenticated()).toBe(false); - })); + it('should have NO Authenticated use', inject([AuthenticationService], + (authService: AuthenticationService) => { + expect(authService.user.value).toBe(null); + expect(authService.isAuthenticated()).toBe(false); + })); - it('should have Authenticated use', inject([AuthenticationService], (authService: AuthenticationService) => { - spyOn(authService.user, 'next').and.callThrough(); - authService.user.subscribe((user) => { - if (user == null) { - return; - } - expect(authService.user.next).toHaveBeenCalled(); - expect(authService.user.value).not.toBe(null); - expect(authService.isAuthenticated()).toBe(true); - }); - authService.login({}); - - })); - + it('should have Authenticated use', (done) => inject([AuthenticationService], + (authService: AuthenticationService) => { + spyOn(authService.user, 'next').and.callThrough(); + authService.user.subscribe((user) => { + if (user == null) { + return; + } + expect(authService.user.next).toHaveBeenCalled(); + expect(authService.user.value).not.toBe(null); + expect(authService.isAuthenticated()).toBe(true); + done(); + }); + authService.login({}); + })()); }); diff --git a/frontend/app/model/network/authentication.service.ts b/frontend/app/model/network/authentication.service.ts index 1c85fc2..262d93e 100644 --- a/frontend/app/model/network/authentication.service.ts +++ b/frontend/app/model/network/authentication.service.ts @@ -1,6 +1,6 @@ import {Injectable} from '@angular/core'; import {UserDTO, UserRoles} from '../../../../common/entities/UserDTO'; -import {BehaviorSubject} from 'rxjs/BehaviorSubject'; +import {BehaviorSubject} from 'rxjs'; import {UserService} from './user.service'; import {LoginCredential} from '../../../../common/entities/LoginCredential'; import {Cookie} from 'ng2-cookies'; diff --git a/frontend/app/model/network/network.service.spec.ts b/frontend/app/model/network/network.service.spec.ts index b3fda95..71cf9b6 100644 --- a/frontend/app/model/network/network.service.spec.ts +++ b/frontend/app/model/network/network.service.spec.ts @@ -1,6 +1,5 @@ import {getTestBed, inject, TestBed} from '@angular/core/testing'; import {HttpClientTestingModule, HttpTestingController} from '@angular/common/http/testing'; -import 'rxjs/Rx'; import {NetworkService} from './network.service'; import {Message} from '../../../../common/entities/Message'; import {SlimLoadingBarService} from 'ng2-slim-loading-bar'; @@ -143,7 +142,6 @@ describe('NetworkService Fail tests', () => { httpMock.verify(); }); - it('should call GET with error', inject([NetworkService], (networkService) => { networkService.getJson(testUrl).then((res: any) => { diff --git a/frontend/app/model/network/user.service.spec.ts b/frontend/app/model/network/user.service.spec.ts index 3baf7b5..864b510 100644 --- a/frontend/app/model/network/user.service.spec.ts +++ b/frontend/app/model/network/user.service.spec.ts @@ -1,44 +1,53 @@ import {inject, TestBed} from '@angular/core/testing'; -import {BaseRequestOptions, Http} from '@angular/http'; -import {MockBackend} from '@angular/http/testing'; -import 'rxjs/Rx'; +import {HttpClientTestingModule} from '@angular/common/http/testing'; import {NetworkService} from './network.service'; import {UserService} from './user.service'; import {LoginCredential} from '../../../../common/entities/LoginCredential'; +import {SlimLoadingBarService} from 'ng2-slim-loading-bar'; +import {ShareService} from '../../gallery/share.service'; +class MockShareService { + wait() { + return Promise.resolve(true); + } + + isSharing() { + return false; + } +} describe('UserService', () => { + beforeEach(() => { TestBed.configureTestingModule({ + imports: [HttpClientTestingModule], providers: [ - MockBackend, - BaseRequestOptions, - { - provide: Http, useFactory: (backend, options) => { - return new Http(backend, options); - }, deps: [MockBackend, BaseRequestOptions] - }, + UserService, + SlimLoadingBarService, NetworkService, - UserService] + {provide: ShareService, useClass: MockShareService} + ] }); + }); - - it('should call postJson at login', inject([UserService, NetworkService], (userService, networkService) => { + it('should call postJson at login', inject([UserService, NetworkService], + async (userService, networkService) => { spyOn(networkService, 'postJson'); const credential = new LoginCredential('name', 'pass'); - userService.login(credential); + await userService.login(credential); expect(networkService.postJson).toHaveBeenCalled(); expect(networkService.postJson.calls.argsFor(0)).toEqual(['/user/login', {'loginCredential': credential}]); })); - it('should call getJson at getSessionUser', inject([UserService, NetworkService], (userService, networkService) => { + it('should call getJson at getSessionUser', inject([UserService, NetworkService], + async (userService, networkService) => { spyOn(networkService, 'getJson'); - userService.getSessionUser(); + await userService.getSessionUser(); expect(networkService.getJson).toHaveBeenCalled(); expect(networkService.getJson.calls.argsFor(0)).toEqual(['/user/login']); })); - }); }); + diff --git a/frontend/app/model/notification.service.ts b/frontend/app/model/notification.service.ts index 6a05e30..d8e667a 100644 --- a/frontend/app/model/notification.service.ts +++ b/frontend/app/model/notification.service.ts @@ -1,5 +1,5 @@ import {Injectable, ViewContainerRef} from '@angular/core'; -import {ToastsManager} from 'ng2-toastr/ng2-toastr'; +import {ToastrService} from 'ngx-toastr'; import {NetworkService} from './network/network.service'; import {AuthenticationService} from './network/authentication.service'; import {NotificationDTO, NotificationType} from '../../../common/entities/NotificationDTO'; @@ -16,7 +16,7 @@ export class NotificationService { notifications: NotificationDTO[] = []; lastUser: UserDTO = null; - constructor(private _toastr: ToastsManager, + constructor(private _toastr: ToastrService, private _networkService: NetworkService, private _authService: AuthenticationService, public i18n: I18n) { @@ -53,10 +53,6 @@ export class NotificationService { }); } - setRootViewContainerRef(vcr: ViewContainerRef) { - this._toastr.setRootViewContainerRef(vcr); - } - success(text, title = null) { this._toastr.success(text, title, this.options); } @@ -74,7 +70,7 @@ export class NotificationService { } - get Toastr(): ToastsManager { + get Toastr(): ToastrService { return this._toastr; } } diff --git a/frontend/app/settings/basic/basic.settings.component.ts b/frontend/app/settings/basic/basic.settings.component.ts index 215100e..7c68810 100644 --- a/frontend/app/settings/basic/basic.settings.component.ts +++ b/frontend/app/settings/basic/basic.settings.component.ts @@ -44,12 +44,6 @@ export class BasicSettingsComponent extends SettingsComponent { } calcBaseUrl(): string { - console.log(this.settings.publicUrl.replace(new RegExp('\\\\', 'g'), '/')); - console.log(this.settings.publicUrl.replace(new RegExp('\\\\', 'g'), '/') - .replace(new RegExp('http://', 'g'), '')); - console.log(this.settings.publicUrl.replace(new RegExp('\\\\', 'g'), '/') - .replace(new RegExp('http://', 'g'), '') - .replace(new RegExp('https://', 'g'), '')); const url = this.settings.publicUrl.replace(new RegExp('\\\\', 'g'), '/') .replace(new RegExp('http://', 'g'), '') .replace(new RegExp('https://', 'g'), ''); diff --git a/frontend/app/settings/indexing/indexing.settings.component.ts b/frontend/app/settings/indexing/indexing.settings.component.ts index cd08551..42a5cf5 100644 --- a/frontend/app/settings/indexing/indexing.settings.component.ts +++ b/frontend/app/settings/indexing/indexing.settings.component.ts @@ -4,8 +4,7 @@ import {AuthenticationService} from '../../model/network/authentication.service' import {NavigationService} from '../../model/navigation.service'; import {NotificationService} from '../../model/notification.service'; import {ErrorDTO} from '../../../../common/entities/Error'; -import {Observable} from 'rxjs/Observable'; -import {interval} from 'rxjs/observable/interval'; +import {Observable, interval} from 'rxjs'; import {IndexingConfig, ReIndexingSensitivity} from '../../../../common/config/private/IPrivateConfig'; import {SettingsComponent} from '../_abstract/abstract.settings.component'; import {Utils} from '../../../../common/Utils'; diff --git a/frontend/app/settings/indexing/indexing.settings.service.ts b/frontend/app/settings/indexing/indexing.settings.service.ts index 2acba10..3ad04d8 100644 --- a/frontend/app/settings/indexing/indexing.settings.service.ts +++ b/frontend/app/settings/indexing/indexing.settings.service.ts @@ -4,7 +4,7 @@ import {SettingsService} from '../settings.service'; import {AbstractSettingsService} from '../_abstract/abstract.settings.service'; import {DatabaseType, IndexingConfig} from '../../../../common/config/private/IPrivateConfig'; import {IndexingProgressDTO} from '../../../../common/entities/settings/IndexingProgressDTO'; -import {BehaviorSubject} from 'rxjs/BehaviorSubject'; +import {BehaviorSubject} from 'rxjs'; @Injectable() export class IndexingSettingsService extends AbstractSettingsService { diff --git a/frontend/app/settings/settings.service.ts b/frontend/app/settings/settings.service.ts index cc3d3bb..95da788 100644 --- a/frontend/app/settings/settings.service.ts +++ b/frontend/app/settings/settings.service.ts @@ -1,5 +1,5 @@ import {Injectable} from '@angular/core'; -import {BehaviorSubject} from 'rxjs/BehaviorSubject'; +import {BehaviorSubject} from 'rxjs'; import {DatabaseType, IPrivateConfig, ReIndexingSensitivity, ThumbnailProcessingLib} from '../../../common/config/private/IPrivateConfig'; import {NetworkService} from '../model/network/network.service'; diff --git a/frontend/polyfills.ts b/frontend/polyfills.ts index 82e3345..b550f42 100644 --- a/frontend/polyfills.ts +++ b/frontend/polyfills.ts @@ -51,7 +51,7 @@ import 'zone.js/dist/zone'; // Included with Angular CLI. * Date, currency, decimal and percent pipes. * Needed for: All but Chrome, Firefox, Edge, IE11 and Safari 10 */ -import 'intl'; // Run `npm install --save intl`. +// import 'intl'; // Run `npm install --save intl`. /** * Need to import at least one locale-data with intl. */ diff --git a/gulpfile.js b/gulpfile.js index 3e07b84..0d86f34 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -33,16 +33,16 @@ gulp.task('build-frontend', function (done) { }); var tasks = []; createFrontendTask('build-frontend-release default', - "ng build --aot -prod --output-path=./release/dist --no-progress --locale=en" + + "ng build --aot --prod --output-path=./release/dist --no-progress --i18n-locale=en" + " --i18n-format xlf --i18n-file frontend/" + translationFolder + "/messages.en.xlf" + - " --missing-translation warning"); + " --i18n-missing-translation warning"); tasks.push('build-frontend-release default'); for (var i = 0; i < languages.length; i++) { createFrontendTask('build-frontend-release ' + languages[i], - "ng build --aot -prod --output-path=./release/dist/" + languages[i] + - " --no-progress --locale=" + languages[i] + + "ng build --aot --prod --output-path=./release/dist/" + languages[i] + + " --no-progress --i18n-locale=" + languages[i] + " --i18n-format xlf --i18n-file frontend/" + translationFolder + "/messages." + languages[i] + ".xlf" + - " --missing-translation warning"); + " --i18n-missing-translation warning"); tasks.push('build-frontend-release ' + languages[i]); } tasks.push(function () { @@ -108,14 +108,14 @@ var simpleBuild = function (isProd) { var tasks = []; var cmd = "ng build --aot "; if (isProd) { - cmd += " -prod " + cmd += " --prod " } - createFrontendTask('build-frontend default', cmd + "--output-path=./dist --no-progress --no-progress --locale en" + - " --i18n-format=xlf --i18n-file=frontend/" + translationFolder + "/messages.en.xlf" + " --missing-translation warning"); + createFrontendTask('build-frontend default', cmd + "--output-path=./dist --no-progress --no-progress --i18n-locale en" + + " --i18n-format=xlf --i18n-file=frontend/" + translationFolder + "/messages.en.xlf" + " --i18n-missing-translation warning"); tasks.push('build-frontend default'); for (var i = 0; i < languages.length; i++) { - createFrontendTask('build-frontend ' + languages[i], cmd + "--output-path=./dist/" + languages[i] + " --no-progress --locale " + languages[i] + - " --i18n-format=xlf --i18n-file=frontend/" + translationFolder + "/messages." + languages[i] + ".xlf" + " --missing-translation warning"); + createFrontendTask('build-frontend ' + languages[i], cmd + "--output-path=./dist/" + languages[i] + " --no-progress --i18n-locale " + languages[i] + + " --i18n-format=xlf --i18n-file=frontend/" + translationFolder + "/messages." + languages[i] + ".xlf" + " --i18n-missing-translation warning"); tasks.push('build-frontend ' + languages[i]); } tasks.push(function () { @@ -128,7 +128,7 @@ var simpleBuild = function (isProd) { gulp.task("extract-locale", function (cb) { console.log("creating source translation file: locale.source.xlf"); - exec('ng xi18n -of ./../locale.source.xlf -f xlf --locale en', function (err, stdout, stderr) { + exec('ng xi18n -of ./../locale.source.xlf -f xlf --i18n-locale en', function (err, stdout, stderr) { console.log(stdout); console.log(stderr); if (err) { diff --git a/karma.conf.js b/karma.conf.js index 8933009..3d24a27 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -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: { diff --git a/package.json b/package.json index dcfaf97..b2f50e1 100644 --- a/package.json +++ b/package.json @@ -29,10 +29,10 @@ }, "dependencies": { "bcryptjs": "2.4.3", - "body-parser": "1.18.2", + "body-parser": "1.18.3", "cookie-parser": "^1.4.3", "cookie-session": "2.0.0-beta.3", - "ejs": "2.5.9", + "ejs": "2.6.1", "express": "4.16.3", "jimp": "0.2.28", "locale": "0.1.0", @@ -42,37 +42,38 @@ "ts-exif-parser": "0.1.23", "ts-node-iptc": "1.0.9", "typeconfig": "1.0.6", - "typeorm": "0.2.5", + "typeorm": "0.2.6", "winston": "2.4.2" }, "devDependencies": { "@agm/core": "1.0.0-beta.2", - "@angular/animations": "5.2.10", - "@angular/cli": "1.7.4", - "@angular/common": "5.2.10", - "@angular/compiler": "5.2.10", - "@angular/compiler-cli": "5.2.10", - "@angular/core": "5.2.10", - "@angular/forms": "5.2.10", - "@angular/http": "5.2.10", - "@angular/language-service": "^5.2.10", - "@angular/platform-browser": "5.2.10", - "@angular/platform-browser-dynamic": "5.2.10", - "@angular/router": "5.2.10", + "@angular-devkit/build-angular": "~0.6.3", + "@angular/animations": "6.0.2", + "@angular/cli": "6.0.3", + "@angular/common": "6.0.2", + "@angular/compiler": "6.0.2", + "@angular/compiler-cli": "6.0.2", + "@angular/core": "6.0.2", + "@angular/forms": "6.0.2", + "@angular/http": "6.0.2", + "@angular/language-service": "^6.0.2", + "@angular/platform-browser": "6.0.2", + "@angular/platform-browser-dynamic": "6.0.2", + "@angular/router": "6.0.2", "@ngx-translate/i18n-polyfill": "0.1.3", "@types/bcryptjs": "2.4.1", "@types/chai": "4.1.3", "@types/cookie-session": "2.0.34", "@types/express": "4.11.1", - "@types/gm": "1.17.33", - "@types/jasmine": "2.8.6", - "@types/node": "10.0.3", + "@types/gm": "1.18.0", + "@types/jasmine": "2.8.7", + "@types/node": "10.1.2", "@types/sharp": "0.17.8", "@types/winston": "2.3.9", "bootstrap": "4.1.1", "chai": "4.1.2", "codelyzer": "4.3.0", - "core-js": "2.5.5", + "core-js": "2.5.6", "ejs-loader": "0.3.1", "gulp": "3.9.1", "gulp-json-modify": "1.0.2", @@ -86,28 +87,29 @@ "karma": "2.0.2", "karma-chrome-launcher": "2.2.0", "karma-cli": "1.0.1", - "karma-coverage-istanbul-reporter": "1.4.2", + "karma-coverage-istanbul-reporter": "2.0.0", "karma-jasmine": "1.1.2", - "karma-jasmine-html-reporter": "1.0.0", + "karma-jasmine-html-reporter": "1.1.0", "karma-remap-istanbul": "0.6.0", "karma-systemjs": "0.16.0", - "merge2": "1.2.1", - "mocha": "5.1.1", + "merge2": "1.2.2", + "mocha": "5.2.0", "ng2-cookies": "1.0.12", "ng2-slim-loading-bar": "4.0.0", - "ng2-toastr": "4.1.2", - "ngx-bootstrap": "2.0.4", - "ngx-clipboard": "10.0.0", + "ngx-bootstrap": "3.0.0", + "ngx-clipboard": "11.1.0", + "ngx-toastr": "^8.7.3", "open-iconic": "1.1.1", - "protractor": "5.3.1", + "protractor": "5.3.2", "remap-istanbul": "0.11.1", "rimraf": "2.6.2", "run-sequence": "2.2.1", - "rxjs": "5.5.8", + "rxjs": "6.1.0", + "rxjs-compat": "^6.1.0", "ts-helpers": "1.1.2", - "ts-node": "6.0.2", - "tslint": "5.9.1", - "typescript": "2.8.3", + "ts-node": "6.0.3", + "tslint": "5.10.0", + "typescript": "2.7.2", "xlf-google-translate": "1.0.0-beta.8", "zone.js": "0.8.26" }, diff --git a/tslint.json b/tslint.json index f4cc662..8d09d70 100644 --- a/tslint.json +++ b/tslint.json @@ -18,7 +18,6 @@ "forin": true, "import-blacklist": [ true, - "rxjs", "rxjs/Rx" ], "import-spacing": true,