Skip to content

Commit

Permalink
feat: upgrade ng to 17 (#530)
Browse files Browse the repository at this point in the history
  • Loading branch information
why520crazy committed Feb 22, 2024
1 parent 25fd88a commit 4e9b483
Show file tree
Hide file tree
Showing 9 changed files with 1,638 additions and 1,954 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
node_version: ['16']
node_version: ['18']
os: [ubuntu-latest, windows-latest]

steps:
Expand Down
32 changes: 16 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,14 @@
"./packages/ngdoc"
],
"dependencies": {
"@angular/animations": "^16.2.12",
"@angular/common": "^16.2.12",
"@angular/compiler": "^16.2.12",
"@angular/core": "^16.2.12",
"@angular/forms": "^16.2.12",
"@angular/platform-browser": "^16.2.12",
"@angular/platform-browser-dynamic": "^16.2.12",
"@angular/router": "^16.2.12",
"@angular/animations": "^17.2.2",
"@angular/common": "^17.2.2",
"@angular/compiler": "^17.2.2",
"@angular/core": "^17.2.2",
"@angular/forms": "^17.2.2",
"@angular/platform-browser": "^17.2.2",
"@angular/platform-browser-dynamic": "^17.2.2",
"@angular/router": "^17.2.2",
"@types/watchpack": "^1.1.7",
"chokidar": "^3.3.1",
"cosmiconfig": "^6.0.0",
Expand All @@ -77,13 +77,13 @@
"marked": "^4.0.12",
"rxjs": "^7.8.1",
"tslib": "^2.0.0",
"zone.js": "~0.13.3"
"zone.js": "~0.14.4"
},
"devDependencies": {
"@angular-devkit/build-angular": "^16.2.10",
"@angular/cli": "^16.2.10",
"@angular/compiler-cli": "^16.2.12",
"@angular/language-service": "^16.2.12",
"@angular-devkit/build-angular": "^17.2.0",
"@angular/cli": "^17.2.0",
"@angular/compiler-cli": "^17.2.2",
"@angular/language-service": "^17.2.2",
"@commitlint/cli": "^11.0.0",
"@commitlint/config-angular": "^11.0.0",
"@istanbuljs/nyc-config-typescript": "^1.0.1",
Expand Down Expand Up @@ -120,7 +120,7 @@
"karma-coverage": "~2.2.0",
"lerna": "^3.20.2",
"mocha": "^7.1.1",
"ng-packagr": "^16.0.0",
"ng-packagr": "^17.2.0",
"ncp": "^2.0.0",
"nyc": "^15.1.0",
"prettier": "^1.19.1",
Expand All @@ -131,7 +131,7 @@
"ts-node": "8.7.0",
"tslint": "~6.1.0",
"typemoq": "^2.1.0",
"typescript": "4.9.5"
"typescript": "5.3.3"
},
"keywords": [
"angular",
Expand All @@ -154,4 +154,4 @@
"pre-commit": "pretty-quick --staged"
}
}
}
}
2 changes: 1 addition & 1 deletion packages/ngdoc/src/ng-source-file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export class NgSourceFile {
}

public getDefaultExports<TResult>(): TResult {
let exports: TResult;
let exports: ArgumentInfo;
ts.forEachChild(this.sourceFile, node => {
if (ts.isExportAssignment(node) && ts.isObjectLiteralExpression(node.expression)) {
exports = getObjectLiteralExpressionProperties(node.expression);
Expand Down
4 changes: 2 additions & 2 deletions packages/template/src/interfaces/navigation-item.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export interface CategoryItem {
id?: string;
title: string;
subtitle?: string;
items?: Array<DocItem | ComponentDocItem>;
items?: Array<DocItem | ComponentDocItem | CategoryItem>;
locales?: {
[key: string]: {
title: string;
Expand All @@ -63,7 +63,7 @@ export interface ChannelItem {
title: string;
};
};
items?: Array<CategoryItem | DocItem>;
items?: Array<CategoryItem | DocItem | ChannelItem>;
}

export type NavigationItem = ChannelItem & CategoryItem & DocItem & ComponentDocItem;
4 changes: 2 additions & 2 deletions packages/template/src/services/global-context.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { DocgeniSiteConfig } from './../interfaces/config';
import { CONFIG_TOKEN, GlobalContext } from './global-context';
import { createServiceFactory, createHttpFactory, SpectatorHttp, HttpMethod } from '@ngneat/spectator';
import { NavigationItem } from '../interfaces';
import { DocItem, NavigationItem } from '../interfaces';
import { TestBed } from '@angular/core/testing';
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { HttpClient } from '@angular/common/http';
Expand Down Expand Up @@ -206,7 +206,7 @@ describe('GlobalContext', () => {
items: [{ id: '3', title: '', path: '' }]
},
{ id: '', title: '', path: '', items: [{ id: '4', title: '', path: '', hidden: true }] }
];
] as NavigationItem[];
const globalContext = createGlobalContext({} as DocgeniSiteConfig);
const result = globalContext.sortDocItems(list);
expect(result.length).toBe(3);
Expand Down
6 changes: 3 additions & 3 deletions packages/template/src/services/global-context.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Injectable, Inject, InjectionToken } from '@angular/core';
import { DocgeniSiteConfig, NavigationItem, DocgeniMode, HomeDocMeta } from '../interfaces/public-api';
import { DocgeniSiteConfig, NavigationItem, DocgeniMode, HomeDocMeta, CategoryItem } from '../interfaces/public-api';
import { HttpClient } from '@angular/common/http';
import { languageCompare } from '../utils/language-compare';
import { DOCUMENT, Location } from '@angular/common';
Expand Down Expand Up @@ -124,11 +124,11 @@ export class GlobalContext {
const item = navs.shift();
if (item) {
if (item.items) {
item.items.forEach(child => {
item.items.forEach((child: CategoryItem) => {
child.ancestors = child.ancestors || [];
child.ancestors.push(...(item.ancestors || []), item);
});
navs.unshift(...item.items);
navs.unshift(...(item.items as NavigationItem[]));
} else if (!item.hidden) {
list.push(item);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/template/src/services/navigation.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ export class NavigationService {
let docItem: DocItem;
for (const item of nav.items!) {
if (item && this.isCategoryItem(item)) {
docItem = this.getNavFirstDocItem(item);
docItem = this.getNavFirstDocItem(item as NavigationItem);
} else {
docItem = item as DocItem;
}
Expand Down
3 changes: 2 additions & 1 deletion packages/template/src/services/toc.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,13 +150,14 @@ export class TocService {
}
}

private getScrollOffset(): number | void {
private getScrollOffset(): number {
if (this.scrollContainer) {
if (typeof this.scrollContainer.scrollTop !== 'undefined') {
return this.scrollContainer.scrollTop + OFFSET;
} else if (typeof this.scrollContainer.pageYOffset !== 'undefined') {
return this.scrollContainer.pageYOffset + OFFSET;
}
return 0;
} else {
return 0;
}
Expand Down

0 comments on commit 4e9b483

Please sign in to comment.