From fd8991aa219b54f68139579adec26027590070cd Mon Sep 17 00:00:00 2001 From: develar Date: Wed, 12 Jul 2017 12:53:17 +0200 Subject: [PATCH 1/2] remove tempfile dependency MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reduce node_modules size — use the same approach to generate temp file as electron-builder/electron-download --- package.json | 19 +++++++++---------- util-entitlements.js | 6 ++++-- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/package.json b/package.json index a0e0af7..1e46dbb 100644 --- a/package.json +++ b/package.json @@ -18,25 +18,24 @@ }, "homepage": "https://github.com/electron-userland/electron-osx-sign", "dependencies": { - "bluebird": "^3.4.7", + "bluebird": "^3.5.0", "compare-version": "^0.1.2", - "debug": "^2.6.1", + "debug": "^2.6.8", "isbinaryfile": "^3.0.2", "minimist": "^1.2.0", - "plist": "^2.0.1", - "tempfile": "^1.1.1" + "plist": "^2.1.0" }, "devDependencies": { - "electron-download": "^4.0.0", - "eslint": "^3.16.1", + "electron-download": "^4.1.0", + "eslint": "^4.2.0", "eslint-config-eslint": "^4.0.0", - "extract-zip": "^1.6.0", + "extract-zip": "^1.6.5", "mkdirp": "^0.5.1", "rimraf": "^2.6.1", "run-series": "^1.1.4", "run-waterfall": "^1.1.3", - "standard": "^8.6.0", - "tape": "^4.6.3" + "standard": "^10.0.2", + "tape": "^4.7.0" }, "scripts": { "code-standard": "standard", @@ -49,6 +48,6 @@ ] }, "engines": { - "node": ">=0.4.0" + "node": ">=4.0.0" } } diff --git a/util-entitlements.js b/util-entitlements.js index c294ff8..1a7907a 100644 --- a/util-entitlements.js +++ b/util-entitlements.js @@ -7,7 +7,7 @@ const path = require('path') const plist = require('plist') -const tempfile = require('tempfile') +const os = require('os') const util = require('./util') const debuglog = util.debuglog @@ -15,6 +15,8 @@ const getAppContentsPath = util.getAppContentsPath const readFileAsync = util.readFileAsync const writeFileAsync = util.writeFileAsync +let tmpFileCounter = 0 + /** * This function returns a promise completing the entitlements automation: The process includes checking in `Info.plist` for `ElectronTeamID` or setting parsed value from identity, and checking in entitlements file for `com.apple.security.application-groups` or inserting new into array. A temporary entitlements file may be created to replace the input for any changes introduced. * @function @@ -88,7 +90,7 @@ module.exports.preAutoEntitlements = function (opts) { debuglog('`com.apple.security.application-groups` found in entitlements file: ' + appIdentifier) } // Create temporary entitlements file - var entitlementsPath = tempfile('.plist') + const entitlementsPath = path.join(os.tmpdir(), `tmp-entitlements-${process.pid.toString(16)}-${(tmpFileCounter++).toString(16)}.plist`) opts.entitlements = entitlementsPath return writeFileAsync(entitlementsPath, plist.build(entitlements), 'utf8') .then(function () { From 0ea7b7c97568859b26ef03254ec71c70d265f55e Mon Sep 17 00:00:00 2001 From: Zhuo Lu Date: Fri, 14 Jul 2017 23:20:19 +0800 Subject: [PATCH 2/2] Reorder os module --- util-entitlements.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util-entitlements.js b/util-entitlements.js index 1a7907a..505b241 100644 --- a/util-entitlements.js +++ b/util-entitlements.js @@ -4,10 +4,10 @@ 'use strict' +const os = require('os') const path = require('path') const plist = require('plist') -const os = require('os') const util = require('./util') const debuglog = util.debuglog