Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to Angular 11 #252

Merged
merged 10 commits into from
Feb 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 17 additions & 22 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,29 +28,24 @@
}
},
"dependencies": {
"@angular/animations": "^10.2.5",
"@angular/cdk": "^10.2.7",
"@angular/common": "^10.2.5",
"@angular/compiler": "^10.2.5",
"@angular/core": "^10.2.5",
"@angular/forms": "^10.2.5",
"@angular/material": "^10.2.7",
"@angular/platform-browser": "^10.2.5",
"@angular/platform-browser-dynamic": "^10.2.5",
"@angular/router": "^10.2.5",
"@angular/animations": "^11.2.14",
"@angular/cdk": "^11.2.13",
"@angular/common": "^11.2.14",
"@angular/compiler": "^11.2.14",
"@angular/core": "^11.2.14",
"@angular/forms": "^11.2.14",
"@angular/material": "^11.2.13",
"@angular/platform-browser": "^11.2.14",
"@angular/platform-browser-dynamic": "^11.2.14",
"@angular/router": "^11.2.14",
"@apollo/client": "3.2.0",
"@octokit/rest": "^16.37.0",
"@primer/octicons": "^17.12.0",
"@types/geojson": "7946.0.8",
"apollo-angular": "^1.9.1",
"apollo-angular-link-http": "^1.10.0",
"apollo-cache-inmemory": "^1.6.0",
"apollo-client": "^2.6.0",
"apollo-link": "^1.2.14",
"apollo-link-context": "^1.0.20",
"apollo-angular": "^2.6.0",
"core-js": "^3.28.0",
"diff-match-patch": "^1.0.4",
"graphql": "^14.6.0",
"graphql-tag": "2.11.0",
"graphql": "^15.0.0",
"karma-spec-reporter": "0.0.32",
"moment": "^2.24.0",
"ngx-mat-select-search": "^3.3.3",
Expand All @@ -61,10 +56,10 @@
"zone.js": "~0.10.2"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.1002.4",
"@angular/cli": "^10.2.4",
"@angular/compiler-cli": "^10.2.5",
"@angular/language-service": "^10.2.5",
"@angular-devkit/build-angular": "~0.1102.19",
"@angular/cli": "^11.2.14",
"@angular/compiler-cli": "^11.2.14",
"@angular/language-service": "^11.2.14",
"@graphql-codegen/cli": "1.17.7",
"@graphql-codegen/typescript": "1.17.7",
"@graphql-codegen/typescript-document-nodes": "1.17.7",
Expand Down
2 changes: 1 addition & 1 deletion src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const routes: Routes = [
];

@NgModule({
imports: [RouterModule.forRoot(routes)],
imports: [RouterModule.forRoot(routes, { relativeLinkResolution: 'legacy' })],
exports: [RouterModule]
})
export class AppRoutingModule {}
24 changes: 13 additions & 11 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import { ErrorHandler, NgModule, NgZone } from '@angular/core';
import { BrowserModule, Title } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { Router } from '@angular/router';
import { Apollo, ApolloModule } from 'apollo-angular';
import { HttpLink, HttpLinkModule } from 'apollo-angular-link-http';
import { InMemoryCache, IntrospectionFragmentMatcher } from 'apollo-cache-inmemory';
import { ApolloLink } from 'apollo-link';
import { setContext } from 'apollo-link-context';
import { ApolloLink, InMemoryCache, PossibleTypesMap } from '@apollo/client/core';
import { setContext } from '@apollo/client/link/context';
import { Apollo } from 'apollo-angular';
import { HttpLink } from 'apollo-angular/http';

import 'reflect-metadata';
import graphqlTypes from '../../graphql/graphql-types';
import '../polyfills';
Expand Down Expand Up @@ -46,9 +46,7 @@ import { SharedModule } from './shared/shared.module';
ActivityDashboardModule,
SharedModule,
HttpClientModule,
AppRoutingModule,
ApolloModule,
HttpLinkModule
AppRoutingModule
],
providers: [
{
Expand Down Expand Up @@ -109,10 +107,14 @@ export class AppModule {
return { headers: { Authorization: `Token ${this.authService.accessToken.getValue()}` } };
});
const link = ApolloLink.from([log, basic, auth, this.httpLink.create({ uri: URI })]);
const fragmentMatcher = new IntrospectionFragmentMatcher({
introspectionQueryResultData: graphqlTypes
const possibleTypes: PossibleTypesMap = {};

graphqlTypes.__schema.types.forEach((type: any) => {
if (type.kind === 'UNION' || type.kind === 'INTERFACE') {
possibleTypes[type.name] = type.possibleTypes.map((possibleType: any) => possibleType.name);
}
});
const cache = new InMemoryCache({ fragmentMatcher });
const cache = new InMemoryCache({ possibleTypes });
this.apollo.create({
link: link,
cache: cache
Expand Down
1 change: 1 addition & 0 deletions src/app/core/services/factories/factory.github.service.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Apollo } from 'apollo-angular';

// import { AppConfig } from '../../../../environments/environment';
import { ErrorHandlingService } from '../error-handling.service';
import { GithubService } from '../github.service';
Expand Down
3 changes: 2 additions & 1 deletion src/app/core/services/github.service.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { HttpErrorResponse } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { ApolloQueryResult } from '@apollo/client/core';
import { Apollo, QueryRef } from 'apollo-angular';
import { ApolloQueryResult } from 'apollo-client';

import { DocumentNode } from 'graphql';
import { BehaviorSubject, forkJoin, from, merge, Observable, of, throwError } from 'rxjs';
import { catchError, filter, flatMap, map, throwIfEmpty } from 'rxjs/operators';
Expand Down
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
"paths": {
"core-js/es7/reflect": ["node_modules/core-js/proposals/reflect-metadata"],
"core-js/es6/": ["node_modules/core-js/es/"]
}
},
"allowSyntheticDefaultImports": true
},
"include": ["main.ts", "src/**/*"],
"exclude": ["node_modules"]
Expand Down
Loading