Skip to content

Commit

Permalink
fix: Appx name changed
Browse files Browse the repository at this point in the history
Close #1650
  • Loading branch information
develar committed Jun 12, 2017
1 parent e713bbe commit dd0b208
Show file tree
Hide file tree
Showing 15 changed files with 139 additions and 44 deletions.
14 changes: 14 additions & 0 deletions docs/api/electron-builder-http.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
<dd></dd>
<dt><a href="#module_electron-builder-http/out/ProgressCallbackTransform">electron-builder-http/out/ProgressCallbackTransform</a></dt>
<dd></dd>
<dt><a href="#module_electron-builder-http/out/rfc2253Parser">electron-builder-http/out/rfc2253Parser</a></dt>
<dd></dd>
<dt><a href="#module_electron-builder-http">electron-builder-http</a></dt>
<dd></dd>
</dl>
Expand Down Expand Up @@ -220,6 +222,18 @@
| encoding | <code>String</code> |
| callback | <code>function</code> |

<a name="module_electron-builder-http/out/rfc2253Parser"></a>

## electron-builder-http/out/rfc2253Parser
<a name="module_electron-builder-http/out/rfc2253Parser.parseDn"></a>

### `electron-builder-http/out/rfc2253Parser.parseDn(seq)` ⇒ <code>Map&lt;String \| String&gt;</code>
**Kind**: method of [<code>electron-builder-http/out/rfc2253Parser</code>](#module_electron-builder-http/out/rfc2253Parser)

| Param | Type |
| --- | --- |
| seq | <code>String</code> |

<a name="module_electron-builder-http"></a>

## electron-builder-http
Expand Down
94 changes: 80 additions & 14 deletions docs/api/electron-builder.md

Large diffs are not rendered by default.

27 changes: 13 additions & 14 deletions jsdoc/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ function renderTypeNames(types, delimiter, root, isTypeAsCode, isSkipNull) {
const tagOpen = isTypeAsCode ? "<code>" : ""
const tagClose = isTypeAsCode ? "</code>" : ""

for (let obj of types) {
if (obj.includes("CancellationToken")) {
break
}
}

if (isSkipNull) {
types = types.filter(it => !isSkipNull || it !== "null")
}
Expand Down Expand Up @@ -173,18 +179,7 @@ function _link(input, options) {
}
}
else {
let pageUrl = ""
for (const page of exports.pages) {
if (page.dataMap.has(linked.id)) {
const a = page.data
const b = options.data.root
if (a.length !== b.length && a[a.length - 1] !== b[a.length - 1]) {
pageUrl = page.pageUrl
}
break
}
}
output.url = `${pageUrl}#${anchorName.call(linked, options)}`
output.url = fullLink(linked, options.data.root)
}
return output
}
Expand Down Expand Up @@ -258,19 +253,23 @@ function identifierToLink(id, root) {
}
return output
}
return `[${linked.name}](${fullLink(linked, root)})`
}

function fullLink(linked, root) {
const relativeName = anchorName.call(linked)
let pageUrl = ""
for (const page of exports.pages) {
if (page.dataMap.has(linked.id)) {
const a = page.data
const b = root
if (a.length !== b.length && a[a.length - 1] !== b[a.length - 1]) {
if (a.length !== b.length || a[a.length - 1] !== b[a.length - 1]) {
pageUrl = page.pageUrl
}
break
}
}
return `[${linked.name}](${pageUrl}#${anchorName.call(linked)})`
return `${pageUrl}#${relativeName}`
}

function resolveById(id) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"electron-download-tf": "4.3.1",
"electron-is-dev": "^0.1.2",
"electron-osx-sign": "0.4.6",
"fcopy-pre-bundled": "^0.1.2",
"fcopy-pre-bundled": "0.2.0",
"fs-extra-p": "^4.3.0",
"hosted-git-info": "^2.4.2",
"ini": "^1.3.4",
Expand Down
2 changes: 1 addition & 1 deletion packages/electron-builder-util/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
],
"dependencies": {
"fs-extra-p": "^4.3.0",
"fcopy-pre-bundled": "^0.1.2",
"fcopy-pre-bundled": "0.2.0",
"is-ci": "^1.0.10",
"stat-mode": "^0.2.2",
"bluebird-lst": "^1.0.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/electron-builder/src/macPackager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ export default class MacPackager extends PlatformPackager<MacOptions> {

const pkg = path.join(outDir!, this.expandArtifactNamePattern(masOptions, "pkg"))
await this.doFlat(appPath, pkg, masInstallerIdentity, keychainName)
this.dispatchArtifactCreated(pkg, null, Arch.x64, `${this.appInfo.name}-${this.appInfo.version}.pkg`)
this.dispatchArtifactCreated(pkg, null, Arch.x64, this.computeSafeArtifactName("pkg"))
}
}

