-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathinstall-bindings.js
More file actions
26 lines (26 loc) · 956 Bytes
/
install-bindings.js
File metadata and controls
26 lines (26 loc) · 956 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
#!/usr/bin/env node
const globby = require('globby');
var path=require('path');
var fs = require('fs');
let re = new RegExp('../bindings-.*/node_modules/(.*)/lib/binding/(.*)/(.*).node', '');
(async () => {
var filez = await globby('../bindings-*/node_modules/**/lib/binding/*/*.node');
filez.forEach(f => {
console.log(`Found ${f}`);
dest = f.replace(re, 'node_modules/$1/lib/binding/$2/$3.node');
parent = path.dirname(dest);
console.log(`Moving ${f}`);
console.log(` to ${dest}`);
fs.mkdirSync(parent, {recursive: true});
fs.renameSync(f, dest);
});
})();
(async () => {
var filez = await globby('node_modules/**/build/Release/*.node');
filez.forEach(f => {
dest = f.replace(re, 'node_modules/$1/lib/binding/$2/$3.node');
parent = path.dirname(dest);;
console.log(`Deleting ${parent}`);
fs.rmdirSync(parent, {recursive: true});
});
})();