Skip to content
Permalink
Browse files

feat: product name for AppImage file

Close #1895, Close #3334
  • Loading branch information...
develar committed Nov 16, 2018
1 parent e0dd818 commit 68e55733421199048a2c89b255c1361f4c4814a3
@@ -7,7 +7,7 @@ cache:
- '%LOCALAPPDATA%\electron-builder\cache'

environment:
TEST_FILES: ExtraBuildTest,BuildTest,extraMetadataTest,filesTest,globTest,nsisUpdaterTest,oneClickInstallerTest,installerTest,appxTest,msiTest
TEST_FILES: ExtraBuildTest,BuildTest,extraMetadataTest,filesTest,globTest,nsisUpdaterTest,oneClickInstallerTest,installerTest,appxTest,msiTest,protonTest

install:
- ps: Install-Product node 10 x64
@@ -62,7 +62,7 @@
"source-map-support": "^0.5.9",
"stat-mode": "^0.2.2",
"sumchecker": "^2.0.2",
"temp-file": "^3.2.0",
"temp-file": "^3.3.2",
"tunnel-agent": "^0.6.0",
"update-notifier": "^2.5.0",
"yargs": "^12.0.2"
@@ -63,7 +63,7 @@
"semver": "^5.6.0",
"debug": "^4.1.0",
"lazy-val": "^1.0.3",
"temp-file": "^3.2.0",
"temp-file": "^3.3.2",
"ejs": "^2.6.1"
},
"typings": "./out/index.d.ts"
@@ -192,6 +192,7 @@ export default class MacPackager extends PlatformPackager<MacConfiguration> {
throw new InvalidConfigurationError(`Cannot find valid "${certType}" identity to sign MAS installer, please see https://electron.build/code-signing`)
}

// mas uploaded to AppStore, so, use "-" instead of space for name
const artifactName = this.expandArtifactNamePattern(masOptions, "pkg")
const artifactPath = path.join(outDir!, artifactName)
await this.doFlat(appPath, artifactPath, masInstallerIdentity, keychainName)
@@ -480,6 +480,11 @@ export abstract class PlatformPackager<DC extends PlatformSpecificBuildOptions>
return this.computeArtifactName(pattern, ext, skipArchIfX64 && arch === Arch.x64 ? null : arch)
}

expandArtifactBeautyNamePattern(targetSpecificOptions: TargetSpecificOptions | null | undefined, ext: string, arch?: Arch | null): string {
// tslint:disable-next-line:no-invalid-template-strings
return this.expandArtifactNamePattern(targetSpecificOptions, ext, arch, "${productName} ${version} ${arch}.${ext}", true)
}

