diff --git a/README.md b/README.md index 6062517..bd06975 100644 --- a/README.md +++ b/README.md @@ -173,9 +173,10 @@ Default to `true`. The keychain name. Default to system default keychain. -`ignore` - *String* +`ignore` - *RegExp|Function|Array.<(RegExp|Function)>* -Regex or function that signals ignoring a file before signing. +Regex, function or an array of regex's and functions that signal to skip signing a file. +Elements of other types are converted to `RegExp` automatically. Default to `undefined`. `platform` - *String* diff --git a/bin/electron-osx-sign-usage.txt b/bin/electron-osx-sign-usage.txt index dae0bdd..0b587c1 100644 --- a/bin/electron-osx-sign-usage.txt +++ b/bin/electron-osx-sign-usage.txt @@ -35,8 +35,8 @@ DESCRIPTION --identity-validation, --no-identity-validation Flag to enable/disable validation for the signing identity. - --ignore=regex - Regex that signals ignoring a file before signing. + --ignore=path + Path to skip signing. --keychain=keychain The keychain name. diff --git a/sign.js b/sign.js index baaa1f4..fd68db8 100644 --- a/sign.js +++ b/sign.js @@ -49,8 +49,8 @@ function validateOptsBinariesAsync (opts) { * @returns {Promise} Promise. */ function validateSignOptsAsync (opts) { - if (opts.ignore) { - if (typeof opts.ignore !== 'function' && typeof opts.ignore !== 'string') return Promise.reject(new Error('Ignore filter should be either a function or a string.')) + if (opts.ignore && !(opts.ignore instanceof Array)) { + opts.ignore = [opts.ignore] } if (opts['provisioning-profile']) { @@ -122,11 +122,12 @@ function signApplicationAsync (opts) { .then(function (childPaths) { function ignoreFilePath (opts, filePath) { if (opts.ignore) { - if (typeof opts.ignore === 'function') { - return opts.ignore(filePath) - } else if (typeof opts.ignore === 'string') { - return filePath.match(opts.ignore) - } + return opts.ignore.some(function (ignore) { + if (typeof opts.ignore === 'function') { + return ignore(filePath) + } + return filePath.match(ignore) + }) } return false }