Skip to content

Commit

Permalink
feat(Squirrel.Windows): name option
Browse files Browse the repository at this point in the history
  • Loading branch information
develar committed Jun 26, 2017
1 parent 77d17f3 commit e9e5eab
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 6 deletions.
16 changes: 16 additions & 0 deletions .idea/dictionaries/develar.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 10 additions & 5 deletions packages/electron-builder-squirrel-windows/src/squirrelWindows.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ export default class SquirrelWindowsTarget extends Target {

await buildInstaller(<SquirrelOptions>distOptions, installerOutDir, setupFileName, packager, appOutDir, this.outDir, arch)

packager.dispatchArtifactCreated(path.join(installerOutDir, setupFileName), this, arch, `${appInfo.name}-Setup-${version}${archSuffix}.exe`)
packager.dispatchArtifactCreated(path.join(installerOutDir, setupFileName), this, arch, `${this.appName}-Setup-${version}${archSuffix}.exe`)

const packagePrefix = `${appInfo.name}-${convertVersion(version)}-`
const packagePrefix = `${this.appName}-${convertVersion(version)}-`
packager.dispatchArtifactCreated(path.join(installerOutDir, `${packagePrefix}full.nupkg`), this, arch)
if (distOptions.remoteReleases != null) {
packager.dispatchArtifactCreated(path.join(installerOutDir, `${packagePrefix}delta.nupkg`), this, arch)
Expand All @@ -47,6 +47,10 @@ export default class SquirrelWindowsTarget extends Target {
packager.dispatchArtifactCreated(path.join(installerOutDir, "RELEASES"), this, arch)
}

private get appName() {
return this.options.name || this.packager.appInfo.name
}

async computeEffectiveDistOptions(): Promise<SquirrelOptions> {
const packager = this.packager
let iconUrl = this.options.iconUrl
Expand All @@ -65,10 +69,11 @@ export default class SquirrelWindowsTarget extends Target {

const appInfo = packager.appInfo
const projectUrl = await appInfo.computePackageUrl()
const appName = this.appName
const options: any = Object.assign({
name: appInfo.name,
productName: appInfo.productName,
appId: this.options.useAppIdAsId ? appInfo.id : appInfo.name,
name: appName,
productName: this.options.name || appInfo.productName,
appId: this.options.useAppIdAsId ? appInfo.id : appName,
version: appInfo.version,
description: appInfo.description,
// better to explicitly set to empty string, to avoid any nugget errors
Expand Down
6 changes: 6 additions & 0 deletions packages/electron-builder/src/options/winOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,12 @@ export interface SquirrelWindowsOptions extends WinBuildOptions {
* Use `appId` to identify package instead of `name`.
*/
readonly useAppIdAsId?: boolean

/**
* https://github.com/electron-userland/electron-builder/issues/1743
* @private
*/
readonly name?: string
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ ${endif}
!ifdef RUN_AFTER_FINISH
${IfNot} ${Silent}
${OrIf} ${ForceRun}
# otherwise app window will be in backround
# otherwise app window will be in background
HideWindow
!insertmacro StartApp
${EndIf}
Expand Down

0 comments on commit e9e5eab

Please sign in to comment.