-
Notifications
You must be signed in to change notification settings - Fork 39
/
index.js
43 lines (37 loc) · 920 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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
var generateXml = require('./generate-xml')
var execFile = require('child_process').execFile
var temp = require("temp").track()
var fs = require('fs')
module.exports = function(options, cb) {
// options:
// source
// output
// name
// upgradeCode
// version
// manufacturer
// arch
// iconPath
// executable
// localInstall
writeXml(options, function (err, path) {
var args = [path, '-o', options.output]
if (options.arch) {
args.push('--arch', options.arch)
}
execFile('wixl', args, cb)
})
}
function writeXml(options, cb) {
temp.open('msi-packager', function(err, info) {
generateXml(options, function(err, xml) {
fs.write(info.fd, xml, function(err) {
if (err) return cb(err)
fs.close(info.fd, function (err) {
if (err) return cb(err)
return cb(null, info.path)
})
})
})
})
}