Skip to content

Commit

Permalink
build: 修复网站编译报错
Browse files Browse the repository at this point in the history
  • Loading branch information
zhaohappy committed Dec 17, 2024
1 parent 14e183a commit 0e7d408
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 128 deletions.
9 changes: 5 additions & 4 deletions site/.dumi/app.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
import { type IPreviewerProps } from 'dumi';
import { type Project } from '@stackblitz/sdk';
import { IFiles } from 'codesandbox-import-utils/lib/api/define';

export function modifyStackBlitzData(memo: Project, props: IPreviewerProps) {
export function modifyStackBlitzData(memo: Project, props: any) {
// if use default template: 'create-react-app', demo won't install dependencies automatically
memo.template = 'node';
return createTemplate(memo, props, true);
}

export function modifyCodeSandboxData(memo: { files: IFiles }, props: IPreviewerProps) {
export function modifyCodeSandboxData(memo: { files: IFiles }, props: any) {
return createTemplate(memo, props, false);
}

function createTemplate(memo: { files: IFiles } | Project, props: IPreviewerProps, isStackBlitz: boolean) {
function createTemplate(memo: { files: IFiles } | Project, props: any, isStackBlitz: boolean) {
Object.entries(memo.files).forEach(([name, content]) => {
if (name === 'sandbox.config.json') {
memo.files[name] = {
Expand All @@ -33,8 +32,10 @@ function createTemplate(memo: { files: IFiles } | Project, props: IPreviewerProp
if (name === 'package.json') {
const packageJson = JSON.parse(content);
const npmDeps = Object.entries(props.asset.dependencies || {})
// @ts-ignore
.filter(([key, value]) => value.type === 'NPM')
.reduce((acc: { [key: string]: any }, [key, value]) => {
// @ts-ignore
acc[key] = value.value;
return acc;
}, {});
Expand Down
118 changes: 0 additions & 118 deletions site/@types/api.ts

This file was deleted.

4 changes: 3 additions & 1 deletion site/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions site/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"@commitlint/cli": "^17.1.2",
"@commitlint/config-conventional": "^17.1.0",
"@types/node": "^22.7.6",
"@types/react": "^18.3.1",
"@umijs/plugins": "^4.1.2",
"dumi": "^2.2.13",
"dumi-theme-antd-style": "^0.31.1",
Expand Down
5 changes: 1 addition & 4 deletions site/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
],
"baseUrl": "./",
"paths": {
"@@/*": [".dumi/tmp/*"],
"@libmedia/avcodec/*": ["../src/avcodec/*"],
"@libmedia/avformat/*": ["../src/avformat/*"],
"@libmedia/avnetwork/*": ["../src/avnetwork/*"],
Expand Down Expand Up @@ -51,13 +50,11 @@
"/node_modules/**",
"/dist/",
"*.d.ts",
"../src/common/types/api.ts",
"../src/cheap/dist/**",
"../src/common/dist/**"
],
"files": [
"../@types/index.d.ts",
"../src/cheap/@types/index.d.ts",
"./@types/api.ts"
"../src/cheap/@types/index.d.ts"
]
}
2 changes: 1 addition & 1 deletion src/common
Submodule common updated 1 files
+1 −1 types/api.ts

0 comments on commit 0e7d408

Please sign in to comment.