Skip to content

Commit 789ba70

Browse files
committed
refactor(documents): Replace docusaurus-plugin-typedoc with docusaurus-plugin-typedoc-api
1 parent ed5275a commit 789ba70

28 files changed

+417
-291
lines changed

Diff for: .vscode/settings.json

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"baseui",
44
"bson",
55
"clsx",
6+
"codicon",
67
"hookz",
78
"nanostore",
89
"nanostores",

Diff for: .yarn/patches/typedoc-npm-0.23.11-40959b300d.patch

-13
This file was deleted.

Diff for: .yarn/patches/typedoc-plugin-markdown-npm-3.13.4-b92b9934bb.patch

-12
This file was deleted.

Diff for: package.json

+2-4
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"@nrwl/web": "^14.5.2",
2525
"@nrwl/workspace": "^14.5.2",
2626
"@parcel/packager-ts": "2.6.2",
27-
"@types/jest": "27.4.1",
27+
"@types/jest": "^28.1.8",
2828
"@types/node": "16.11.7",
2929
"@typescript-eslint/eslint-plugin": "^5.29.0",
3030
"@typescript-eslint/parser": "^5.29.0",
@@ -49,9 +49,7 @@
4949
"tslib": "^2.3.0"
5050
},
5151
"resolutions": {
52-
"lottie-web": "patch:lottie-web@npm:5.7.3#.yarn/patches/lottie-web-npm-5.7.3-6621bfff6b.patch",
53-
"[email protected]": "patch:typedoc@npm:0.23.11#.yarn/patches/typedoc-npm-0.23.11-40959b300d.patch",
54-
"[email protected]": "patch:typedoc-plugin-markdown@npm:3.13.4#.yarn/patches/typedoc-plugin-markdown-npm-3.13.4-b92b9934bb.patch"
52+
"lottie-web": "patch:lottie-web@npm:5.7.3#.yarn/patches/lottie-web-npm-5.7.3-6621bfff6b.patch"
5553
},
5654
"workspaces": [
5755
"packages/*"

Diff for: packages/act-player/package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
"@types/debug": "^4.1.7",
2222
"@types/fs-extra": "^9.0.13",
2323
"@types/lodash": "^4.14.177",
24-
"@types/react": "18.0.9",
25-
"@types/react-dom": "18.0.5",
24+
"@types/react": "^18.0.17",
25+
"@types/react-dom": "^18.0.6",
2626
"@types/react-slider": "^1.3.1",
2727
"@types/styletron-engine-atomic": "^1.1.1",
2828
"@types/styletron-react": "^5.0.3",
@@ -40,8 +40,8 @@
4040
"https-browserify": "^1.0.0",
4141
"process": "^0.11.10",
4242
"querystring-es3": "^0.2.1",
43-
"react": "18.1.0",
44-
"react-dom": "18.1.0",
43+
"react": "^18.2.0",
44+
"react-dom": "^18.2.0",
4545
"react-router-dom": "6.3.0",
4646
"rimraf": "^3.0.2",
4747
"rollup": "^2.72.1",

Diff for: packages/ap-core/package.json

-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@
5050
"serve": "^11.3.2",
5151
"three": "^0.140.2",
5252
"ts-loader": "^8.0.14",
53-
"typedoc-plugin-pages-fork": "^0.0.1",
5453
"typescript": ">=3.0.0"
5554
},
5655
"files": [

Diff for: packages/ap-core/src/hooks/fetchDataHooks.ts

+9-3
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,19 @@ export const useRemoteJsonDataSource = <T>(url: string, init?: RequestInit) => {
2222
return [fetchData, subscribeDataUpdate] as const;
2323
};
2424

25-
export type QueryResult<V> = {
25+
export interface ISuccessResponse<V> {
2626
success: true,
2727
data: V,
28-
} | {
28+
}
29+
30+
export interface IFailedResponse {
2931
success: false,
3032
error: unknown,
31-
};
33+
}
34+
35+
export type QueryResult<V> =
36+
| ISuccessResponse<V>
37+
| IFailedResponse;
3238

3339
export const defaultQueryFn = async<K, V>(url: K | null) => {
3440
if (url === null) {

Diff for: packages/ap-core/src/utils/smartAnimatedSprite.ts

+12-6
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { utils } from 'pixi.js-legacy';
22
import * as PIXI from 'pixi.js-legacy';
3-
import { IResourceFileForClient } from '@recative/definitions';
3+
import { IDetailedResourceItemForClient, IResourceFileForClient } from '@recative/definitions';
44
import { getMatchedResource, ResourceEntry } from '@recative/smart-resource';
55

6-
import { useQuery } from '../hooks/fetchDataHooks';
6+
import { IFailedResponse, ISuccessResponse, useQuery } from '../hooks/fetchDataHooks';
77
import { DataSource, useCombinator, useSelector } from '../core/DataSource';
88
import {
99
Subscribable,
@@ -48,10 +48,13 @@ const useSmartTextureInfoSequence = (
4848
return null;
4949
}
5050
if (metadataResponse && !metadataResponse.success) {
51-
console.warn('Failed to get metadata:', metadataResponse.error);
51+
console.warn(
52+
'Failed to get metadata:',
53+
(metadataResponse as IFailedResponse).error
54+
);
5255
return null;
5356
}
54-
const metadata = metadataResponse.data;
57+
const metadata = (metadataResponse as ISuccessResponse<IDetailedResourceItemForClient>).data;
5558
if (metadata === null) return null;
5659
if (!('type' in metadata)) {
5760
return null;
@@ -65,7 +68,7 @@ const useSmartTextureInfoSequence = (
6568
item: file,
6669
}));
6770

68-
const file = getMatchedResource(
71+
const file: IResourceFileForClient = getMatchedResource(
6972
files,
7073
{
7174
...smartResourceConfig,
@@ -120,7 +123,10 @@ const useSmartTextureInfoSequence = (
120123
return null;
121124
}
122125
if (!frameInfosResponse?.success) {
123-
console.warn('Failed to generate SmartTextureInfos:', frameInfosResponse.error);
126+
console.warn(
127+
'Failed to generate SmartTextureInfos:',
128+
(frameInfosResponse as IFailedResponse).error,
129+
);
124130
return [];
125131
}
126132
return frameInfosResponse.data;

Diff for: packages/ap-core/src/utils/smartSprite.ts

+9-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import * as PIXI from 'pixi.js-legacy';
33
import { IResourceFileForClient } from '@recative/definitions';
44
import { getMatchedResource, ResourceEntry } from '@recative/smart-resource';
55

6-
import { useQuery } from '../hooks/fetchDataHooks';
6+
import { IFailedResponse, useQuery } from '../hooks/fetchDataHooks';
77
import { DataSource, useCombinator, useSelector } from '../core/DataSource';
88
import {
99
DefaultTagDataSource,
@@ -45,7 +45,10 @@ const useSmartTextureInfo = (
4545
return null;
4646
}
4747
if (!metadataResponse?.success) {
48-
console.warn('Failed to get metadata:', metadataResponse.error);
48+
console.warn(
49+
'Failed to get metadata:',
50+
(metadataResponse as IFailedResponse).error,
51+
);
4952
return null;
5053
}
5154
const metadata = metadataResponse.data;
@@ -95,7 +98,10 @@ const useSmartTextureInfo = (
9598
return null;
9699
}
97100
if (!textureInfoResponse?.success) {
98-
console.warn('Failed to generate SmartTextureInfo:', textureInfoResponse.error);
101+
console.warn(
102+
'Failed to generate SmartTextureInfo:',
103+
(textureInfoResponse as IFailedResponse).error
104+
);
99105
return {};
100106
}
101107
return textureInfoResponse.data;

Diff for: packages/ap-pack/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@
4444
"mkdirp": "^1.0.4",
4545
"node-polyfill-webpack-plugin": "^1.1.2",
4646
"parcel": "^2.3.1",
47-
"react": "18.1.0",
48-
"react-dom": "^18.1.0",
47+
"react": "^18.2.0",
48+
"react-dom": "^18.2.0",
4949
"react-router-dom": "^6.2.2",
5050
"style-loader": "^2.0.0",
5151
"styletron-engine-atomic": "^1.4.8",

Diff for: packages/ap-preview/package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
"@types/debug": "^4.1.7",
2121
"@types/fs-extra": "^9.0.13",
2222
"@types/lodash": "^4.14.177",
23-
"@types/react": "18.0.9",
24-
"@types/react-dom": "18.0.5",
23+
"@types/react": "^18.0.17",
24+
"@types/react-dom": "^18.0.6",
2525
"@types/react-slider": "^1.3.1",
2626
"@types/styletron-engine-atomic": "^1.1.1",
2727
"@types/styletron-engine-monolithic": "^0.0.0",
@@ -41,8 +41,8 @@
4141
"parcel": "^2.0.0",
4242
"process": "^0.11.10",
4343
"querystring-es3": "^0.2.1",
44-
"react": "18.1.0",
45-
"react-dom": "18.1.0",
44+
"react": "^18.2.0",
45+
"react-dom": "^18.2.0",
4646
"react-router-dom": "6.3.0",
4747
"rimraf": "^3.0.2",
4848
"stream-http": "^3.2.0",

Diff for: packages/ap-preview/src/index.tsx

+2-6
Original file line numberDiff line numberDiff line change
@@ -34,25 +34,21 @@ import { Drawer, SIZE as DRAWER_SIZE } from 'baseui/drawer';
3434
import { Button, KIND, SIZE as BUTTON_SIZE } from 'baseui/button';
3535
import type { ButtonOverrides } from 'baseui/button';
3636

37+
import { Error, Loading } from '@recative/act-player';
3738
import { useEnvVariable } from './utils/useEnvVariable';
3839
import {
3940
useUserImplementedFunctions,
4041
INITIAL_ASSET_STATUS_ATOM,
4142
} from './utils/useUserImplementedFunctions';
4243

43-
import { Error } from '@recative/act-player';
44-
import { Loading } from '@recative/act-player';
45-
46-
window.React = React;
47-
4844
const PREFERRED_UPLOADERS = [
4945
'@recative/uploader-extension-studio/ResourceManager',
5046
'@recative/uploader-polyv-vod/PolyVUploader',
5147
];
5248

5349
const TRUSTED_UPLOADERS = [
5450
'@recative/uploader-extension-studio/ResourceManager',
55-
]
51+
];
5652

5753
if (window.localStorage.getItem('@recative/act-player/error-request')) {
5854
PREFERRED_UPLOADERS.push('@recative/uploader-extension-error/not-exists');

Diff for: packages/client-sdk/package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"@rollup/plugin-sucrase": "^4.0.3",
2626
"@rollup/plugin-typescript": "^8.3.1",
2727
"@types/debug": "^4.1.7",
28-
"@types/react": "^17.0.40",
28+
"@types/react": "^18.0.17",
2929
"@typescript-eslint/eslint-plugin": "^5.3.0",
3030
"@typescript-eslint/parser": "^5.3.0",
3131
"baseui": "^10.10.0",
@@ -36,8 +36,8 @@
3636
"eslint-plugin-import": "^2.25.2",
3737
"lottie-react": "2.1.0",
3838
"nanostores": "^0.5.10",
39-
"react": "18.1.0",
40-
"react-dom": "^18.1.0",
39+
"react": "^18.2.0",
40+
"react-dom": "^18.2.0",
4141
"react-slider": "2.0.1",
4242
"react-use": "^17.3.2",
4343
"rimraf": "^3.0.2",

Diff for: packages/client-sdk/src/components/Content.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const usePlayerPropsDefaultHook = () => ({
3232
injectToContainer: undefined,
3333
});
3434

35-
const DefaultContainerComponent: React.FC = ({ children }) => (
35+
const DefaultContainerComponent: React.FC<React.PropsWithChildren<{}>> = ({ children }) => (
3636
// eslint-disable-next-line react/forbid-dom-props
3737
<div className="demoContainer" style={{ width: '100%', height: '100%' }}>
3838
{children}

Diff for: packages/client-sdk/src/hooks/useCustomizedModule.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export interface ICustomizedModule<T = any> {
3333
default: T;
3434
}
3535

36-
export const DEFAULT_COMPONENTS: React.FC = ({ children }) => (
36+
export const DEFAULT_COMPONENTS: React.FC<React.PropsWithChildren<{}>> = ({ children }) => (
3737
<div>{children}</div>
3838
);
3939

Diff for: packages/client-sdk/tsconfig.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
"skipLibCheck": true,
88
"forceConsistentCasingInFileNames": true,
99
"moduleResolution": "node",
10-
"jsx":"react-jsx"
10+
"jsx":"react-jsx",
11+
"types": ["react/next", "react-dom/next"]
1112
},
1213
"include": [
1314
"src",

Diff for: packages/documents/docs/api/index.md

-5
This file was deleted.

Diff for: packages/documents/docusaurus.config.js

+16-22
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,10 @@
11
// Note: type annotations allow type checking and IDEs autocompletion
22

3+
const path = require('path');
34
const lightCodeTheme = require('prism-react-renderer/themes/github');
45

56
const labels = require('./packages');
67

7-
const tsDocsConfig = (packageName, label) => [
8-
'docusaurus-plugin-typedoc',
9-
{
10-
id: `api-doc-${packageName}`,
11-
out: `api/${packageName}`,
12-
entryPoints: [
13-
`../${packageName}`,
14-
],
15-
readme: `../${packageName}/README.md`,
16-
sidebar: {
17-
categoryLabel: label,
18-
fullNames: true,
19-
},
20-
entryPointStrategy: 'packages',
21-
tsconfig: './tsconfig.typedoc.json',
22-
excludeExternals: true,
23-
},
24-
];
25-
268
/** @type {import('@docusaurus/types').Config} */
279
const config = {
2810
title: 'Recative System',
@@ -90,9 +72,9 @@ const config = {
9072
label: 'Tutorial',
9173
},
9274
{
93-
to: 'docs/api',
75+
to: 'api',
9476
label: 'API',
95-
activeBasePath: 'docs/api',
77+
activeBasePath: 'api',
9678
position: 'left',
9779
},
9880
{ to: '/blog', label: 'Blog', position: 'left' },
@@ -116,7 +98,19 @@ const config = {
11698
theme: lightCodeTheme,
11799
},
118100
}),
119-
plugins: labels.map(({ id, label }) => tsDocsConfig(id, label)),
101+
plugins: [
102+
[
103+
'docusaurus-plugin-typedoc-api',
104+
{
105+
projectRoot: path.join(__dirname, '..', '..'),
106+
packages: labels.map(({ id }) => ({
107+
path: `packages/${id}`,
108+
entry: 'src/index.ts',
109+
})),
110+
exclude: ['*.spec.ts', '*.test.ts'],
111+
},
112+
],
113+
],
120114
};
121115

122116
module.exports = config;

Diff for: packages/documents/package.json

+4-7
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@
1717
"@docusaurus/preset-classic": "2.0.1",
1818
"@mdx-js/react": "^1.6.22",
1919
"clsx": "^1.2.1",
20-
"docusaurus-plugin-typedoc": "^0.17.5",
20+
"docusaurus-plugin-typedoc-api": "^2.4.0",
2121
"prism-react-renderer": "^1.3.5",
22-
"react": "^17.0.2",
23-
"react-dom": "^17.0.2",
24-
"typedoc": "patch:typedoc@npm:0.23.11#../../.yarn/patches/typedoc-npm-0.23.11-40959b300d.patch",
22+
"react": "^18.2.0",
23+
"react-dom": "^18.2.0",
24+
"typedoc": "0.23.10",
2525
"typedoc-plugin-markdown": "^3.13.4"
2626
},
2727
"devDependencies": {
@@ -41,9 +41,6 @@
4141
"last 1 safari version"
4242
]
4343
},
44-
"resolutions": {
45-
"[email protected]": "patch:typedoc-plugin-markdown@npm:3.13.4#../../.yarn/patches/typedoc-plugin-markdown-npm-3.13.4-b92b9934bb.patch"
46-
},
4744
"engines": {
4845
"node": ">=16.14"
4946
}

0 commit comments

Comments
 (0)