Skip to content

Commit

Permalink
feat(angular-migration): migrate to angular 10 (#841)
Browse files Browse the repository at this point in the history
* feat(gossip-menu-option): add preview in gossip menu option editor and npc-text-selector

* feat(gossip-menu-option-preview): add preview in the gossip menu option editor

* chore(gossip-menu): minor improvements

* chore(gossip-preview): minor improvements

* refactor(angular): prepare migrating to angular 10

* chore(angular-migration): prepare migration to angular 10

* chore(angular-migration): prepare migration to angular 10 WIP

* wip

* chore(angular-migration): angular 10 WIP

* chore(angular-migration): update highlight.js

* chore(angular-migration): update ngx-highlightjs

* fix(test): revert last 2 commits
  • Loading branch information
Helias committed Aug 20, 2020
1 parent cb05160 commit 1568e55
Show file tree
Hide file tree
Showing 35 changed files with 856 additions and 835 deletions.
2 changes: 1 addition & 1 deletion e2e/tsconfig.e2e.json
@@ -1,5 +1,5 @@
{
"extends": "../tsconfig.json",
"extends": "../tsconfig.base.json",
"compilerOptions": {
"outDir": "../out-tsc/e2e",
"module": "commonjs",
Expand Down
1,476 changes: 762 additions & 714 deletions package-lock.json

Large diffs are not rendered by default.

28 changes: 14 additions & 14 deletions package.json
Expand Up @@ -34,7 +34,7 @@
},
"dependencies": {
"mysql": "2.18.1",
"ngx-toastr": "12.1.0",
"ngx-toastr": "13.0.0",
"ngx-ui-switch": "10.0.2",
"serialize-javascript": "4.0.0",
"sqlite3": "5.0.0",
Expand All @@ -43,17 +43,17 @@
},
"devDependencies": {
"@angular-builders/custom-webpack": "10.0.0",
"@angular-devkit/build-angular": "0.901.11",
"@angular/animations": "9.1.12",
"@angular/cli": "9.1.11",
"@angular/common": "9.1.12",
"@angular/compiler": "9.1.12",
"@angular/compiler-cli": "9.1.12",
"@angular/core": "9.1.12",
"@angular/forms": "9.1.12",
"@angular/platform-browser": "9.1.12",
"@angular/platform-browser-dynamic": "9.1.12",
"@angular/router": "9.1.12",
"@angular-devkit/build-angular": "0.1000.6",
"@angular/animations": "10.0.11",
"@angular/cli": "10.0.6",
"@angular/common": "10.0.11",
"@angular/compiler": "10.0.11",
"@angular/compiler-cli": "10.0.11",
"@angular/core": "10.0.11",
"@angular/forms": "10.0.11",
"@angular/platform-browser": "10.0.11",
"@angular/platform-browser-dynamic": "10.0.11",
"@angular/router": "10.0.11",
"@fortawesome/fontawesome-free": "5.14.0",
"@swimlane/ngx-datatable": "17.1.0",
"@types/jasmine": "3.5.12",
Expand All @@ -65,7 +65,7 @@
"@types/sqlstring": "2.2.1",
"bootstrap": "4.5.2",
"chai": "4.2.0",
"codelyzer": "6.0.0",
"codelyzer": "^6.0.0",
"conventional-changelog-cli": "2.1.0",
"coveralls": "3.1.0",
"cross-env": "7.0.2",
Expand Down Expand Up @@ -94,7 +94,7 @@
"ts-mockito": "2.6.1",
"ts-node": "8.10.2",
"tslint": "6.1.3",
"typescript": "3.8.3",
"typescript": "3.9.7",
"wait-on": "5.2.0",
"webdriver-manager": "12.1.7",
"zone.js": "0.11.1"
Expand Down
6 changes: 4 additions & 2 deletions src/app/main/app.component.spec.ts
Expand Up @@ -67,7 +67,8 @@ describe('AppComponent', () => {
it('should correctly react on connectionLost$ [connection lost]', () => {
const { fixture, toastrService, connectionLostSubject } = setup();
fixture.detectChanges();
spyOnAllFunctions(toastrService);
spyOn(toastrService, 'success');
spyOn(toastrService, 'error');

connectionLostSubject.next(false);
connectionLostSubject.next(false);
Expand All @@ -81,7 +82,8 @@ describe('AppComponent', () => {
it('should correctly react on connectionLost$ [reconnected]', () => {
const { fixture, connectionLostSubject, toastrService } = setup();
fixture.detectChanges();
spyOnAllFunctions(toastrService);
spyOn(toastrService, 'success');
spyOn(toastrService, 'error');

connectionLostSubject.next(true);

Expand Down
Expand Up @@ -10,7 +10,6 @@ import { closeModalsAfterEach } from '@keira-testing/test-helpers';

@NgModule({
declarations: [ ModalConfirmComponent ],
entryComponents: [ ModalConfirmComponent ],
imports: [ ],
})
class TestModule {}
Expand Down
4 changes: 0 additions & 4 deletions src/app/main/main-window/sidebar/sidebar.module.ts
Expand Up @@ -7,17 +7,13 @@ import { TooltipModule } from 'ngx-bootstrap/tooltip';

import { SidebarComponent } from './sidebar.component';
import { LogoutBtnComponent } from './logout-btn/logout-btn.component';
import { ModalConfirmComponent } from '@keira-shared/modules/modal-confirm/modal-confirm.component';
import { ModalConfirmModule } from '@keira-shared/modules/modal-confirm/modal-confirm.module';
import { UnsavedIconComponent } from './unsaved-icon/unsaved-icon.component';
const DEFAULT_PERFECT_SCROLLBAR_CONFIG: PerfectScrollbarConfigInterface = {
suppressScrollX: true
};

@NgModule({
entryComponents: [
ModalConfirmComponent
],
declarations: [
SidebarComponent,
LogoutBtnComponent,
Expand Down
Expand Up @@ -2,7 +2,9 @@ import { EditorComponent } from './editor.component';
import { MockEntity } from '@keira-testing/mock-services';
import { EditorService } from '../../service/editors/editor.service';
import { HandlerService } from '../../service/handlers/handler.service';
import { Component } from '@angular/core';

@Component({})
class MockComponent extends EditorComponent<MockEntity> {}

describe('EditorComponent', () => {
Expand Down
@@ -1,11 +1,12 @@
import { OnInit } from '@angular/core';
import { OnInit, Component } from '@angular/core';

import { TableRow } from '@keira-types/general';
import { WIKI_BASE_URL } from '@keira-constants/general';
import { HandlerService } from '../../service/handlers/handler.service';
import { EditorService } from '../../service/editors/editor.service';
import { SubscriptionHandler } from '../../../utils/subscription-handler/subscription-handler';

@Component({ template: '' })
export abstract class EditorComponent<T extends TableRow> extends SubscriptionHandler implements OnInit {
public readonly WIKI_BASE_URL = WIKI_BASE_URL;
public get docUrl(): string {
Expand Down
@@ -1,4 +1,4 @@
import { OnInit } from '@angular/core';
import { OnInit, Component } from '@angular/core';
import { MysqlError } from 'mysql';

import { LootTemplate } from '@keira-types/loot-template.type';
Expand All @@ -7,6 +7,7 @@ import { LootEditorIdService } from '../../../service/editors/loot-editor-id.ser
import { LootTemplateComponent } from '@keira-abstract/components/editors/loot-template/loot-template.component';

// Extended only by the loot tables that require a template loot id
@Component({ template: '' })
export abstract class LootTemplateIdComponent<T extends LootTemplate> extends LootTemplateComponent<T> implements OnInit {

protected _lootId: number;
Expand Down
@@ -1,5 +1,7 @@
import { LootTemplate } from '@keira-types/loot-template.type';
import { MultiRowEditorComponent } from '../multi-row-editor.component';
import { Component } from '@angular/core';

/* istanbul ignore next */ // TODO: for some reason the next line gives coverage issues...
@Component({ template: '' })
export abstract class LootTemplateComponent<T extends LootTemplate> extends MultiRowEditorComponent<T> {}
Expand Up @@ -3,7 +3,9 @@ import { HandlerService } from '../../service/handlers/handler.service';
import { EditorComponent } from './editor.component';
import { MultiRowEditorService } from '../../service/editors/multi-row-editor.service';
import { DTCFG } from '@keira-config/datatable.config';
import { Component } from '@angular/core';

@Component({ template: '' })
export abstract class MultiRowEditorComponent<T extends TableRow> extends EditorComponent<T> {

public readonly DTCFG = DTCFG;
Expand Down
Expand Up @@ -2,7 +2,9 @@ import { TableRow } from '@keira-types/general';
import { SingleRowEditorService } from '../../service/editors/single-row-editor.service';
import { HandlerService } from '../../service/handlers/handler.service';
import { EditorComponent } from './editor.component';
import { Component } from '@angular/core';

@Component({ template: '' })
export abstract class SingleRowEditorComponent<T extends TableRow> extends EditorComponent<T> {

/* istanbul ignore next */ // because of: https://github.com/gotwarlost/istanbul/issues/690
Expand Down
Expand Up @@ -11,9 +11,6 @@ import { ModalModule } from 'ngx-bootstrap/modal';
import { SearchButtonsModule } from '@keira-shared/modules/search-button/search-buttons.module';

@NgModule({
entryComponents: [
AreaSelectorModalComponent,
],
declarations: [
AreaSelectorBtnComponent,
AreaSelectorModalComponent,
Expand Down
Expand Up @@ -18,7 +18,6 @@ import { closeModalsAfterEach } from '@keira-testing/test-helpers';

@NgModule({
declarations: [ ItemSelectorModalComponent ],
entryComponents: [ ItemSelectorModalComponent ],
imports: [
CommonModule,
BrowserModule,
Expand Down
Expand Up @@ -11,9 +11,6 @@ import { ModalModule } from 'ngx-bootstrap/modal';
import { SearchButtonsModule } from '@keira-shared/modules/search-button/search-buttons.module';

@NgModule({
entryComponents: [
CreatureSelectorModalComponent,
],
declarations: [
CreatureSelectorBtnComponent,
CreatureSelectorModalComponent,
Expand Down
Expand Up @@ -11,9 +11,6 @@ import { ModalModule } from 'ngx-bootstrap/modal';
import { SearchButtonsModule } from '@keira-shared/modules/search-button/search-buttons.module';

@NgModule({
entryComponents: [
FactionSelectorModalComponent,
],
declarations: [
FactionSelectorBtnComponent,
FactionSelectorModalComponent,
Expand Down
Expand Up @@ -8,9 +8,6 @@ import { FlagsSelectorBtnComponent } from './flags-selector-btn.component';
import { uiSwitchConfig } from '@keira-config/ui-switch.config';

@NgModule({
entryComponents: [
FlagsSelectorModalComponent,
],
declarations: [
FlagsSelectorModalComponent,
FlagsSelectorBtnComponent,
Expand Down
Expand Up @@ -11,9 +11,6 @@ import { ModalModule } from 'ngx-bootstrap/modal';
import { SearchButtonsModule } from '@keira-shared/modules/search-button/search-buttons.module';

@NgModule({
entryComponents: [
GameobjectSelectorModalComponent,
],
declarations: [
GameobjectSelectorBtnComponent,
GameobjectSelectorModalComponent,
Expand Down
Expand Up @@ -11,9 +11,6 @@ import { ModalModule } from 'ngx-bootstrap/modal';
import { SearchButtonsModule } from '@keira-shared/modules/search-button/search-buttons.module';

@NgModule({
entryComponents: [
HolidaySelectorModalComponent,
],
declarations: [
HolidaySelectorBtnComponent,
HolidaySelectorModalComponent,
Expand Down
Expand Up @@ -11,9 +11,6 @@ import { ModalModule } from 'ngx-bootstrap/modal';
import { SearchButtonsModule } from '@keira-shared/modules/search-button/search-buttons.module';

@NgModule({
entryComponents: [
ItemEnchantmentSelectorModalComponent,
],
declarations: [
ItemEnchantmentSelectorBtnComponent,
ItemEnchantmentSelectorModalComponent,
Expand Down
Expand Up @@ -11,9 +11,6 @@ import { ModalModule } from 'ngx-bootstrap/modal';
import { SearchButtonsModule } from '@keira-shared/modules/search-button/search-buttons.module';

@NgModule({
entryComponents: [
ItemExtendedCostSelectorModalComponent,
],
declarations: [
ItemExtendedCostSelectorBtnComponent,
ItemExtendedCostSelectorModalComponent,
Expand Down
Expand Up @@ -11,9 +11,6 @@ import { ModalModule } from 'ngx-bootstrap/modal';
import { SearchButtonsModule } from '@keira-shared/modules/search-button/search-buttons.module';

@NgModule({
entryComponents: [
ItemLimitCategorySelectorModalComponent,
],
declarations: [
ItemLimitCategorySelectorBtnComponent,
ItemLimitCategorySelectorModalComponent,
Expand Down
Expand Up @@ -12,9 +12,6 @@ import { IconModule } from '@keira-shared/modules/icon/icon.module';
import { SearchButtonsModule } from '@keira-shared/modules/search-button/search-buttons.module';

@NgModule({
entryComponents: [
ItemSelectorModalComponent,
],
declarations: [
ItemSelectorBtnComponent,
ItemSelectorModalComponent,
Expand Down
Expand Up @@ -11,9 +11,6 @@ import { ModalModule } from 'ngx-bootstrap/modal';
import { SearchButtonsModule } from '@keira-shared/modules/search-button/search-buttons.module';

@NgModule({
entryComponents: [
LanguageSelectorModalComponent,
],
declarations: [
LanguageSelectorBtnComponent,
LanguageSelectorModalComponent,
Expand Down
Expand Up @@ -11,9 +11,6 @@ import { ModalModule } from 'ngx-bootstrap/modal';
import { SearchButtonsModule } from '@keira-shared/modules/search-button/search-buttons.module';

@NgModule({
entryComponents: [
MapSelectorModalComponent,
],
declarations: [
MapSelectorBtnComponent,
MapSelectorModalComponent,
Expand Down
Expand Up @@ -12,9 +12,6 @@ import { IconModule } from '@keira-shared/modules/icon/icon.module';
import { SearchButtonsModule } from '@keira-shared/modules/search-button/search-buttons.module';

@NgModule({
entryComponents: [
NpcTextSelectorModalComponent,
],
declarations: [
NpcTextSelectorBtnComponent,
NpcTextSelectorModalComponent,
Expand Down
Expand Up @@ -11,9 +11,6 @@ import { ModalModule } from 'ngx-bootstrap/modal';
import { SearchButtonsModule } from '@keira-shared/modules/search-button/search-buttons.module';

@NgModule({
entryComponents: [
QuestSelectorModalComponent,
],
declarations: [
QuestSelectorBtnComponent,
QuestSelectorModalComponent,
Expand Down
Expand Up @@ -7,9 +7,6 @@ import { SingleValueSelectorModalComponent } from './single-value-selector-modal
import { SingleValueSelectorBtnComponent } from './single-value-selector-btn.component';

@NgModule({
entryComponents: [
SingleValueSelectorModalComponent,
],
declarations: [
SingleValueSelectorModalComponent,
SingleValueSelectorBtnComponent,
Expand Down
Expand Up @@ -11,9 +11,6 @@ import { ModalModule } from 'ngx-bootstrap/modal';
import { SearchButtonsModule } from '@keira-shared/modules/search-button/search-buttons.module';

@NgModule({
entryComponents: [
SkillSelectorModalComponent,
],
declarations: [
SkillSelectorBtnComponent,
SkillSelectorModalComponent,
Expand Down
Expand Up @@ -11,9 +11,6 @@ import { ModalModule } from 'ngx-bootstrap/modal';
import { SearchButtonsModule } from '@keira-shared/modules/search-button/search-buttons.module';

@NgModule({
entryComponents: [
SpellSelectorModalComponent,
],
declarations: [
SpellSelectorBtnComponent,
SpellSelectorModalComponent,
Expand Down
@@ -1,10 +1,11 @@
import { OnDestroy } from '@angular/core';
import { OnDestroy, Injectable } from '@angular/core';
import { Subscription } from 'rxjs';

@Injectable()
export abstract class SubscriptionHandler implements OnDestroy {
protected subscriptions: Subscription[] = [];

ngOnDestroy() {
ngOnDestroy(): void {
this.subscriptions.forEach((subscription) => subscription.unsubscribe());
}
}
2 changes: 1 addition & 1 deletion src/tsconfig.app.json
@@ -1,5 +1,5 @@
{
"extends": "../tsconfig.json",
"extends": "../tsconfig.base.json",
"compilerOptions": {
"outDir": "../out-tsc/app",
"baseUrl": "",
Expand Down
2 changes: 1 addition & 1 deletion src/tsconfig.spec.json
@@ -1,5 +1,5 @@
{
"extends": "../tsconfig.json",
"extends": "../tsconfig.base.json",
"compilerOptions": {
"outDir": "../out-tsc/spec",
"types": [
Expand Down

0 comments on commit 1568e55

Please sign in to comment.