mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-10-11 17:56:37 +08:00
[优化] 优化静态导出流程,添加重命名功能以简化目录处理
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { cpSync, existsSync, mkdirSync, rmSync } from 'node:fs';
|
||||
import { cpSync, existsSync, mkdirSync, renameSync, rmSync } from 'node:fs';
|
||||
import { resolve } from 'node:path';
|
||||
|
||||
const root = process.cwd();
|
||||
@@ -10,5 +10,10 @@ if (!existsSync(outDir)) {
|
||||
}
|
||||
|
||||
rmSync(buildDir, { recursive: true, force: true });
|
||||
mkdirSync(buildDir, { recursive: true });
|
||||
cpSync(outDir, buildDir, { recursive: true });
|
||||
|
||||
try {
|
||||
renameSync(outDir, buildDir);
|
||||
} catch (error) {
|
||||
mkdirSync(buildDir, { recursive: true });
|
||||
cpSync(outDir, buildDir, { recursive: true });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user