完善 Scert 前后端与部署支持
This commit is contained in:
1 parent
afdb947bea
commit
7f0af703ed
85 files changed
+7530
-800
No files matched your search
@@ -0,0 +1,24 @@
|
||||
import { execSync } from "node:child_process";
|
||||
import { cpSync, existsSync, mkdirSync } from "node:fs";
|
||||
import { dirname, resolve } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
const scriptDirectory = dirname(fileURLToPath(import.meta.url));
|
||||
const projectRoot = resolve(scriptDirectory, "../..");
|
||||
const frontendDirectory = resolve(projectRoot, "frontend");
|
||||
const desktopDistribution = resolve(scriptDirectory, "../frontend/dist");
|
||||
const npmCommand = process.platform === "win32" ? "npm.cmd" : "npm";
|
||||
|
||||
execSync(`${npmCommand} run build`, {
|
||||
cwd: frontendDirectory,
|
||||
stdio: "inherit",
|
||||
shell: true,
|
||||
});
|
||||
|
||||
const frontendDistribution = resolve(frontendDirectory, "dist");
|
||||
if (!existsSync(frontendDistribution)) {
|
||||
throw new Error("前端构建没有生成 dist 目录");
|
||||
}
|
||||
|
||||
mkdirSync(desktopDistribution, { recursive: true });
|
||||
cpSync(frontendDistribution, desktopDistribution, { recursive: true, force: true });
|
||||
Reference in new issue
Block a user