|
1 |
| -import shell from "shelljs"; |
2 |
| - |
3 |
| -// 复制@opentinyvue/vue-docs包到本地 |
4 |
| -shell.cp("-R", "node_modules/@opentinyvue/vue-docs", "sites"); |
5 |
| - |
6 |
| -// 删除一些不需要的依赖 |
7 |
| -const pkg = JSON.parse(shell.cat("sites/package.json")); |
8 |
| -delete pkg.devDependencies["@opentiny-internal/unplugin-virtual-template"]; |
9 |
| -delete pkg.devDependencies["@opentiny/vue-mobile"]; |
10 |
| -pkg.scripts["build"] = "vite build --mode pages"; |
11 |
| -shell.ShellString(JSON.stringify(pkg, null, 2)).to("sites/package.json"); |
12 |
| - |
13 |
| -// 修改sites/vite.config.js |
14 |
| -const file = "sites/vite.config.ts"; |
15 |
| -const configJs = shell.cat(file); |
16 |
| -const newConfigJs = configJs |
17 |
| - .split("\n") |
18 |
| - .filter((row) => !row.includes("virtualTemplatePlugin")) |
19 |
| - .filter((row) => !row.includes("getAlias")) |
20 |
| - .filter((row) => !row.includes("@mobile-root")) |
21 |
| - .filter((row) => !row.includes("getOptimizeDeps")) |
22 |
| - .filter((row) => !row.includes("@opentiny/vue-renderless/types")) |
23 |
| - .filter((row) => !row.includes("@opentiny/vue-vite-import")) |
24 |
| - .map((row) => (row.includes("importPlugin([") ? "/*" + row : row)) |
25 |
| - .filter((row) => !row.includes("vite-plugin-dynamic-import")) |
26 |
| - .map((row) => (row.includes("dynamicImportPlugin()") ? row + "*/" : row)); |
27 |
| - |
28 |
| -shell.ShellString(newConfigJs.join("\n")).to(file); |
| 1 | +import shell from "shelljs"; |
| 2 | + |
| 3 | +// 复制@opentinyvue/vue-docs包到本地 |
| 4 | +shell.cp("-R", "node_modules/@opentinyvue/vue-docs", "sites"); |
| 5 | + |
| 6 | +// 删除一些不需要的依赖 |
| 7 | +const pkg = JSON.parse(shell.cat("sites/package.json")); |
| 8 | +delete pkg.devDependencies["@opentiny-internal/unplugin-virtual-template"]; |
| 9 | +delete pkg.devDependencies["@opentiny/vue-mobile"]; |
| 10 | +pkg.scripts["build"] = "vite build --mode pages"; |
| 11 | +shell.ShellString(JSON.stringify(pkg, null, 2)).to("sites/package.json"); |
| 12 | + |
| 13 | +// 修改sites/vite.config.js |
| 14 | +const file = "sites/vite.config.ts"; |
| 15 | +const configJs = shell.cat(file); |
| 16 | +const newConfigJs = configJs |
| 17 | + .split("\n") |
| 18 | + .filter((row) => !row.includes("virtualTemplatePlugin")) |
| 19 | + .filter((row) => !row.includes("getAlias")) |
| 20 | + .filter((row) => !row.includes("@mobile-root")) |
| 21 | + .filter((row) => !row.includes("getOptimizeDeps")) |
| 22 | + .filter((row) => !row.includes("@opentiny/vue-renderless/types")) |
| 23 | + .filter((row) => !row.includes("@opentiny/vue-vite-import")) |
| 24 | + .map((row) => (row.includes("importPlugin([") ? "/*" + row : row)) |
| 25 | + .filter((row) => !row.includes("vite-plugin-dynamic-import")) |
| 26 | + .map((row) => (row.includes("dynamicImportPlugin()") ? row + "*/" : row)); |
| 27 | + |
| 28 | +shell.ShellString(newConfigJs.join("\n")).to(file); |
| 29 | + |
| 30 | +// 修复该.env.pages文件 |
| 31 | +const envFile = "sites/env/.env.pages"; |
| 32 | +const envConfig = shell.cat(envFile); |
| 33 | +const newEnvConfig = envConfig.split("\n").map((row) => { |
| 34 | + if (row.includes("/playground.html")) { |
| 35 | + return row.replace("/playground.html", "/tiny-vue-web-doc/playground.html"); |
| 36 | + } |
| 37 | +}); |
| 38 | + |
| 39 | +shell.ShellString(newEnvConfig.join("\n")).to(envFile); |
0 commit comments