diff --git a/packages/electron-builder/src/linuxPackager.ts b/packages/electron-builder/src/linuxPackager.ts index 80b9fffa3b5..224f3b0cd94 100755 --- a/packages/electron-builder/src/linuxPackager.ts +++ b/packages/electron-builder/src/linuxPackager.ts @@ -1,15 +1,15 @@ +import { Platform, Target } from "electron-builder-core" +import { rename } from "fs-extra-p" import * as path from "path" +import sanitizeFileName from "sanitize-filename" +import { LinuxBuildOptions } from "./options/linuxOptions" +import { BuildInfo } from "./packagerApi" import { PlatformPackager } from "./platformPackager" -import { Platform, Target } from "electron-builder-core" +import AppImageTarget from "./targets/appImage" import FpmTarget from "./targets/fpm" -import { createCommonTarget, DIR_TARGET } from "./targets/targetFactory" import { LinuxTargetHelper } from "./targets/LinuxTargetHelper" -import AppImageTarget from "./targets/appImage" -import { rename } from "fs-extra-p" -import { LinuxBuildOptions } from "./options/linuxOptions" -import sanitizeFileName from "sanitize-filename" import SnapTarget from "./targets/snap" -import { BuildInfo } from "./packagerApi" +import { createCommonTarget, DIR_TARGET } from "./targets/targetFactory" export class LinuxPackager extends PlatformPackager { readonly executableName: string @@ -18,7 +18,7 @@ export class LinuxPackager extends PlatformPackager { super(info) const executableName = this.platformSpecificBuildOptions.executableName - this.executableName = sanitizeFileName(executableName == null ? this.appInfo.name : executableName).toLowerCase() + this.executableName = sanitizeFileName(executableName == null ? this.appInfo.name.toLowerCase() : executableName) } get defaultTarget(): Array { diff --git a/test/out/__snapshots__/mainEntryTest.js.snap b/test/out/__snapshots__/mainEntryTest.js.snap new file mode 100644 index 00000000000..d8bcded748d --- /dev/null +++ b/test/out/__snapshots__/mainEntryTest.js.snap @@ -0,0 +1,7 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`invalid main in the app package.json (custom asar) 1`] = `"Application entry file \\"main.js\\" in the \\"/app.asar\\" does not exist. Seems like a wrong configuration."`; + +exports[`invalid main in the app package.json (no asar) 1`] = `"Application entry file \\"main.js\\" does not exist. Seems like a wrong configuration."`; + +exports[`invalid main in the app package.json 1`] = `"Application entry file \\"main.js\\" in the \\"/app.asar\\" does not exist. Seems like a wrong configuration."`; diff --git a/test/out/linux/__snapshots__/debTest.js.snap b/test/out/linux/__snapshots__/debTest.js.snap new file mode 100644 index 00000000000..12ee759de19 --- /dev/null +++ b/test/out/linux/__snapshots__/debTest.js.snap @@ -0,0 +1,25 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`arm deb 1`] = ` +Array [ + "TestApp_1.1.0_armv7l.deb", +] +`; + +exports[`custom depends 1`] = ` +"[Desktop Entry] +Name=Test App ßW +Comment=Test Application (test quite “ #378) +Exec=\\"/opt/Test App ßW/Boo\\" +Terminal=false +Type=Application +Icon=Boo +Categories=Development; +" +`; + +exports[`deb 1`] = ` +Array [ + "TestApp_1.1.0_amd64.deb", +] +`; diff --git a/test/out/linux/__snapshots__/fpmTest.js.snap b/test/out/linux/__snapshots__/fpmTest.js.snap new file mode 100644 index 00000000000..0e5497403f5 --- /dev/null +++ b/test/out/linux/__snapshots__/fpmTest.js.snap @@ -0,0 +1,18 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`rpm and tar.gz 1`] = ` +Array [ + "TestApp-1.1.0.rpm", + "TestApp-1.1.0.tar.gz", +] +`; + +exports[`targets 1`] = ` +Array [ + "TestApp-1.1.0.7z", + "TestApp-1.1.0.freebsd", + "TestApp-1.1.0.pacman", + "TestApp-1.1.0.sh", + "TestApp-1.1.0.zip", +] +`; diff --git a/test/out/linux/__snapshots__/linuxArchiveTest.js.snap b/test/out/linux/__snapshots__/linuxArchiveTest.js.snap new file mode 100644 index 00000000000..c18a5506aa6 --- /dev/null +++ b/test/out/linux/__snapshots__/linuxArchiveTest.js.snap @@ -0,0 +1,9 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`tar 1`] = ` +Array [ + "TestApp-1.1.0.tar.bz2", + "TestApp-1.1.0.tar.lz", + "TestApp-1.1.0.tar.xz", +] +`; diff --git a/test/out/linux/__snapshots__/linuxPackagerTest.js.snap b/test/out/linux/__snapshots__/linuxPackagerTest.js.snap new file mode 100644 index 00000000000..b856da6b77d --- /dev/null +++ b/test/out/linux/__snapshots__/linuxPackagerTest.js.snap @@ -0,0 +1,36 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AppImage - default icon, custom executable and custom desktop 1`] = ` +"[Desktop Entry] +Name=Test App ßW +Comment=Test Application (test quite “ #378) +Exec=AppRun +Terminal=true +Type=Application +Icon=Foo +Foo=bar +Categories=Development; +" +`; + +exports[`AppImage 1`] = ` +Array [ + "TestApp-1.1.0-x86_64.AppImage", +] +`; + +exports[`icons from ICNS 1`] = ` +Array [ + "TestApp-1.1.0-x86_64.AppImage", +] +`; + +exports[`no-author-email 1`] = ` +"Please specify author 'email' in the application package.json + +See https://docs.npmjs.com/files/package.json#people-fields-author-contributors + +It is required to set Linux .deb package maintainer. Or you can set maintainer in the custom linux options. +(see https://github.com/electron-userland/electron-builder#distributable-format-configuration). +" +`; diff --git a/test/out/linux/__snapshots__/snapTest.js.snap b/test/out/linux/__snapshots__/snapTest.js.snap new file mode 100644 index 00000000000..dfecd674dcc --- /dev/null +++ b/test/out/linux/__snapshots__/snapTest.js.snap @@ -0,0 +1,7 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`snap 1`] = ` +Array [ + "sep_1.1.0_amd64.snap", +] +`; diff --git a/test/src/linux/linuxPackagerTest.ts b/test/src/linux/linuxPackagerTest.ts index 48502084ac3..e3316c91df6 100755 --- a/test/src/linux/linuxPackagerTest.ts +++ b/test/src/linux/linuxPackagerTest.ts @@ -20,8 +20,7 @@ test.ifDevOrLinuxCi("AppImage - default icon, custom executable and custom deskt }, effectiveOptionComputed: async (it) => { const content = await readFile(it[1], "utf-8") - expect(content.includes("Foo=bar")).toBeTruthy() - expect(content.includes("Terminal=true")).toBeTruthy() + expect(content.split("\n").filter(it => !it.includes("X-AppImage-BuildId") && !it.includes("X-AppImage-Version")).join("\n")).toMatchSnapshot() return false }, }, {