Skip to content

Commit

Permalink
fix(AppImage): AppImage artifact name does not use artifactName tem…
Browse files Browse the repository at this point in the history
…plate

Close #1726
  • Loading branch information
develar committed Jun 22, 2017
1 parent 6f8b94b commit a02fbd7
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 8 deletions.
2 changes: 1 addition & 1 deletion docs/Options.md
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ Configuration Options

If list contains `default`, it will be replaced to default list, so, `["default", "foo"]` can be used to add custom parts `foo` in addition to defaults.
* <a name="SnapOptions-ubuntuAppPlatformContent"></a>`ubuntuAppPlatformContent` String - Specify `ubuntu-app-platform1` to use [ubuntu-app-platform](https://insights.ubuntu.com/2016/11/17/how-to-create-snap-packages-on-qt-applications/). Snap size will be greatly reduced, but it is not recommended for now because "the snaps must be connected before running uitk-gallery for the first time".
* <a name="Config-appimage"></a>`appimage` [LinuxTargetSpecificOptions](electron-builder#LinuxTargetSpecificOptions)
* <a name="Config-appImage"></a>`appImage` [LinuxTargetSpecificOptions](electron-builder#LinuxTargetSpecificOptions)
* <a name="Config-pacman"></a>`pacman` [LinuxTargetSpecificOptions](electron-builder#LinuxTargetSpecificOptions)
* <a name="Config-rpm"></a>`rpm` [LinuxTargetSpecificOptions](electron-builder#LinuxTargetSpecificOptions)
* <a name="Config-freebsd"></a>`freebsd` [LinuxTargetSpecificOptions](electron-builder#LinuxTargetSpecificOptions)
Expand Down
7 changes: 5 additions & 2 deletions docs/api/electron-builder.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@

| Name | Type |
| --- | --- |
| **outDir**| <code>String</code> |
| **appOutDir**| <code>String</code> |
| **packager**| <code>[PlatformPackager](#PlatformPackager)&lt;any&gt;</code> |
| **electronPlatformName**| <code>String</code> |
Expand Down Expand Up @@ -106,7 +107,6 @@
| **repositoryInfo**| <code>Promise&lt; \| [SourceRepositoryInfo](#SourceRepositoryInfo)&gt;</code> |
| **isPrepackedAppAsar**| <code>Boolean</code> |
| **cancellationToken**| <code>[CancellationToken](electron-builder-http#CancellationToken)</code> |
| **outDir**| <code>String</code> |


* [`.BuildInfo`](#BuildInfo)
Expand Down Expand Up @@ -224,7 +224,6 @@
| tempDirManager = <code>new TmpDir()</code>| <code>module:electron-builder-util/out/tmp.TmpDir</code> |
| options| <code>[PackagerOptions](Options#PackagerOptions)</code> |
| **repositoryInfo**| <code>Promise&lt; \| [SourceRepositoryInfo](#SourceRepositoryInfo)&gt;</code> |
| **outDir**| <code>String</code> |


* [.Packager](#Packager) ⇐ <code>[BuildInfo](#BuildInfo)</code>
Expand Down Expand Up @@ -793,9 +792,13 @@
## electron-builder/out/util/flags

* [electron-builder/out/util/flags](#module_electron-builder/out/util/flags)
* [`.isBuildCacheEnabled()`](#module_electron-builder/out/util/flags.isBuildCacheEnabled) ⇒ <code>Boolean</code>
* [`.isUseSystemSigncode()`](#module_electron-builder/out/util/flags.isUseSystemSigncode) ⇒ <code>Boolean</code>
* [`.isUseSystemWine()`](#module_electron-builder/out/util/flags.isUseSystemWine) ⇒ <code>Boolean</code>

<a name="module_electron-builder/out/util/flags.isBuildCacheEnabled"></a>
### `electron-builder/out/util/flags.isBuildCacheEnabled()` ⇒ <code>Boolean</code>
**Kind**: method of [<code>electron-builder/out/util/flags</code>](#module_electron-builder/out/util/flags)
<a name="module_electron-builder/out/util/flags.isUseSystemSigncode"></a>
### `electron-builder/out/util/flags.isUseSystemSigncode()` ⇒ <code>Boolean</code>
**Kind**: method of [<code>electron-builder/out/util/flags</code>](#module_electron-builder/out/util/flags)
Expand Down
2 changes: 1 addition & 1 deletion packages/electron-builder/src/metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ export interface Config extends PlatformSpecificBuildOptions {
* [Snap](http://snapcraft.io) options.
*/
readonly snap?: SnapOptions | null
readonly appimage?: LinuxTargetSpecificOptions | null
readonly appImage?: LinuxTargetSpecificOptions | null
readonly pacman?: LinuxTargetSpecificOptions | null
readonly rpm?: LinuxTargetSpecificOptions | null
readonly freebsd?: LinuxTargetSpecificOptions | null
Expand Down
5 changes: 3 additions & 2 deletions packages/electron-builder/src/targets/appImage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ export default class AppImageTarget extends Target {
const packager = this.packager

// /~https://github.com/electron-userland/electron-builder/issues/775
const resultFile = path.join(this.outDir, packager.computeSafeArtifactName("AppImage", arch, false))
// /~https://github.com/electron-userland/electron-builder/issues/1726
const resultFile = path.join(this.outDir, this.options.artifactName == null ? packager.computeSafeArtifactName("AppImage", arch, false) : packager.expandArtifactNamePattern(this.options, "AppImage", arch))
await unlinkIfExists(resultFile)

const appImagePath = await appImagePathPromise
Expand Down Expand Up @@ -98,6 +99,6 @@ export default class AppImageTarget extends Target {

await chmod(resultFile, "0755")

packager.dispatchArtifactCreated(resultFile, this, arch)
packager.dispatchArtifactCreated(resultFile, this, arch, packager.computeSafeArtifactName("AppImage", arch, false))
}
}
2 changes: 1 addition & 1 deletion packages/electron-builder/src/targets/pkg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export class PkgTarget extends Target {
})
await BluebirdPromise.all([unlink(innerPackageFile), unlink(distInfoFile)])

packager.dispatchArtifactCreated(outFile, this, arch, `${appInfo.name}-${appInfo.version}.pkg`)
packager.dispatchArtifactCreated(outFile, this, arch, packager.computeSafeArtifactName("pkg", arch))
}

private async customizeDistributionConfiguration(distInfoFile: string, appPath: string) {
Expand Down
5 changes: 4 additions & 1 deletion test/out/linux/__snapshots__/linuxPackagerTest.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ Object {
"linux": Array [
Object {
"arch": 1,
"file": "TestApp-1.1.0-x86_64.AppImage",
"file": "boo-Test App ßW",
"safeArtifactName": "TestApp-1.1.0-x86_64.AppImage",
},
],
}
Expand All @@ -30,6 +31,7 @@ Object {
Object {
"arch": 1,
"file": "TestApp-1.1.0-x86_64.AppImage",
"safeArtifactName": "TestApp-1.1.0-x86_64.AppImage",
},
],
}
Expand All @@ -41,6 +43,7 @@ Object {
Object {
"arch": 1,
"file": "TestApp-1.1.0-x86_64.AppImage",
"safeArtifactName": "TestApp-1.1.0-x86_64.AppImage",
},
],
}
Expand Down
3 changes: 3 additions & 0 deletions test/src/linux/linuxPackagerTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ test.ifDevOrLinuxCi("AppImage - default icon, custom executable and custom deskt
Foo: "bar",
Terminal: "true",
},
},
appImage: {
artifactName: "boo-${productName}",
}
},
effectiveOptionComputed: async (it) => {
Expand Down

0 comments on commit a02fbd7

Please sign in to comment.