Expand Down
11 changes: 9 additions & 2 deletions packages/electron-builder/src/platformPackager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -341,12 +341,19 @@ export abstract class PlatformPackager<DC extends PlatformSpecificBuildOptions>
await this.checkFileInPackage(resourcesDir, "package.json", "Application", isAsar)
}

expandArtifactNamePattern(targetSpecificOptions: TargetSpecificOptions | n, ext: string, arch?: Arch | null, defaultPattern?: string): string {
computeSafeArtifactName(ext: string, arch?: Arch | null, skipArchIfX64 = true) {
return this.computeArtifactName("${name}-${version}-${arch}.${ext}", ext, skipArchIfX64 && arch === Arch.x64 ? null : arch)
}

expandArtifactNamePattern(targetSpecificOptions: TargetSpecificOptions | n, ext: string, arch?: Arch | null, defaultPattern?: string, skipArchIfX64 = true): string {
let pattern = targetSpecificOptions == null ? null : targetSpecificOptions.artifactName
if (pattern == null) {
pattern = this.platformSpecificBuildOptions.artifactName || this.config.artifactName || defaultPattern || "${productName}-${version}.${ext}"
pattern = this.platformSpecificBuildOptions.artifactName || this.config.artifactName || defaultPattern || "${productName}-${version}-${arch}.${ext}"
}
return this.computeArtifactName(pattern, ext, skipArchIfX64 && arch === Arch.x64 ? null : arch)
}

private computeArtifactName(pattern: any, ext: string, arch: Arch | null | undefined) {
let archName: string | null = arch == null ? null : Arch[arch]
if (arch === Arch.x64) {
if (ext === "AppImage" || ext === "rpm") {
Expand Down
2 changes: 1 addition & 1 deletion packages/electron-builder/src/targets/ArchiveTarget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export class ArchiveTarget extends Target {
log(`Building ${isMac ? "macOS " : ""}${format}`)

// do not specify arch if x64
const outFile = path.join(this.outDir, packager.expandArtifactNamePattern(this.options, format, arch === Arch.x64 ? null : arch, packager.platform === Platform.LINUX ? "${name}-${version}-${arch}.${ext}" : "${productName}-${version}-${arch}-${os}.${ext}"))
const outFile = path.join(this.outDir, packager.expandArtifactNamePattern(this.options, format, arch, packager.platform === Platform.LINUX ? "${name}-${version}-${arch}.${ext}" : "${productName}-${version}-${arch}-${os}.${ext}"))
if (format.startsWith("tar.")) {
await tar(packager.config.compression, format, outFile, appOutDir, isMac)
}
Expand Down
2 changes: 1 addition & 1 deletion packages/electron-builder/src/targets/appImage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ 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.expandArtifactNamePattern(this.options, "AppImage", arch, "${name}-${version}-${arch}.${ext}"))
const resultFile = path.join(this.outDir, packager.computeSafeArtifactName("AppImage", arch, false))
await unlinkIfExists(resultFile)

const appImagePath = await appImagePathPromise
Expand Down
2 changes: 1 addition & 1 deletion packages/electron-builder/src/targets/appx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export default class AppXTarget extends Target {
await spawn(path.join(vendorPath, "windows-10", arch === Arch.ia32 ? "ia32" : "x64", "makeappx.exe"), args)

await packager.sign(destination)
packager.dispatchArtifactCreated(destination, this, arch, packager.expandArtifactNamePattern(this.options, "appx", arch, "${name}-${version}-${arch}.${ext}"))
packager.dispatchArtifactCreated(destination, this, arch, packager.computeSafeArtifactName("appx"))
}

private async writeManifest(templatePath: string, preAppx: string, safeName: string, arch: Arch, publisher: string) {
Expand Down
3 changes: 1 addition & 2 deletions packages/electron-builder/src/targets/dmg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ export class DmgTarget extends Target {

async build(appPath: string, arch: Arch) {
const packager = this.packager
const appInfo = packager.appInfo
log("Building DMG")

const specification = await this.computeDmgOptions()
Expand Down Expand Up @@ -178,7 +177,7 @@ export class DmgTarget extends Target {

await addLicenseToDmg(packager, artifactPath)

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

computeVolumeName(custom?: string | null): string {
Expand Down
2 changes: 1 addition & 1 deletion packages/electron-builder/src/targets/fpm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export default class FpmTarget extends Target {
isUseArchIfX64 = true
}

const destination = path.join(this.outDir, this.packager.expandArtifactNamePattern(this.options, target, arch !== Arch.x64 || isUseArchIfX64 ? arch : null, nameFormat))
const destination = path.join(this.outDir, this.packager.expandArtifactNamePattern(this.options, target, arch, nameFormat, !isUseArchIfX64))
await unlinkIfExists(destination)
if (this.packager.info.prepackaged != null) {
await ensureDir(this.outDir)
Expand Down
9 changes: 7 additions & 2 deletions packages/jsdoc2md.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ async function main() {
"!***/*-dmgLicense.js",
"!***/*-repositoryInfo.js",
"!***/*-readPackageJson.js",
"!***/*-create-self-signed-cert.js",
], {cwd: source}))
.filter(it => !userFiles.includes(it))

Expand All @@ -77,10 +78,11 @@ async function main() {
{page: "api/electron-updater.md", pageUrl: "electron-updater", files: updaterFiles},

{page: "Publishing Artifacts.md", pageUrl: "Publishing-Artifacts", mainHeader: "API", files: publishOptionsFiles},
{page: "api/electron-publish.md", pageUrl: "electron-publish", files: publishFiles},

{page: "api/electron-builder-util.md", pageUrl: "electron-builder-util", files: utilFiles},
{page: "api/electron-builder-core.md", pageUrl: "electron-builder-core", files: coreFiles},
{page: "api/electron-builder-http.md", pageUrl: "electron-builder-http", files: httpFiles},
{page: "api/electron-publish.md", pageUrl: "electron-publish", files: publishFiles},
]

await render(pages, {
Expand Down Expand Up @@ -169,7 +171,10 @@ async function render(pages, jsdoc2MdOptions) {
sortAutoUpdate(pages)

for (const page of pages) {
const finalOptions = Object.assign({data: page.data, "property-list-format": page === pages[0] ? "list" : "table"}, jsdoc2MdOptions)
const finalOptions = Object.assign({
data: page.data,
"property-list-format": page === pages[0] ? "list" : "table"
}, jsdoc2MdOptions)

if (page === pages[0]) {
finalOptions["heading-depth"] = 1
Expand Down
7 changes: 6 additions & 1 deletion test/out/windows/__snapshots__/appxTest.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,15 @@
exports[`AppX 1`] = `
Object {
"win": Array [
Object {
"arch": 0,
"file": "Test App ßW-1.1.0-ia32.appx",
"safeArtifactName": "TestApp-1.1.0.appx",
},
Object {
"arch": 1,
"file": "Test App ßW-1.1.0.appx",
"safeArtifactName": "TestApp-1.1.0-x64.appx",
"safeArtifactName": "TestApp-1.1.0.appx",
},
],
}
Expand Down
4 changes: 2 additions & 2 deletions test/src/windows/appxTest.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Platform } from "electron-builder"
import { Arch, Platform } from "electron-builder"
import { app } from "../helpers/packTester"

// noinspection SpellCheckingInspection
test.ifWindows("AppX", app({
targets: Platform.WINDOWS.createTarget(["appx"]),
targets: Platform.WINDOWS.createTarget(["appx"], Arch.ia32, Arch.x64),
cscLink: "MIIKGgIBAzCCCdYGCSqGSIb3DQEHAaCCCccEggnDMIIJvzCCBggGCSqGSIb3DQEHAaCCBfkEggX1MIIF8TCCBe0GCyqGSIb3DQEMCgECoIIE/jCCBPowHAYKKoZIhvcNAQwBAzAOBAjFi6Zs82xXAQICB9AEggTYHjMRS2UaEBy1FAqMRnj3dsmKf1l66ZtETBK5E6LIEluIcDRnouWsz57ANmW7t+z5v6D1GKXeaPrLQVEmct3lpNhHu9f3BT1cJH7LP6NtxIBXYBvQAJusK7cGEC507kt46go/qG+EUhe4/jnJGOKbl9vcWfMf9V9OFOhe3j3hMWE1FbTiJt+eXM6eskV3H6w/vXrLPBZHkigKw+4EE1WB2Nq2tJSKAbEbLzPeGB/CWyQSJyAU8zxCcn8mSab0YjKaK9K/8hmsCqxXHL5d3P53dryBFWkl536tkVFT6U3iD2b9vTdf7RCkuybxiV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