Skip to content

Commit 7275477

Browse files
committed
fix some bugs
1 parent 973c289 commit 7275477

4 files changed

Lines changed: 15 additions & 14 deletions

File tree

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
"tools:bump": "ts-node tools/*/bump-version && yarn changelog",
2727
"tools:bump-nightly": "ts-node tools/src/bump-version --nightly",
2828
"tools:deploy": "ts-node tools/src/deploy",
29-
"tools:docs-api": "ts-node --esm --project ./tools/tsconfig.tn.json tools/src/generate-api-docs.ts",
30-
"watch-docs": "ts-node --esm --project ./tools/tsconfig.tn.json ./tools/src/markdown-to-html/markdown-to-html",
29+
"tools:docs-api": "ts-node --esm --project ./tools/tsconfig.tn.json ./tools/src/generate-api-docs.mts",
30+
"watch-docs": "ts-node --esm --project ./tools/tsconfig.tn.json ./tools/src/markdown-to-html/markdown-to-html.mts",
3131
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s",
3232
"serve:lib": "hs dist/docs-content -p 1212 -g --cors 'Access-Control-Allow-Origin' -c0",
3333
"build:schematics": "tsc -p src/lib/schematics/tsconfig.json && cp -r src/lib/schematics/ dist/@alyle/ui/ && rm -rf dist/@alyle/ui/schematics/**/*.ts",
Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import * as ts from 'typescript';
1+
import ts from 'typescript';
22
import * as path from 'path';
33
import * as fs from 'fs';
44
import chalk from 'chalk';
55
import { Application, TypeDocReader, TSConfigReader, ProjectReflection, DeclarationReflection, Reflection } from 'typedoc';
66

7-
import { highlight } from './html-loader/highlight';
8-
import { hashCode } from './utils/hash-code';
7+
import { highlight } from './html-loader/highlight.mjs';
8+
import { hashCode } from './utils/hash-code.mjs';
99
const { readFile, mkdir, writeFile } = fs.promises;
1010

1111
interface PkgSymbol {
@@ -56,9 +56,9 @@ async function render() {
5656
if (!child.children) {
5757
continue;
5858
}
59-
let pkgName = child.sources![0].fileName.replace(/src\/lib/, '@alyle/ui');
59+
let pkgName = child.sources![0]!.fileName.replace(/src\/lib/, '@alyle/ui');
6060
pkgName = path.dirname(pkgName);
61-
console.log(child.sources![0].fileName);
61+
console.log(child.sources![0]!.fileName);
6262
pkgName = pkgName.endsWith('/') ? pkgName.slice(0, -1) : pkgName;
6363
console.log(chalk.greenBright(`\nPackage: ${pkgName}`));
6464
let API = APIList.find(api => api.pkg === pkgName);
@@ -74,19 +74,19 @@ async function render() {
7474
APIList.push(API);
7575
}
7676
for (const _child of child.children) {
77-
const file = _child.sources![0].fileName;
77+
const file = _child.sources![0]!.fileName;
7878
const { name, decorators, kindString } = _child;
7979
const type = decorators
80-
? decorators[0].name
80+
? decorators[0]!.name
8181
: (kindString! === 'Variable' ? 'Const' : kindString!);
8282
const symbol = hasTag(_child, 'decorator')
8383
? 'Decorator'
8484
: decorators
85-
? decorators[0].name
85+
? decorators[0]!.name
8686
: _child.flags.isConst
8787
? 'Const'
8888
: (kindString! === 'Variable' ? 'Const' : kindString!);
89-
const Type = `${toCamelcase(type)}List`;
89+
// const Type = `${toCamelcase(type)}List`;
9090
if (
9191
!checkIfContainTagPrivate(_child) && !hasTag(_child, 'docsPrivate') && !name.startsWith('_')
9292
) {
@@ -206,6 +206,7 @@ async function render() {
206206
await generateJson();
207207
await render();
208208
})().catch((error) => {
209+
console.log(error);
209210
throw new Error(error);
210211
});
211212

@@ -217,7 +218,7 @@ function groupBy<T>(xs: T[], key: string): { key: string, items: T[]}[] {
217218
items: []
218219
}) as true /** <-- This always returns true, since an item is never removed */)
219220
&& rv[rv.length - 1]);
220-
item.items.push(x);
221+
item!.items.push(x);
221222
return rv;
222223
}, [] as { key: string, items: T[]}[]);
223224
}
@@ -256,7 +257,7 @@ function toCamelcase(str: string) {
256257

257258
function hasTag(refl: DeclarationReflection, tag: string): boolean {
258259
const comment: Reflection['comment'] = refl.comment
259-
|| (refl['signatures'] && refl['signatures'].length ? refl['signatures'][0].comment : undefined);
260+
|| (refl['signatures'] && refl['signatures'].length ? refl['signatures'][0]!.comment : undefined);
260261
if (comment && comment.tags) {
261262
return comment.tags.some((_: any) => _.tag === tag);
262263
} else {
@@ -266,7 +267,7 @@ function hasTag(refl: DeclarationReflection, tag: string): boolean {
266267

267268
function checkIfContainTagPrivate(refl: DeclarationReflection): boolean {
268269
const comment: Reflection['comment'] = refl.comment
269-
|| (refl['signatures'] && refl['signatures'].length ? refl['signatures'][0].comment : undefined);
270+
|| (refl['signatures'] && refl['signatures'].length ? refl['signatures'][0]!.comment : undefined);
270271
if (comment && comment.tags) {
271272
return comment.tags.some((_: any) => _.tag === 'docs-private');
272273
} else {

0 commit comments

Comments
 (0)