-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.js
More file actions
29 lines (23 loc) · 775 Bytes
/
build.js
File metadata and controls
29 lines (23 loc) · 775 Bytes
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
const fs = require('fs-extra');
const path = require('path');
const buildDir = path.join(__dirname, 'dist');
const srcDir = path.join(__dirname, 'src');
async function build() {
try {
// Clean up the build directory
if (fs.existsSync(buildDir)) {
await fs.remove(buildDir);
}
await fs.mkdir(buildDir);
// Copy source files
await fs.copy(srcDir, path.join(buildDir, 'src'));
// Copy package files
await fs.copy(path.join(__dirname, 'package.json'), path.join(buildDir, 'package.json'));
await fs.copy(path.join(__dirname, 'package-lock.json'), path.join(buildDir, 'package-lock.json'));
console.log('Build successful!');
} catch (err) {
console.error('Error during build:', err);
process.exit(1);
}
}
build();