Skip to content

Commit

Permalink
use electron-winstaller
Browse files Browse the repository at this point in the history
  • Loading branch information
beyondkmp committed Jul 17, 2024
1 parent 578a7e1 commit 87eb7bf
Show file tree
Hide file tree
Showing 4 changed files with 84 additions and 453 deletions.
3 changes: 1 addition & 2 deletions packages/electron-builder-squirrel-windows/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@
],
"dependencies": {
"app-builder-lib": "workspace:*",
"archiver": "^5.3.1",
"builder-util": "workspace:*",
"fs-extra": "^10.1.0"
"electron-winstaller": "5.3.1"
},
"devDependencies": {
"@types/archiver": "5.3.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { getBinFromUrl } from "app-builder-lib/out/binDownload"
import { Arch, getArchSuffix, SquirrelWindowsOptions, Target } from "app-builder-lib"
import { WinPackager } from "app-builder-lib/out/winPackager"
import * as path from "path"
import { convertVersion, SquirrelBuilder, SquirrelOptions } from "./squirrelPack"
import { Options as SquirrelOptions, createWindowsInstaller, convertVersion } from "electron-winstaller"

export default class SquirrelWindowsTarget extends Target {
//tslint:disable-next-line:no-object-literal-type-assertion
Expand All @@ -22,10 +22,7 @@ export default class SquirrelWindowsTarget extends Target {
const version = packager.appInfo.version
const sanitizedName = sanitizeFileName(this.appName)

// tslint:disable-next-line:no-invalid-template-strings
const setupFile = packager.expandArtifactNamePattern(this.options, "exe", arch, "${productName} Setup ${version}.${ext}")
const packageFile = `${sanitizedName}-${convertVersion(version)}-full.nupkg`

const installerOutDir = path.join(this.outDir, `squirrel-windows${getArchSuffix(arch)}`)
const artifactPath = path.join(installerOutDir, setupFile)

Expand All @@ -40,8 +37,11 @@ export default class SquirrelWindowsTarget extends Target {
}

const distOptions = await this.computeEffectiveDistOptions()
const squirrelBuilder = new SquirrelBuilder(distOptions, installerOutDir, packager)
await squirrelBuilder.buildInstaller({ setupFile, packageFile }, appOutDir, this.outDir, arch)
await createWindowsInstaller({
...distOptions,
appDirectory: appOutDir,
outputDirectory: this.outDir,
})

await packager.info.callArtifactBuildCompleted({
file: artifactPath,
Expand Down Expand Up @@ -102,7 +102,6 @@ export default class SquirrelWindowsTarget extends Target {
const appName = this.appName
const options: SquirrelOptions = {
name: appName,
productName: this.options.name || appInfo.productName,
appId: this.options.useAppIdAsId ? appInfo.id : appName,
version: appInfo.version,
description: appInfo.description,
Expand All @@ -117,7 +116,7 @@ export default class SquirrelWindowsTarget extends Target {
}

if (isEmptyOrSpaces(options.description)) {
options.description = options.productName
options.description = this.options.name || appInfo.productName
}

if (options.remoteToken == null) {
Expand Down
295 changes: 0 additions & 295 deletions packages/electron-builder-squirrel-windows/src/squirrelPack.ts

This file was deleted.

Loading

0 comments on commit 87eb7bf

Please sign in to comment.