From 33c6b19f8beda73e464d203c4e7ad7888f9a278c Mon Sep 17 00:00:00 2001 From: Bartosz Wojtkowiak Date: Fri, 21 Dec 2018 13:33:41 +0100 Subject: [PATCH] Fix mas build --- .travis.yml | 4 ++-- appveyor.yml | 4 ++-- lib/defaultDependencies.js | 6 +++--- lib/electronBuilder.js | 15 ++++++++++++++- lib/index.js | 2 +- 5 files changed, 22 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index 530a1fc9..f4626666 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,9 +6,9 @@ os: env: - TEST=normal NODE_VERSION=8 - - TEST=normal NODE_VERSION=9 + - TEST=normal NODE_VERSION=10 - TEST=integration NODE_VERSION=8 - - TEST=integration NODE_VERSION=9 + - TEST=integration NODE_VERSION=10 before_install: - nvm install $NODE_VERSION diff --git a/appveyor.yml b/appveyor.yml index 599ae49c..8fd68f44 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -12,10 +12,10 @@ environment: - nodejs_version: "8" test: "integration" platform: x64 - - nodejs_version: "9" + - nodejs_version: "10" test: "integration" platform: x64 - - nodejs_version: "9" + - nodejs_version: "10" test: "normal" platform: x64 diff --git a/lib/defaultDependencies.js b/lib/defaultDependencies.js index 4a60c5da..49d69720 100644 --- a/lib/defaultDependencies.js +++ b/lib/defaultDependencies.js @@ -1,6 +1,6 @@ module.exports = { - electron: '2.0.10', - 'electron-builder': '20.28.4', - 'electron-packager': '12.1.2' + electron: '2.0.16', + 'electron-builder': '20.38.4', + 'electron-packager': '12.2.0' }; diff --git a/lib/electronBuilder.js b/lib/electronBuilder.js index 138375d1..c47ea38b 100644 --- a/lib/electronBuilder.js +++ b/lib/electronBuilder.js @@ -47,6 +47,7 @@ export default class InstallerBuilder { this.lastRebuild = {}; this.currentContext = null; this.installerDir = path.join(this.$.env.options.output, this.$.env.paths.installerDir); + this.platforms = []; } async init() { @@ -66,7 +67,8 @@ export default class InstallerBuilder { * @returns {Object} */ prepareLastRebuildObject(arch, platform = process.platform) { - const productionDeps = this.packageDependencies.createLazyProductionDeps(this.$.env.paths.electronApp.root); + const productionDeps = this.packageDependencies + .createLazyProductionDeps(this.$.env.paths.electronApp.root); this.lastRebuild = { frameworkInfo: { version: this.$.getElectronVersion(), useCustomDist: true }, platform, @@ -142,6 +144,11 @@ export default class InstallerBuilder { * @returns {Promise} */ afterPack(context) { + this.platforms = this.platforms + .filter(platform => platform !== context.electronPlatformName); + if (this.platforms.length !== 0) { + return Promise.resovle(); + } return new Promise((resolve, reject) => { shell.config.fatal = true; @@ -329,6 +336,12 @@ export default class InstallerBuilder { output: path.join(this.$.env.options.output, this.$.env.paths.installerDir) }; + if ('mac' in builderOptions && 'target' in builderOptions.mac) { + if (builderOptions.mac.target.includes('mas')) { + this.platforms = ['darwin', 'mas']; + } + } + try { this.log.debug('calling build from electron-builder'); await this.builder.dependency.build(Object.assign({ diff --git a/lib/index.js b/lib/index.js index f72a23a6..7fef071c 100644 --- a/lib/index.js +++ b/lib/index.js @@ -151,7 +151,7 @@ class MeteorDesktop { const { dependencies = {}, devDependencies = {} } = JSON.parse( fs.readFileSync(path.join(this.env.paths.meteorApp.root, 'package.json'), 'UTF-8') ); - if (!( name in dependencies ) && !( name in devDependencies )) { + if (!(name in dependencies) && !(name in devDependencies)) { await this.meteorApp.runNpm(['i', '-D', '-E', '--only=dev', `${name}@${version}`], 'inherit'); } } catch (e) {