UNPKG

electron-complete-builder

Version:

Complete solution to build ready for distribution and 'auto update' Electron App installers

59 lines (57 loc) 2.22 kB
"use strict"; const awaiter_1 = require("./awaiter"); const bluebird_1 = require("bluebird"); const path = require("path"); const packager = require("electron-packager-tf"); const __awaiter = awaiter_1.tsAwaiter; Array.isArray(__awaiter); const pack = bluebird_1.Promise.promisify(packager); class PlatformPackager { constructor(info) { this.info = info; this.options = info.options; this.projectDir = info.projectDir; this.metadata = info.metadata; this.devMetadata = info.devMetadata; if (this.options.dist) { const buildMetadata = info.devMetadata.build; this.customDistOptions = buildMetadata == null ? buildMetadata : buildMetadata[this.getBuildConfigurationKey()]; } } dispatchArtifactCreated(path) { this.info.eventEmitter.emit("artifactCreated", path); } pack(platform, outDir, appOutDir) { const version = this.metadata.version; let buildVersion = version; const buildNumber = process.env.TRAVIS_BUILD_NUMBER || process.env.APPVEYOR_BUILD_NUMBER || process.env.CIRCLE_BUILD_NUM; if (buildNumber != null) { buildVersion += "." + buildNumber; } const options = Object.assign({ dir: this.info.appDir, out: outDir, name: this.metadata.name, platform: platform, arch: this.currentArch, version: this.info.electronVersion, icon: path.join(this.projectDir, "build", "icon"), asar: true, overwrite: true, "app-version": version, "build-version": buildVersion, "version-string": { CompanyName: this.metadata.author.name, FileDescription: this.metadata.description, ProductVersion: version, FileVersion: buildVersion, ProductName: this.metadata.name, InternalName: this.metadata.name } }, this.metadata.build, { "tmpdir": false }); delete options.iconUrl; return pack(options); } } exports.PlatformPackager = PlatformPackager; //# sourceMappingURL=platformPackager.js.map