electron-installer-codesign
Advanced tools
Comparing version 0.3.2 to 0.4.0
96
index.js
@@ -10,2 +10,3 @@ /* eslint no-console:0 */ | ||
var figures = require('figures'); | ||
var sign = require('electron-osx-sign'); | ||
var debug = require('debug')('electron-installer-codesign'); | ||
@@ -34,14 +35,7 @@ | ||
function runCodesign(src, opts, fn) { | ||
var args = [ | ||
'-s', | ||
opts.identity, | ||
'-vvv', | ||
'--deep', | ||
'--force', | ||
'--options', | ||
'runtime', | ||
src | ||
]; | ||
run('codesign', args, function(err) { | ||
sign({ | ||
app: src, | ||
hardenedRuntime: true, | ||
identity: opts.identity | ||
}, (err) => { | ||
if (err) { | ||
@@ -53,3 +47,3 @@ fn(new Error('codesign failed ' + path.basename(src) | ||
fn(null, src); | ||
}); | ||
}) | ||
} | ||
@@ -72,58 +66,5 @@ | ||
function _filterFiles(files, fn) { | ||
async.parallel(files.map(function(file) { | ||
return function(cb) { | ||
fs.lstat(file, function(err, stat) { | ||
if (err) { | ||
return cb(err); | ||
} | ||
if (!stat.isFile()) { | ||
return cb(null, null); | ||
} | ||
/** | ||
* @durran: Allow only the Electron symlink to not get skipped. | ||
* @see: COMPASS-101. | ||
*/ | ||
if (stat.isSymbolicLink() && file.indexOf('Electron') > -1) { | ||
return cb(null, file); | ||
} | ||
if (stat.isSymbolicLink() && file.indexOf('Contents/MacOS') > -1) { | ||
return cb(null, null); | ||
} | ||
cb(null, file); | ||
}); | ||
}; | ||
}), function(_err, _files) { | ||
if (_err) { | ||
return fn(_err); | ||
} | ||
fn(null, _files.filter(function(f) { | ||
return f !== null; | ||
})); | ||
}); | ||
} | ||
function _collectFiles(pattern, opts, fn) { | ||
glob.glob(pattern, function(err, files) { | ||
if (err) { | ||
return fn(err); | ||
} | ||
if (files.length === 0) { | ||
return fn(new Error('No files found for ' | ||
+ opts.appPath + '/' + pattern)); | ||
} | ||
fn(null, files); | ||
}); | ||
} | ||
function codesign(pattern, opts, fn) { | ||
async.waterfall([ | ||
function(cb) { | ||
_collectFiles(pattern, opts, cb); | ||
}, | ||
function(files, cb) { | ||
_filterFiles(files, cb); | ||
}, | ||
function(files, cb) { | ||
_signAll(files, opts, cb); | ||
@@ -134,18 +75,2 @@ } | ||
function verify(src, fn) { | ||
debug('verifying signature on `%s`...', src); | ||
var args = [ | ||
'--verify', | ||
'-vvv', | ||
src | ||
]; | ||
run('codesign', args, function(err) { | ||
if (err) { | ||
return fn(err); | ||
} | ||
fn(null, src); | ||
}); | ||
} | ||
/** | ||
@@ -179,7 +104,3 @@ * @param {String} commonName | ||
cleanup.bind(null, opts), | ||
codesign.bind(null, opts.appPath + '/Contents/Frameworks/*', opts), | ||
codesign.bind(null, opts.appPath + '/Contents/MacOS/*', opts), | ||
codesign.bind(null, opts.appPath + '/Contents/Resources/*', opts), | ||
codesign.bind(null, opts.appPath, opts), | ||
verify.bind(null, opts.appPath) | ||
codesign.bind(null, opts.appPath, opts) | ||
], done); | ||
@@ -190,3 +111,2 @@ }; | ||
module.exports.codesign = codesign; | ||
module.exports.verify = verify; | ||
@@ -193,0 +113,0 @@ module.exports.printWarning = function() { |
{ | ||
"name": "electron-installer-codesign", | ||
"description": "Sign your electron apps on OSX.", | ||
"version": "0.3.2", | ||
"version": "0.4.0", | ||
"author": "Lucas Hrabovsky <lucas@mongodb.com> (http://imlucas.com)", | ||
@@ -29,2 +29,3 @@ "homepage": "http://github.com/mongodb-js/electron-installer-codesign", | ||
"electron-installer-run": "^0.1.0", | ||
"electron-osx-sign": "^0.4.16", | ||
"figures": "^2.0.0", | ||
@@ -31,0 +32,0 @@ "glob": "^7.1.1", |
18523
9
143
+ Addedelectron-osx-sign@^0.4.16
+ Added@xmldom/xmldom@0.8.10(transitive)
+ Addedbase64-js@1.5.1(transitive)
+ Addedbluebird@3.7.2(transitive)
+ Addedbuffer-alloc@1.2.0(transitive)
+ Addedbuffer-alloc-unsafe@1.1.0(transitive)
+ Addedbuffer-fill@1.0.0(transitive)
+ Addedcompare-version@0.1.2(transitive)
+ Addedelectron-osx-sign@0.4.17(transitive)
+ Addedisbinaryfile@3.0.3(transitive)
+ Addedplist@3.1.0(transitive)
+ Addedxmlbuilder@15.1.1(transitive)