-
Notifications
You must be signed in to change notification settings - Fork 0
/
post_build.js
35 lines (30 loc) · 1.02 KB
/
post_build.js
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
// post-build.js
const fs = require('fs');
const path = require('path');
const glob = require('glob');
// Source paths
const srcIndexJS = path.resolve(__dirname, 'index.js');
const srcIndexDTS = path.resolve(__dirname, 'index.d.ts');
// Destination paths
const destDirectory = path.resolve(__dirname, 'driver_api', 'lib');
const destIndexJS = path.join(destDirectory, 'index.js');
const destIndexDTS = path.join(destDirectory, 'index.d.ts');
// Create the directory if it doesn't exist
if (!fs.existsSync(destDirectory)){
fs.mkdirSync(destDirectory);
}
// Move the files
fs.renameSync(srcIndexJS, destIndexJS);
fs.renameSync(srcIndexDTS, destIndexDTS);
// Copy any .node files
glob("**/*.node", function (err, files) {
if (err) {
console.error("Error finding .node files:", err);
} else {
files.forEach(function (file) {
const src = path.resolve(__dirname, file);
const dest = path.join(destDirectory, path.basename(file));
fs.renameSync(src, dest);
});
}
});