innosetup-compiler
Advanced tools
Comparing version 6.0.3 to 6.2.0
@@ -7,4 +7,4 @@ Inno Setup License | ||
Copyright (C) 1997-2019 Jordan Russell. All rights reserved. | ||
Portions Copyright (C) 2000-2019 Martijn Laan. All rights reserved. | ||
Copyright (C) 1997-2021 Jordan Russell. All rights reserved. | ||
Portions Copyright (C) 2000-2021 Martijn Laan. All rights reserved. | ||
@@ -32,3 +32,3 @@ This software is provided "as-is," without any express or implied warranty. In no event shall the | ||
Jordan Russell | ||
jr-2010 AT jrsoftware.org | ||
http://www.jrsoftware.org/ | ||
jr-2020 AT jrsoftware.org | ||
https://jrsoftware.org/ |
130
lib/iscc.js
'use strict'; | ||
var path = require('path'); | ||
var spawn = require('child_process').spawn; | ||
const path = require('path'); | ||
const spawn = require('child_process').spawn; | ||
module.exports = function(scriptPath, options, callback) { | ||
var cmdLine, args; | ||
if (options && options.gui) { | ||
cmdLine = path.resolve(__dirname, '..', 'bin', 'Compil32.exe'); | ||
args = ['/cc', scriptPath]; | ||
} else { | ||
cmdLine = path.resolve(__dirname, '..', 'bin', 'ISCC.exe'); | ||
args = [scriptPath]; | ||
if (!(options && options.verbose)) { | ||
args.push('/q'); | ||
} | ||
if (options && options.signtoolname && options.signtoolcommand) { | ||
args.push('/S' + options.signtoolname + '=' + options.signtoolcommand.replace(/['"]/g, '$q')); | ||
} | ||
} | ||
if (options) { | ||
//reset pre-processed options | ||
delete options.gui; | ||
delete options.verbose; | ||
delete options.signtoolname; | ||
delete options.signtoolcommand; | ||
//cycle all other options and add it to args | ||
Object.keys(options).forEach(function(key) { | ||
var val = options[key]; | ||
if(/^D/.test(key)) { | ||
args.push('/' + key + '=' + val); | ||
} else { | ||
args.push('/' + key + val); | ||
} | ||
}); | ||
} | ||
if (!/^win/.test(process.platform)) { | ||
args.unshift(cmdLine); | ||
cmdLine = "wine"; | ||
} | ||
var child = spawn(cmdLine, args); | ||
child.stdout.pipe(process.stdout); | ||
child.stderr.pipe(process.stderr); | ||
var stderr = ''; | ||
child.on('error', function(err) { | ||
if (callback) { | ||
callback(err); | ||
} | ||
}); | ||
child.stderr.on('data', function(data) { | ||
stderr += data; | ||
}); | ||
child.on('close', function(code) { | ||
if (code === 0) { | ||
if (callback) { | ||
callback(null); | ||
} | ||
} else { | ||
if (callback) { | ||
callback(stderr); | ||
} | ||
} | ||
}); | ||
const promise = new Promise(function(resolve, reject) { | ||
try { | ||
let cmdLine, args; | ||
if (options && options.gui) { | ||
cmdLine = path.resolve(__dirname, '..', 'bin', 'Compil32.exe'); | ||
args = ['/cc', scriptPath]; | ||
} else { | ||
cmdLine = path.resolve(__dirname, '..', 'bin', 'ISCC.exe'); | ||
args = [scriptPath]; | ||
if (!(options && options.verbose)) { | ||
args.push('/q'); | ||
} | ||
if (options && options.signtoolname && options.signtoolcommand) { | ||
args.push('/S' + options.signtoolname + '=' + options.signtoolcommand.replace(/['"]/g, '$q')); | ||
} | ||
} | ||
if (options) { | ||
//reset pre-processed options | ||
delete options.gui; | ||
delete options.verbose; | ||
delete options.signtoolname; | ||
delete options.signtoolcommand; | ||
//cycle all other options and add it to args | ||
Object.keys(options).forEach(function(key) { | ||
let val = options[key]; | ||
if(/^D/.test(key)) { | ||
args.push('/' + key + '=' + val); | ||
} else { | ||
args.push('/' + key + val); | ||
} | ||
}); | ||
} | ||
if (!/^win/.test(process.platform)) { | ||
args.unshift(cmdLine); | ||
cmdLine = "wine"; | ||
} | ||
const child = spawn(cmdLine, args); | ||
child.stdout.pipe(process.stdout); | ||
child.stderr.pipe(process.stderr); | ||
let stderr = ''; | ||
child.on('error', reject); | ||
child.stderr.on('data', function(data) { | ||
stderr += data; | ||
}); | ||
child.on('close', function(code) { | ||
if (code === 0) { | ||
resolve(); | ||
} else { | ||
reject(stderr); | ||
} | ||
}); | ||
} catch(error) { | ||
reject(error); | ||
} | ||
}); | ||
if (callback) { | ||
return promise.then(callback).catch(callback); | ||
} | ||
return promise; | ||
}; |
{ | ||
"name": "innosetup-compiler", | ||
"version": "6.0.3", | ||
"version": "6.2.0", | ||
"description": "Node wrapper to compile inno setup scripts (.iss)", | ||
@@ -5,0 +5,0 @@ "main": "lib/iscc.js", |
@@ -56,2 +56,26 @@ node-innosetup-compiler | ||
Or using promise | ||
```javascript | ||
require("innosetup-compiler")("path/to/your/innoscript.iss", { | ||
gui: false, | ||
verbose: false, | ||
signtoolname: 'signtool', | ||
signtoolcommand: '"path/to/signtool.exe" sign /f "C:\\absolute\\path\\to\\mycertificate.pfx" /t http://timestamp.globalsign.com/scripts/timstamp.dll /p "MY_PASSWORD" $f' | ||
}).then(callback).catch(callback); | ||
``` | ||
Or async | ||
```javascript | ||
try { | ||
await require("innosetup-compiler")("path/to/your/innoscript.iss", { | ||
gui: false, | ||
verbose: false, | ||
signtoolname: 'signtool', | ||
signtoolcommand: '"path/to/signtool.exe" sign /f "C:\\absolute\\path\\to\\mycertificate.pfx" /t http://timestamp.globalsign.com/scripts/timstamp.dll /p "MY_PASSWORD" $f' | ||
}); | ||
} catch(error) { | ||
console.log(error); | ||
} | ||
``` | ||
##### Grunt | ||
@@ -58,0 +82,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
15630410
61
102
168