From 8f55a2d268f5a72e0b63790bb922a79ea87f6cd4 Mon Sep 17 00:00:00 2001 From: develar Date: Fri, 26 Aug 2016 20:28:33 +0200 Subject: [PATCH] feat: set AppImage as default target for Linux BREAKING CHANGE: default target for Linux changed from `deb` to `AppImage` --- README.md | 2 +- docs/Options.md | 2 +- src/linuxPackager.ts | 9 ++++----- src/metadata.ts | 8 ++------ test/src/linuxPackagerTest.ts | 14 ++++++-------- 5 files changed, 14 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index d8b9ac3b9f5..4d0548ac40d 100755 --- a/README.md +++ b/README.md @@ -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). diff --git a/docs/Options.md b/docs/Options.md index 3f7c5d19f1a..5c9e6b2acca 100644 --- a/docs/Options.md +++ b/docs/Options.md @@ -154,7 +154,7 @@ Linux specific build options. | Name | Description | --- | --- | description | As [description](#AppMetadata-description) from application package.json, but allows you to specify different for Linux. -| target |

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.

The most effective [xz](https://en.wikipedia.org/wiki/Xz) compression format used by default.

Only deb and AppImage is tested. Feel free to file issues for rpm and other package formats.

+| target |

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.

Only deb and AppImage is tested. Feel free to file issues for rpm and other package formats.

| synopsis | *deb-only.* The [short description](https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Description). | maintainer | The maintainer. Defaults to [author](#AppMetadata-author). | vendor | The vendor. Defaults to [author](#AppMetadata-author). diff --git a/src/linuxPackager.ts b/src/linuxPackager.ts index 0c29b7ef03a..0a437937e34 100755 --- a/src/linuxPackager.ts +++ b/src/linuxPackager.ts @@ -41,14 +41,13 @@ export class LinuxPackager extends PlatformPackager { 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)) diff --git a/src/metadata.ts b/src/metadata.ts index 7b7ac15de28..2662ee1a1a5 100755 --- a/src/metadata.ts +++ b/src/metadata.ts @@ -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. @@ -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 @@ -641,4 +637,4 @@ export function archFromString(name: string): Arch { } throw new Error(`Unsupported arch ${name}`) -} +} \ No newline at end of file diff --git a/test/src/linuxPackagerTest.ts b/test/src/linuxPackagerTest.ts index 22d5595e8d5..95d5e3f6a27 100755 --- a/test/src/linuxPackagerTest.ts +++ b/test/src/linuxPackagerTest.ts @@ -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" @@ -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 .+/) -}) \ No newline at end of file +test.ifNotWindows("no-author-email", appThrows(/Please specify author 'email' in .+/, {targets: Platform.LINUX.createTarget("deb")}, { + projectDirCreated: projectDir => modifyPackageJson(projectDir, data => { + data.author = "Foo" + }) +})) \ No newline at end of file