Skip to content

Commit 8f55a2d

Browse files
committed
feat: set AppImage as default target for Linux
BREAKING CHANGE: default target for Linux changed from `deb` to `AppImage`
1 parent 9fe326d commit 8f55a2d

File tree

5 files changed

+14
-21
lines changed

5 files changed

+14
-21
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ Please note that everything is packaged into an asar archive [by default](https:
9595

9696
To benefit from auto updates, you have to implement and configure Electron's [`autoUpdater`](http://electron.atom.io/docs/latest/api/auto-updater/) module ([example](https://github.com/develar/onshape-desktop-shell/blob/master/src/AppUpdater.ts)).
9797
You also need to deploy your releases to a server.
98-
Consider using [Nuts](https://github.com/GitbookIO/nuts) (uses GitHub as a back end to store the assets), [Electron Release Server](https://github.com/ArekSredzki/electron-release-server) or [Squirrel Updates Server](https://github.com/Aluxian/squirrel-updates-server).
98+
Consider using [Nuts](https://github.com/GitbookIO/nuts) (uses GitHub as a backend to store the assets), [Electron Release Server](https://github.com/ArekSredzki/electron-release-server) or [Squirrel Updates Server](https://github.com/Aluxian/squirrel-updates-server).
9999
See the [Publishing Artifacts](https://github.com/electron-userland/electron-builder/wiki/Publishing-Artifacts) section of the [Wiki](https://github.com/electron-userland/electron-builder/wiki) for more information on how to configure your CI environment for automated deployments.
100100

101101
For Windows consider only [distributing 64-bit versions](https://github.com/electron-userland/electron-builder/issues/359#issuecomment-214851130).

docs/Options.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ Linux specific build options.
154154
| Name | Description
155155
| --- | ---
156156
| description | <a name="LinuxBuildOptions-description"></a>As [description](#AppMetadata-description) from application package.json, but allows you to specify different for Linux.
157-
| target | <a name="LinuxBuildOptions-target"></a><p>Target package type: list of <code>AppImage</code>, <code>deb</code>, <code>rpm</code>, <code>freebsd</code>, <code>pacman</code>, <code>p5p</code>, <code>apk</code>, <code>7z</code>, <code>zip</code>, <code>tar.xz</code>, <code>tar.lz</code>, <code>tar.gz</code>, <code>tar.bz2</code>. Defaults to <code>deb</code>.</p> <p>The most effective [xz](https://en.wikipedia.org/wiki/Xz) compression format used by default.</p> <p>Only <code>deb</code> and <code>AppImage</code> is tested. Feel free to file issues for <code>rpm</code> and other package formats.</p>
157+
| target | <a name="LinuxBuildOptions-target"></a><p>Target package type: list of <code>AppImage</code>, <code>deb</code>, <code>rpm</code>, <code>freebsd</code>, <code>pacman</code>, <code>p5p</code>, <code>apk</code>, <code>7z</code>, <code>zip</code>, <code>tar.xz</code>, <code>tar.lz</code>, <code>tar.gz</code>, <code>tar.bz2</code>. Defaults to <code>AppImage</code>.</p> <p>The most effective [xz](https://en.wikipedia.org/wiki/Xz) compression format used by default.</p> <p>Only <code>deb</code> and <code>AppImage</code> is tested. Feel free to file issues for <code>rpm</code> and other package formats.</p>
158158
| synopsis | <a name="LinuxBuildOptions-synopsis"></a>*deb-only.* The [short description](https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Description).
159159
| maintainer | <a name="LinuxBuildOptions-maintainer"></a>The maintainer. Defaults to [author](#AppMetadata-author).
160160
| vendor | <a name="LinuxBuildOptions-vendor"></a>The vendor. Defaults to [author](#AppMetadata-author).

src/linuxPackager.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,13 @@ export class LinuxPackager extends PlatformPackager<LinuxBuildOptions> {
4141
return helper
4242
}
4343

44-
if (name === "appimage") {
44+
if (name === DEFAULT_TARGET || name === "appimage") {
4545
const targetClass: typeof AppImageTarget = require("./targets/appImage").default
46-
mapper(name, outDir => new targetClass(this, getHelper(), outDir))
46+
mapper("appimage", outDir => new targetClass(this, getHelper(), outDir))
4747
}
48-
else if (name === DEFAULT_TARGET || name === "deb" || name === "rpm" || name === "sh" || name === "freebsd" || name === "pacman" || name === "apk" || name === "p5p") {
48+
else if (name === "deb" || name === "rpm" || name === "sh" || name === "freebsd" || name === "pacman" || name === "apk" || name === "p5p") {
4949
const targetClass: typeof FpmTarget = require("./targets/fpm").default
50-
const target = name === DEFAULT_TARGET ? "deb" : name
51-
mapper(target, outDir => new targetClass(target, this, getHelper(), outDir))
50+
mapper(name, outDir => new targetClass(name, this, getHelper(), outDir))
5251
}
5352
else {
5453
mapper(name, () => createCommonTarget(name))

src/metadata.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@ export interface LinuxBuildOptions extends PlatformSpecificBuildOptions {
447447
readonly description?: string | null
448448

449449
/*
450-
Target package type: list of `AppImage`, `deb`, `rpm`, `freebsd`, `pacman`, `p5p`, `apk`, `7z`, `zip`, `tar.xz`, `tar.lz`, `tar.gz`, `tar.bz2`. Defaults to `deb`.
450+
Target package type: list of `AppImage`, `deb`, `rpm`, `freebsd`, `pacman`, `p5p`, `apk`, `7z`, `zip`, `tar.xz`, `tar.lz`, `tar.gz`, `tar.bz2`. Defaults to `AppImage`.
451451
452452
The most effective [xz](https://en.wikipedia.org/wiki/Xz) compression format used by default.
453453
@@ -628,10 +628,6 @@ export enum Arch {
628628
ia32, x64
629629
}
630630

631-
export function archToString(arch: Arch): string {
632-
return arch === Arch.ia32 ? "ia32" : "x64"
633-
}
634-
635631
export function archFromString(name: string): Arch {
636632
if (name === "x64") {
637633
return Arch.x64
@@ -641,4 +637,4 @@ export function archFromString(name: string): Arch {
641637
}
642638

643639
throw new Error(`Unsupported arch ${name}`)
644-
}
640+
}

test/src/linuxPackagerTest.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import test from "./helpers/avaEx"
2-
import { assertPack, platform, modifyPackageJson, app } from "./helpers/packTester"
2+
import { assertPack, platform, modifyPackageJson, app, appThrows } from "./helpers/packTester"
33
import { remove } from "fs-extra-p"
44
import * as path from "path"
55
import { Platform } from "out"
@@ -50,10 +50,8 @@ test.ifNotWindows("custom depends", () => assertPack("test-app-one", {
5050
expectedDepends: "foo"
5151
}))
5252

53-
test.ifNotWindows("no-author-email", t => {
54-
t.throws(assertPack("test-app-one", platform(Platform.LINUX), {
55-
projectDirCreated: projectDir => modifyPackageJson(projectDir, data => {
56-
data.author = "Foo"
57-
})
58-
}), /Please specify author 'email' in .+/)
59-
})
53+
test.ifNotWindows("no-author-email", appThrows(/Please specify author 'email' in .+/, {targets: Platform.LINUX.createTarget("deb")}, {
54+
projectDirCreated: projectDir => modifyPackageJson(projectDir, data => {
55+
data.author = "Foo"
56+
})
57+
}))

0 commit comments

Comments
 (0)