Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: support executableName in main config #7828

Merged
merged 1 commit into from
Oct 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/mean-baboons-report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"app-builder-lib": minor
---

fix: support executableName in main config
4 changes: 3 additions & 1 deletion packages/app-builder-lib/src/appInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ export class AppInfo {

this.productName = info.config.productName || info.metadata.productName || info.metadata.name!
this.sanitizedProductName = sanitizeFileName(this.productName)
this.productFilename = platformSpecificOptions?.executableName != null ? sanitizeFileName(platformSpecificOptions.executableName) : this.sanitizedProductName

const executableName = platformSpecificOptions?.executableName ?? info.config.executableName
this.productFilename = executableName != null ? sanitizeFileName(executableName) : this.sanitizedProductName
}

get channel(): string | null {
Expand Down
2 changes: 1 addition & 1 deletion packages/app-builder-lib/src/linuxPackager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export class LinuxPackager extends PlatformPackager<LinuxConfiguration> {
constructor(info: Packager) {
super(info, Platform.LINUX)

const executableName = this.platformSpecificBuildOptions.executableName
const executableName = this.platformSpecificBuildOptions.executableName ?? info.config.executableName
this.executableName = executableName == null ? this.appInfo.sanitizedName.toLowerCase() : sanitizeFileName(executableName)
}

Expand Down
88 changes: 88 additions & 0 deletions test/snapshots/linux/debTest.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -655,3 +655,91 @@ Object {
`;

exports[`no quotes for safe exec name 5`] = `"Test Application (test quite “ #378)"`;

exports[`top-level exec name 1`] = `
Object {
"linux": Array [
Object {
"arch": "x64",
"file": "TestApp_1.1.0_amd64.deb",
},
],
}
`;

exports[`top-level exec name 2`] = `
Array [
"/",
"/opt/",
"/usr/",
"/opt/foo/",
"/opt/foo/Boo",
"/opt/foo/chrome-sandbox",
"/opt/foo/chrome_100_percent.pak",
"/opt/foo/chrome_200_percent.pak",
"/opt/foo/chrome_crashpad_handler",
"/opt/foo/icudtl.dat",
"/opt/foo/libEGL.so",
"/opt/foo/libffmpeg.so",
"/opt/foo/libGLESv2.so",
"/opt/foo/libvk_swiftshader.so",
"/opt/foo/libvulkan.so.1",
"/opt/foo/LICENSE.electron.txt",
"/opt/foo/LICENSES.chromium.html",
"/opt/foo/resources.pak",
"/opt/foo/snapshot_blob.bin",
"/opt/foo/v8_context_snapshot.bin",
"/opt/foo/vk_swiftshader_icd.json",
"/usr/share/",
"/opt/foo/resources/",
"/opt/foo/resources/app.asar",
"/opt/foo/swiftshader/",
"/opt/foo/swiftshader/libEGL.so",
"/opt/foo/swiftshader/libGLESv2.so",
"/usr/share/applications/",
"/usr/share/applications/Boo.desktop",
"/usr/share/doc/",
"/usr/share/icons/",
"/usr/share/doc/testapp/",
"/usr/share/doc/testapp/changelog.gz",
"/usr/share/icons/hicolor/",
"/usr/share/icons/hicolor/128x128/",
"/usr/share/icons/hicolor/16x16/",
"/usr/share/icons/hicolor/256x256/",
"/usr/share/icons/hicolor/32x32/",
"/usr/share/icons/hicolor/48x48/",
"/usr/share/icons/hicolor/512x512/",
"/usr/share/icons/hicolor/64x64/",
"/usr/share/icons/hicolor/128x128/apps/",
"/usr/share/icons/hicolor/128x128/apps/Boo.png",
"/usr/share/icons/hicolor/16x16/apps/",
"/usr/share/icons/hicolor/16x16/apps/Boo.png",
"/usr/share/icons/hicolor/256x256/apps/",
"/usr/share/icons/hicolor/256x256/apps/Boo.png",
"/usr/share/icons/hicolor/32x32/apps/",
"/usr/share/icons/hicolor/32x32/apps/Boo.png",
"/usr/share/icons/hicolor/48x48/apps/",
"/usr/share/icons/hicolor/48x48/apps/Boo.png",
"/usr/share/icons/hicolor/512x512/apps/",
"/usr/share/icons/hicolor/512x512/apps/Boo.png",
"/usr/share/icons/hicolor/64x64/apps/",
"/usr/share/icons/hicolor/64x64/apps/Boo.png",
]
`;

exports[`top-level exec name 3`] = `
Object {
"Architecture": "amd64",
"Depends": "libgtk-3-0, libnotify4, libnss3, libxss1, libxtst6, xdg-utils, libatspi2.0-0, libuuid1, libsecret-1-0",
"Homepage": "http://foo.example.com",
"License": "MIT",
"Maintainer": "Foo Bar <foo@example.com>",
"Package": "testapp",
"Priority": "optional",
"Recommends": "libappindicator3-1",
"Section": "devel",
"Vendor": "Foo Bar <foo@example.com>",
}
`;

exports[`top-level exec name 4`] = `"Test Application (test quite “ #378)"`;
42 changes: 42 additions & 0 deletions test/snapshots/windows/oneClickInstallerTest.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -392,3 +392,45 @@ Object {
],
}
`;

exports[`top-level custom exec name 1`] = `
Object {
"APP_32_NAME": undefined,
"APP_64_NAME": "TestApp-1.1.0-x64.nsis.7z",
"APP_ARM64_NAME": undefined,
"APP_FILENAME": "TestApp",
"APP_ID": "org.electron-builder.testApp",
"APP_PACKAGE_NAME": "TestApp",
"APP_PRODUCT_FILENAME": "Boo",
"COMPANY_NAME": "Foo Bar",
"ONE_CLICK": null,
"PRODUCT_FILENAME": "Boo",
"PRODUCT_NAME": "foo",
"SHORTCUT_NAME": "foo",
"UNINSTALL_DISPLAY_NAME": "foo 1.1.0",
}
`;

exports[`top-level custom exec name 2`] = `
Object {
"win": Array [
Object {
"arch": "x64",
"file": "foo Setup 1.1.0.exe",
"safeArtifactName": "foo-Setup-1.1.0.exe",
"updateInfo": Object {
"sha512": "@sha512",
"size": "@size",
},
},
Object {
"file": "foo Setup 1.1.0.exe.blockmap",
"safeArtifactName": "foo-Setup-1.1.0.exe.blockmap",
"updateInfo": Object {
"sha512": "@sha512",
"size": "@size",
},
},
],
}
`;
11 changes: 11 additions & 0 deletions test/src/linux/debTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,17 @@ test.ifNotWindows(
})
)

test.ifNotWindows(
"top-level exec name",
app({
targets: Platform.LINUX.createTarget("deb"),
config: {
productName: "foo",
executableName: "Boo",
},
})
)

test.ifNotWindows(
"no quotes for safe exec name",
app({
Expand Down
16 changes: 16 additions & 0 deletions test/src/windows/oneClickInstallerTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -339,3 +339,19 @@ test.skip.ifWindows(
},
})
)

test.skip.ifWindows(
"top-level custom exec name",
app({
targets: nsisTarget,
config: {
publish: null,
productName: "foo",
executableName: "Boo",
},
effectiveOptionComputed: async it => {
expect(pickSnapshotDefines(it[0])).toMatchSnapshot()
return false
},
})
)