private computeArtifactName(pattern: any, ext: string, arch: Arch | null | undefined) {
let archName: string | null = arch == null ? null : Arch[arch]
if (arch === Arch.x64) {
@@ -8,8 +8,8 @@ if (process.env.BUILDER_REMOVE_STAGE_EVEN_IF_DEBUG == null) {
}

async function doBuild(data: BuildTask): Promise<void> {
if (process.env.ELECTRON_BUILDER_TMP_DIR == null) {
throw new Error("Env ELECTRON_BUILDER_TMP_DIR must be set for builder process")
if (process.env.APP_BUILDER_TMP_DIR == null) {
throw new Error("Env APP_BUILDER_TMP_DIR must be set for builder process")
}

const projectDir = process.env.PROJECT_DIR
@@ -86,13 +86,13 @@ async function doBuild(data: BuildTask): Promise<void> {
}, info.metadata, info.devMetadata, info.repositoryInfo)

// writeJson must be not used because it adds unwanted \n as last file symbol
await writeFile(path.join(process.env.ELECTRON_BUILDER_TMP_DIR!!, "__build-result.json"), JSON.stringify(artifacts))
await writeFile(path.join(process.env.APP_BUILDER_TMP_DIR!!, "__build-result.json"), JSON.stringify(artifacts))
}

doBuild(JSON.parse(process.argv[2]))
.catch(error => {
process.exitCode = 0
return writeFile(path.join(process.env.ELECTRON_BUILDER_TMP_DIR!!, "__build-result.json"), (error.stack || error).toString())
return writeFile(path.join(process.env.APP_BUILDER_TMP_DIR!!, "__build-result.json"), (error.stack || error).toString())
})

interface TargetInfo {
@@ -32,7 +32,7 @@ export default class AppImageTarget extends Target {
// https://github.com/electron-userland/electron-builder/issues/775
// https://github.com/electron-userland/electron-builder/issues/1726
// tslint:disable-next-line:no-invalid-template-strings
const artifactName = packager.expandArtifactNamePattern(options, "AppImage", arch, "${name}-${version}-${arch}.${ext}", false)
const artifactName = packager.expandArtifactBeautyNamePattern(options, "AppImage", arch)
const artifactPath = path.join(this.outDir, artifactName)
this.logBuilding("AppImage", artifactPath, arch)

@@ -36,7 +36,7 @@ export default class AppXTarget extends Target {
// https://docs.microsoft.com/en-us/windows/uwp/packaging/create-app-package-with-makeappx-tool#mapping-files
async build(appOutDir: string, arch: Arch): Promise<any> {
const packager = this.packager
const artifactName = packager.expandArtifactNamePattern(this.options, "appx", arch)
const artifactName = packager.expandArtifactBeautyNamePattern(this.options, "appx", arch)
const artifactPath = path.join(this.outDir, artifactName)
this.logBuilding("AppX", artifactPath, arch)

@@ -42,7 +42,7 @@ export default class MsiTarget extends Target {

async build(appOutDir: string, arch: Arch) {
const packager = this.packager
const artifactName = packager.expandArtifactNamePattern(this.options, "msi", arch)
const artifactName = packager.expandArtifactBeautyNamePattern(this.options, "msi", arch)
const artifactPath = path.join(this.outDir, artifactName)
this.logBuilding("MSI", artifactPath, arch)

@@ -33,6 +33,7 @@ export class PkgTarget extends Target {
const options = this.options
const appInfo = packager.appInfo

// pkg doesn't like not ASCII symbols (Could not open package to list files: /Volumes/test/t-gIjdGK/test-project-0/dist/Test App ßW-1.1.0.pkg)
const artifactName = packager.expandArtifactNamePattern(options, "pkg")
const artifactPath = path.join(this.outDir, artifactName)

@@ -12,7 +12,7 @@
],
"dependencies": {
"app-builder-bin": "2.5.1",
"temp-file": "^3.2.0",
"temp-file": "^3.3.2",
"fs-extra-p": "^7.0.0",
"is-ci": "^1.2.1",
"stat-mode": "^0.2.2",
@@ -1,5 +1,7 @@
"use strict"

const isCi = require("is-ci")

let babel
const crypto = require("crypto")
const fs = require("fs")
@@ -31,7 +33,7 @@ function createTransformer(options) {
.digest("hex")
},
process(src, filename, config, transformOptions) {
if (process.env.BABEL_JEST_SKIP === "true" || require("is-ci")) {
if (process.env.BABEL_JEST_SKIP === "true" || isCi) {
// precompiled on CI
return src
}
@@ -5,7 +5,8 @@ Object {
"linux": Array [
Object {
"arch": "x64",
"file": "TestApp-1.1.0-x86_64.AppImage",
"file": "Test App ßW 1.1.0.AppImage",
"safeArtifactName": "TestApp-1.1.0-x86_64.AppImage",
"updateInfo": Object {
"blockMapSize": "@blockMapSize",
"sha512": "@sha512",
@@ -201,7 +201,8 @@ Object {
"linux": Array [
Object {
"arch": "x64",
"file": "TestApp-1.1.0-x86_64.AppImage",
"file": "Test App ßW 1.1.0.AppImage",
"safeArtifactName": "TestApp-1.1.0-x86_64.AppImage",
"updateInfo": Object {
"blockMapSize": "@blockMapSize",
"sha512": "@sha512",
@@ -5,7 +5,8 @@ Object {
"linux": Array [
Object {
"arch": "x64",
"file": "TestApp-1.1.0-x86_64.AppImage",
"file": "Test App ßW 1.1.0.AppImage",
"safeArtifactName": "TestApp-1.1.0-x86_64.AppImage",
"updateInfo": Object {
"blockMapSize": "@blockMapSize",
"sha512": "@sha512",
@@ -5,7 +5,8 @@ Object {
"linux": Array [
Object {
"arch": "x64",
"file": "notepad-1.0.0-x86_64.AppImage",
"file": "notepad 1.0.0.AppImage",
"safeArtifactName": "notepad-1.0.0-x86_64.AppImage",
"updateInfo": Object {
"blockMapSize": "@blockMapSize",
"sha512": "@sha512",
@@ -36,7 +36,8 @@ Object {
"linux": Array [
Object {
"arch": "x64",
"file": "TestApp-1.1.0-x86_64.AppImage",
"file": "Test App ßW 1.1.0.AppImage",
"safeArtifactName": "TestApp-1.1.0-x86_64.AppImage",
"updateInfo": Object {
"blockMapSize": "@blockMapSize",
"sha512": "@sha512",
@@ -52,7 +53,8 @@ Object {
"linux": Array [
Object {
"arch": "x64",
"file": "TestApp-1.1.0-x86_64.AppImage",
"file": "Test App ßW 1.1.0.AppImage",
"safeArtifactName": "TestApp-1.1.0-x86_64.AppImage",
"updateInfo": Object {
"blockMapSize": "@blockMapSize",
"sha512": "@sha512",
@@ -67,10 +69,10 @@ Object {
"blockMapSize": "@blockMapSize",
"sha512": "@sha512",
"size": "@size",
"url": "TestApp-1.1.0-x86_64.AppImage",
"url": "Test App ßW 1.1.0.AppImage",
},
],
"path": "TestApp-1.1.0-x86_64.AppImage",
"path": "Test App ßW 1.1.0.AppImage",
"releaseDate": "@releaseDate",
"sha512": "@sha512",
"version": "1.1.0",
@@ -85,7 +87,8 @@ Object {
"linux": Array [
Object {
"arch": "armv7l",
"file": "TestApp-1.1.0-armv7l.AppImage",
"file": "Test App ßW 1.1.0 armv7l.AppImage",
"safeArtifactName": "TestApp-1.1.0-armv7l.AppImage",
"updateInfo": Object {
"blockMapSize": "@blockMapSize",
"sha512": "@sha512",
@@ -100,10 +103,10 @@ Object {
"blockMapSize": "@blockMapSize",
"sha512": "@sha512",
"size": "@size",
"url": "TestApp-1.1.0-armv7l.AppImage",
"url": "Test App ßW 1.1.0 armv7l.AppImage",
},
],
"path": "TestApp-1.1.0-armv7l.AppImage",
"path": "Test App ßW 1.1.0 armv7l.AppImage",
"releaseDate": "@releaseDate",
"sha512": "@sha512",
"version": "1.1.0",
@@ -118,7 +121,8 @@ Object {
"linux": Array [
Object {
"arch": "ia32",
"file": "TestApp-1.1.0-i386.AppImage",
"file": "Test App ßW 1.1.0 i386.AppImage",
"safeArtifactName": "TestApp-1.1.0-i386.AppImage",
"updateInfo": Object {
"blockMapSize": "@blockMapSize",
"sha512": "@sha512",
@@ -133,10 +137,10 @@ Object {
"blockMapSize": "@blockMapSize",
"sha512": "@sha512",
"size": "@size",
"url": "TestApp-1.1.0-i386.AppImage",
"url": "Test App ßW 1.1.0 i386.AppImage",
},
],
"path": "TestApp-1.1.0-i386.AppImage",
"path": "Test App ßW 1.1.0 i386.AppImage",
"releaseDate": "@releaseDate",
"sha512": "@sha512",
"version": "1.1.0",
@@ -153,7 +157,8 @@ Object {
"linux": Array [
Object {
"arch": "x64",
"file": "TestApp-1.1.0-x86_64.AppImage",
"file": "Test App ßW 1.1.0.AppImage",
"safeArtifactName": "TestApp-1.1.0-x86_64.AppImage",
"updateInfo": Object {
"blockMapSize": "@blockMapSize",
"sha512": "@sha512",
@@ -169,7 +174,8 @@ Object {
"linux": Array [
Object {
"arch": "x64",
"file": "TestApp-1.1.0-x86_64.AppImage",
"file": "Test App ßW 1.1.0.AppImage",
"safeArtifactName": "TestApp-1.1.0-x86_64.AppImage",
"updateInfo": Object {
"blockMapSize": "@blockMapSize",
"sha512": "@sha512",
@@ -185,7 +191,8 @@ Object {
"linux": Array [
Object {
"arch": "x64",
"file": "TestApp-1.1.0-x86_64.AppImage",
"file": "Test App ßW 1.1.0.AppImage",
"safeArtifactName": "TestApp-1.1.0-x86_64.AppImage",
"updateInfo": Object {
"blockMapSize": "@blockMapSize",
"sha512": "@sha512",
@@ -201,7 +208,8 @@ Object {
"linux": Array [
Object {
"arch": "x64",
"file": "TestApp-1.1.0-x86_64.AppImage",
"file": "Test App ßW 1.1.0.AppImage",
"safeArtifactName": "TestApp-1.1.0-x86_64.AppImage",
"updateInfo": Object {
"blockMapSize": "@blockMapSize",
"sha512": "@sha512",
@@ -217,7 +225,8 @@ Object {
"linux": Array [
Object {
"arch": "x64",
"file": "TestApp-1.1.0-x86_64.AppImage",
"file": "Test App ßW 1.1.0.AppImage",
"safeArtifactName": "TestApp-1.1.0-x86_64.AppImage",
"updateInfo": Object {
"blockMapSize": "@blockMapSize",
"sha512": "@sha512",
@@ -233,7 +242,8 @@ Object {
"linux": Array [
Object {
"arch": "x64",
"file": "TestApp-1.1.0-x86_64.AppImage",
"file": "Test App ßW 1.1.0.AppImage",
"safeArtifactName": "TestApp-1.1.0-x86_64.AppImage",
"updateInfo": Object {
"blockMapSize": "@blockMapSize",
"sha512": "@sha512",
Oops, something went wrong.

0 comments on commit 68e5573

Please sign in to comment.
You can’t perform that action at this time.