Skip to content

Commit

Permalink
feat: set AppImage as default target for Linux
Browse files Browse the repository at this point in the history
 BREAKING CHANGE: default target for Linux changed from `deb` to `AppImage`
  • Loading branch information
develar committed Aug 27, 2016
1 parent 9fe326d commit 8f55a2d
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 21 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ Please note that everything is packaged into an asar archive [by default](https:

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)).
You also need to deploy your releases to a server.
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).
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).
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.

For Windows consider only [distributing 64-bit versions](https://github.com/electron-userland/electron-builder/issues/359#issuecomment-214851130).
Expand Down
2 changes: 1 addition & 1 deletion docs/Options.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ Linux specific build options.
| Name | Description
| --- | ---
| description | <a name="LinuxBuildOptions-description"></a>As [description](#AppMetadata-description) from application package.json, but allows you to specify different for Linux.
| 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>
| 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>
| synopsis | <a name="LinuxBuildOptions-synopsis"></a>*deb-only.* The [short description](https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Description).
| maintainer | <a name="LinuxBuildOptions-maintainer"></a>The maintainer. Defaults to [author](#AppMetadata-author).
| vendor | <a name="LinuxBuildOptions-vendor"></a>The vendor. Defaults to [author](#AppMetadata-author).
Expand Down
9 changes: 4 additions & 5 deletions src/linuxPackager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,13 @@ export class LinuxPackager extends PlatformPackager<LinuxBuildOptions> {
return helper
}

if (name === "appimage") {
if (name === DEFAULT_TARGET || name === "appimage") {
const targetClass: typeof AppImageTarget = require("./targets/appImage").default
mapper(name, outDir => new targetClass(this, getHelper(), outDir))
mapper("appimage", outDir => new targetClass(this, getHelper(), outDir))
}
else if (name === DEFAULT_TARGET || name === "deb" || name === "rpm" || name === "sh" || name === "freebsd" || name === "pacman" || name === "apk" || name === "p5p") {
else if (name === "deb" || name === "rpm" || name === "sh" || name === "freebsd" || name === "pacman" || name === "apk" || name === "p5p") {
const targetClass: typeof FpmTarget = require("./targets/fpm").default
const target = name === DEFAULT_TARGET ? "deb" : name
mapper(target, outDir => new targetClass(target, this, getHelper(), outDir))
mapper(name, outDir => new targetClass(name, this, getHelper(), outDir))
}
else {
mapper(name, () => createCommonTarget(name))
Expand Down
8 changes: 2 additions & 6 deletions src/metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ export interface LinuxBuildOptions extends PlatformSpecificBuildOptions {
readonly description?: string | null

/*
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`.
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`.
The most effective [xz](https://en.wikipedia.org/wiki/Xz) compression format used by default.
Expand Down Expand Up @@ -628,10 +628,6 @@ export enum Arch {
ia32, x64
}

export function archToString(arch: Arch): string {
return arch === Arch.ia32 ? "ia32" : "x64"
}

export function archFromString(name: string): Arch {
if (name === "x64") {
return Arch.x64
Expand All @@ -641,4 +637,4 @@ export function archFromString(name: string): Arch {
}

throw new Error(`Unsupported arch ${name}`)
}
}
14 changes: 6 additions & 8 deletions test/src/linuxPackagerTest.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import test from "./helpers/avaEx"
import { assertPack, platform, modifyPackageJson, app } from "./helpers/packTester"
import { assertPack, platform, modifyPackageJson, app, appThrows } from "./helpers/packTester"
import { remove } from "fs-extra-p"
import * as path from "path"
import { Platform } from "out"
Expand Down Expand Up @@ -50,10 +50,8 @@ test.ifNotWindows("custom depends", () => assertPack("test-app-one", {
expectedDepends: "foo"
}))

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

0 comments on commit 8f55a2d

Please sign in to comment.