Skip to content

Commit

Permalink
chore(deps): update dependency typedoc to ^0.25.0 (ant-design#44443)
Browse files Browse the repository at this point in the history
* chore(deps): update dependency typedoc to ^0.25.0

* fix: fix type

* fix: fix

* fix: fix

* fix: fix

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: 栗嘉男 <574980606@qq.com>
  • Loading branch information
renovate[bot] and li-jia-nan authored Aug 27, 2023
1 parent 50bf708 commit 3c73256
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 20 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@
"sylvanas": "^0.6.1",
"terser": "^5.16.1",
"ts-node": "^10.8.2",
"typedoc": "^0.24.8",
"typedoc": "^0.25.0",
"typescript": "~5.1.3",
"vanilla-jsoneditor": "^0.18.0",
"webpack-bundle-analyzer": "^4.1.0",
Expand Down
35 changes: 16 additions & 19 deletions scripts/generate-token-meta.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ import fs from 'fs-extra';
import type { DeclarationReflection } from 'typedoc';
import { Application, TSConfigReader, TypeDocReader } from 'typedoc';

type TokenMeta = {
interface TokenMeta {
seed: ReturnType<typeof getTokenList>;
map: ReturnType<typeof getTokenList>;
alias: ReturnType<typeof getTokenList>;
components: Record<string, ReturnType<typeof getTokenList>>;
};
}

function getTokenList(list?: DeclarationReflection[], source?: string) {
return (list || [])
Expand Down Expand Up @@ -40,20 +40,17 @@ function getTokenList(list?: DeclarationReflection[], source?: string) {
}));
}

const main = () => {
const app = new Application();

// If you want TypeDoc to load tsconfig.json / typedoc.json files
app.options.addReader(new TSConfigReader());
app.options.addReader(new TypeDocReader());

app.bootstrap({
// typedoc options here
entryPoints: ['components/theme/interface/index.ts', 'components/*/style/index.{ts,tsx}'],
skipErrorChecking: true,
});
const main = async () => {
const app = await (Application as any).bootstrap(
{
// typedoc options here
entryPoints: ['components/theme/interface/index.ts', 'components/*/style/index.{ts,tsx}'],
skipErrorChecking: true,
},
[new TSConfigReader(), new TypeDocReader()],
);

const project = app.convert();
const project = await app.convert();

if (project) {
// Project may not have converted correctly
Expand All @@ -66,11 +63,11 @@ const main = () => {
};

// eslint-disable-next-line no-restricted-syntax
project?.children?.forEach((file) => {
project?.children?.forEach((file: any) => {
// Global Token
if (file.name === 'theme/interface') {
let presetColors: string[] = [];
file.children?.forEach((type) => {
file.children?.forEach((type: any) => {
if (type.name === 'SeedToken') {
tokenMeta.seed = getTokenList(type.children, 'seed');
} else if (type.name === 'MapToken') {
Expand Down Expand Up @@ -102,8 +99,8 @@ const main = () => {
} else {
const component = file.name
.slice(0, file.name.indexOf('/'))
.replace(/(^(.)|-(.))/g, (match) => match.replace('-', '').toUpperCase());
const componentToken = file.children?.find((item) => item.name === `ComponentToken`);
.replace(/(^(.)|-(.))/g, (match: string) => match.replace('-', '').toUpperCase());
const componentToken = file.children?.find((item: any) => item?.name === 'ComponentToken');
if (componentToken) {
tokenMeta.components[component] = getTokenList(componentToken.children, component);
}
Expand Down

0 comments on commit 3c73256

Please sign in to comment.