-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.js
27 lines (22 loc) · 845 Bytes
/
index.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
let path = require('path')
function getPlatformInfo() {
if (/linux/.test(process.platform)) {
return 'linux'
} else if (/darwin/.test(process.platform)) {
return 'osx'
} else {
return 'windows'
}
}
module.exports.install = require('./lib/installer')
module.exports.initialize = function initialize(basedir, manifest){
var inf = manifest ? manifest : {}
var targetDir = process.env.PREBUILT_TARGET_DIR || inf.targetDir || './bin'
var targetBin = process.env.PREBUILT_BINARY || inf.targetBin
var paths = inf.paths
var platform = process.env.PREBUILT_PLATFORM || inf.platform || getPlatformInfo()
if (targetBin)
module.exports.binary = require(basedir + '/' + targetDir + '/' + targetBin);
if(paths)
module.exports.path = path.join(basedir, paths[platform])
}