diff --git a/docs/src/admin/introduction.md b/docs/src/admin/introduction.md index 600f6258..7c29059d 100644 --- a/docs/src/admin/introduction.md +++ b/docs/src/admin/introduction.md @@ -143,11 +143,11 @@ watchEffect(async () => { 在管理端中我们提供了一个可视化的模拟画布,他需要依赖 runtime 核心库,因此我们需要先在 magic 根目录下运行 ```js -cd magic -npm run build +cd tmatic-editor +npm run build:runtime:admin ``` -将 /playground/dist/runtime 文件夹复制到 /magic-admin/web/public 和 /magic-admin/server/assets 目录下。web 下的 runtime 提供给模拟画布使用,server 下的 runtime 提供给发布后的页面来使用。 +将/runtime/{vue3 | vue2 | react}/admin-dist 中所有文件以及文件夹复制到 /magic/runtime 目录下 上面的操作我们提供了/magic-admin/setup.sh 脚本文件来实现,开发者可以参考该脚本文件来搭建流水线。 diff --git a/magic-admin/setup.sh b/magic-admin/setup.sh index 4279ada0..403f138e 100755 --- a/magic-admin/setup.sh +++ b/magic-admin/setup.sh @@ -4,8 +4,8 @@ WORKSPACE=$(dirname "$PWD") echo ${WORKSPACE} -# 全局安装lerna -npm i lerna -g +# 全局安装pnpm +npm i pnpm -g # magic依赖安装和构建 cd ${WORKSPACE} diff --git a/package.json b/package.json index 1e1ef485..b3dfac1b 100644 --- a/package.json +++ b/package.json @@ -17,6 +17,7 @@ "playground:react": "pnpm --filter \"runtime-react\" --filter \"tmagic-playground\" dev:react", "pg:react": "pnpm playground:react", "build": "pnpm --filter \"@tmagic/*\" build", + "build:runtime:admin": "pnpm --filter \"runtime-*\" build:admin", "build:playground": "pnpm --filter \"runtime-*\" --filter \"tmagic-playground\" build", "postbuild:playground": "shx mkdir playground/dist/runtime && shx cp -r runtime/vue2/dist ./playground/dist/runtime/vue2 && shx cp -r runtime/vue3/dist ./playground/dist/runtime/vue3 && cp -r runtime/react/dist ./playground/dist/runtime/react", "docs": "pnpm --filter \"docs\" dev", diff --git a/runtime/react/.env.admin b/runtime/react/.env.admin new file mode 100644 index 00000000..db8e871a --- /dev/null +++ b/runtime/react/.env.admin @@ -0,0 +1,2 @@ +BASE=/runtime +OUT_DIR=admin-dist diff --git a/runtime/react/.gitignore b/runtime/react/.gitignore index 7e7d181f..3ca491ff 100644 --- a/runtime/react/.gitignore +++ b/runtime/react/.gitignore @@ -1,4 +1,5 @@ comp-entry.ts config-entry.ts value-entry.ts -event-entry.ts \ No newline at end of file +event-entry.ts +admin-dist diff --git a/runtime/react/package.json b/runtime/react/package.json index fb1f7a8e..20821886 100644 --- a/runtime/react/package.json +++ b/runtime/react/package.json @@ -5,6 +5,7 @@ "scripts": { "dev:react": "npm run entry && npm run build:lib & npm run dev:html", "build": "npm run entry && vite build", + "build:admin": "npm run entry && vite build --mode admin", "serve": "vite preview", "entry": "node scripts/build.js", "build:lib": "vite build --mode lib", diff --git a/runtime/react/playground.html b/runtime/react/playground.html index 3865d911..ab96e629 100644 --- a/runtime/react/playground.html +++ b/runtime/react/playground.html @@ -22,8 +22,6 @@
- -