-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.js
More file actions
37 lines (29 loc) · 1.03 KB
/
build.js
File metadata and controls
37 lines (29 loc) · 1.03 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
37
const fs = require('fs').promises;
const path = require('path');
// Simple build script to copy source files to lib directory
async function build() {
const sourceDir = path.join(__dirname, 'src');
const libDir = path.join(__dirname, 'lib');
try {
// Remove lib directory if it exists
await fs.rm(libDir, { recursive: true, force: true }).catch(() => {});
// Create lib directory
await fs.mkdir(libDir, { recursive: true });
// Copy all files from src to lib
const files = await fs.readdir(sourceDir);
for (const file of files) {
const sourcePath = path.join(sourceDir, file);
const destPath = path.join(libDir, file);
const stat = await fs.stat(sourcePath);
if (stat.isFile()) {
await fs.copyFile(sourcePath, destPath);
console.log(`Copied: ${file}`);
}
}
console.log('Build complete!');
} catch (error) {
console.error('Build failed:', error.message);
process.exit(1);
}
}
build();