Append Installer Icon to User Build Settings for Custom Builds (#45)
diff --git a/bin/templates/cordova/lib/build.js b/bin/templates/cordova/lib/build.js
index 277930b..66283ce 100644
--- a/bin/templates/cordova/lib/build.js
+++ b/bin/templates/cordova/lib/build.js
@@ -98,6 +98,10 @@
target: []
};
+ // Apply custom app installer icon when the user is using a custom build configuration
+ // eslint-disable-next-line no-template-curly-in-string
+ userBuildSettings.config[platform].icon = '${APP_INSTALLER_ICON}';
+
// Only macOS has a build type distinction. (development or distribution)
// eslint-disable-next-line no-template-curly-in-string
if (platform === 'mac') userBuildSettings.config[platform].type = '${BUILD_TYPE}';
diff --git a/tests/spec/unit/templates/cordova/lib/build.spec.js b/tests/spec/unit/templates/cordova/lib/build.spec.js
index b8d61d6..399212e 100644
--- a/tests/spec/unit/templates/cordova/lib/build.spec.js
+++ b/tests/spec/unit/templates/cordova/lib/build.spec.js
@@ -225,13 +225,15 @@
{ target: 'package', arch: 'arch' },
{ target: 'package2', arch: 'arch' }
],
- type: '${BUILD_TYPE}'
+ type: '${BUILD_TYPE}',
+ icon: '${APP_INSTALLER_ICON}'
};
const expectedLinux = {
target: [
{ target: 'package', arch: 'arch' },
{ target: 'package2', arch: 'arch' }
- ]
+ ],
+ icon: '${APP_INSTALLER_ICON}'
};
expect(electronBuilder.userBuildSettings.config.mac).toEqual(expectedMac);
@@ -358,13 +360,15 @@
{ target: 'package', arch: 'arch' },
{ target: 'package2', arch: 'arch' }
],
- type: '${BUILD_TYPE}'
+ type: '${BUILD_TYPE}',
+ icon: '${APP_INSTALLER_ICON}'
};
const expectedLinux = {
target: [
{ target: 'package', arch: 'arch' },
{ target: 'package2', arch: 'arch' }
- ]
+ ],
+ icon: '${APP_INSTALLER_ICON}'
};
expect(electronBuilder.userBuildSettings.config.mac).toEqual(expectedMac);
@@ -408,7 +412,6 @@
electronBuilder = new ElectronBuilder(buildOptions, api).configureUserBuildSettings();
expect(existsSyncSpy).toHaveBeenCalled();
- // expect(requireSpy).toHaveBeenCalled();
const expected = {
linux: [],
@@ -416,6 +419,7 @@
win: [],
config: {
linux: {
+ icon: '${APP_INSTALLER_ICON}',
target: [
{
target: 'tar.gz',
@@ -425,6 +429,7 @@
},
mac: {
type: '${BUILD_TYPE}',
+ icon: '${APP_INSTALLER_ICON}',
target: [
{
target: 'dmg',
@@ -437,6 +442,7 @@
]
},
win: {
+ icon: '${APP_INSTALLER_ICON}',
target: [
{
target: 'nsis',
@@ -515,13 +521,15 @@
{ target: 'package', arch: [ 'x64' ] },
{ target: 'package2', arch: [ 'x64' ] }
],
- type: '${BUILD_TYPE}'
+ type: '${BUILD_TYPE}',
+ icon: '${APP_INSTALLER_ICON}'
};
const expectedLinux = {
target: [
{ target: 'package', arch: [ 'x64' ] },
{ target: 'package2', arch: [ 'x64' ] }
- ]
+ ],
+ icon: '${APP_INSTALLER_ICON}'
};
expect(electronBuilder.userBuildSettings.config.mac).toEqual(expectedMac);
@@ -567,13 +575,15 @@
{ target: 'package', arch: 'arch' },
{ target: 'package2', arch: 'arch' }
],
- type: '${BUILD_TYPE}'
+ type: '${BUILD_TYPE}',
+ icon: '${APP_INSTALLER_ICON}'
};
const expectedLinux = {
target: [
{ target: 'package', arch: 'arch' },
{ target: 'package2', arch: 'arch' }
- ]
+ ],
+ icon: '${APP_INSTALLER_ICON}'
};
expect(electronBuilder.userBuildSettings.config.mac).toEqual(expectedMac);
@@ -680,7 +690,8 @@
target: [
{ target: 'mas', arch: 'arch' },
{ target: 'package2', arch: 'arch' }
- ]
+ ],
+ icon: '${APP_INSTALLER_ICON}'
};
expect(electronBuilder.userBuildSettings.config.mac).toEqual(undefined);