forked from nrkno/sofie-media-management
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcopy-natives.js
32 lines (27 loc) · 945 Bytes
/
copy-natives.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
const find = require('find');
const os = require('os')
const path = require('path')
const fs = require('fs-extra')
const arch = os.arch()
const platform = os.platform()
const prebuildType = process.argv[2] || `${platform}-${arch}`
function isFileForPlatform(filename) {
if (filename.indexOf(path.join('prebuilds', prebuildType)) !== -1) {
return true
} else {
return false
}
}
console.log('Running in', __dirname, 'for', prebuildType)
console.log(process.argv[2])
find.file(/\.node$/, path.join(__dirname, 'node_modules'), (files) => {
files.forEach(fullPath => {
if (fullPath.indexOf(__dirname) === 0) {
const file = fullPath.substr(__dirname.length + 1)
if (isFileForPlatform(file)) {
console.log('copy prebuild binary:', file)
fs.copySync(file, path.join('deploy', file.substr(file.indexOf('prebuilds'))))
}
}
});
})