-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.js
More file actions
36 lines (30 loc) · 1.08 KB
/
build.js
File metadata and controls
36 lines (30 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/**
* 构建脚本 - 用于 GitHub Actions 中复制资源文件
*/
const fs = require('fs-extra');
const path = require('path');
async function copyResources() {
const outDir = path.join(__dirname, 'out');
// 确保输出目录存在
await fs.ensureDir(outDir);
// 复制 media 文件夹
const mediaSource = path.join(__dirname, 'media');
const mediaDest = path.join(outDir, 'media');
if (await fs.pathExists(mediaSource)) {
await fs.copy(mediaSource, mediaDest, { overwrite: true });
console.log('✓ Copied media folder');
}
// 复制 typings 文件夹
const typingsSource = path.join(__dirname, 'typings');
const typingsDest = path.join(outDir, 'typings');
if (await fs.pathExists(typingsSource)) {
await fs.copy(typingsSource, typingsDest, { overwrite: true });
console.log('✓ Copied typings folder');
}
console.log('Build resources copied successfully!');
}
// 执行复制
copyResources().catch(err => {
console.error('Error copying resources:', err);
process.exit(1);
});