1 | "use strict";
|
2 | const awaiter_1 = require("./awaiter");
|
3 | const bluebird_1 = require("bluebird");
|
4 | const path = require("path");
|
5 | const packager = require("electron-packager-tf");
|
6 | const __awaiter = awaiter_1.tsAwaiter;
|
7 | Array.isArray(__awaiter);
|
8 | class PlatformPackager {
|
9 | constructor(info) {
|
10 | this.info = info;
|
11 | this.options = info.options;
|
12 | this.projectDir = info.projectDir;
|
13 | this.metadata = info.metadata;
|
14 | this.devMetadata = info.devMetadata;
|
15 | if (this.options.dist) {
|
16 | const buildMetadata = info.devMetadata.build;
|
17 | this.customDistOptions = buildMetadata == null ? buildMetadata : buildMetadata[this.getBuildConfigurationKey()];
|
18 | }
|
19 | }
|
20 | dispatchArtifactCreated(path) {
|
21 | this.info.eventEmitter.emit("artifactCreated", path);
|
22 | }
|
23 | pack(platform, arch, outDir) {
|
24 | return new bluebird_1.Promise((resolve, reject) => {
|
25 | const version = this.metadata.version;
|
26 | let buildVersion = version;
|
27 | const buildNumber = process.env.TRAVIS_BUILD_NUMBER || process.env.APPVEYOR_BUILD_NUMBER || process.env.CIRCLE_BUILD_NUM;
|
28 | if (buildNumber != null) {
|
29 | buildVersion += "." + buildNumber;
|
30 | }
|
31 | const options = Object.assign({
|
32 | dir: this.info.appDir,
|
33 | out: path.dirname(outDir),
|
34 | name: this.metadata.name,
|
35 | platform: platform,
|
36 | arch: arch,
|
37 | version: this.info.electronVersion,
|
38 | icon: path.join(this.projectDir, "build", "icon"),
|
39 | asar: true,
|
40 | overwrite: true,
|
41 | "app-version": version,
|
42 | "build-version": buildVersion,
|
43 | "version-string": {
|
44 | CompanyName: this.metadata.author,
|
45 | FileDescription: this.metadata.description,
|
46 | ProductVersion: version,
|
47 | FileVersion: buildVersion,
|
48 | ProductName: this.metadata.name,
|
49 | InternalName: this.metadata.name,
|
50 | }
|
51 | }, this.metadata.build, { "tmpdir": false });
|
52 | delete options.iconUrl;
|
53 | packager(options, error => error == null ? resolve(null) : reject(error));
|
54 | });
|
55 | }
|
56 | }
|
57 | exports.PlatformPackager = PlatformPackager;
|
58 |
|
\ | No newline at end of file |