Skip to content
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
15ee162
generate stubExecutableExe and sign it
beyondkmp Mar 14, 2025
3e7b26b
generate _ExecutionStub.exe after prepared vendor
beyondkmp Mar 15, 2025
1134394
add vendor files from winows-installer
beyondkmp Mar 15, 2025
c5c41f5
update squirrel window from https://github.com/beyondkmp/Squirrel.Win…
beyondkmp Mar 15, 2025
bcabba8
change default vendor
beyondkmp Mar 15, 2025
faa8df7
update vendor from https://github.com/beyondkmp/Squirrel.Windows/acti…
beyondkmp Mar 15, 2025
d5bdf42
fix ut
beyondkmp Mar 15, 2025
aea79ff
update ut
beyondkmp Mar 15, 2025
03e9201
update ut
beyondkmp Mar 15, 2025
f3f25c1
change to default vendor when custom vendor is empty
beyondkmp Mar 15, 2025
5d29591
Merge branch 'master' into StubExecutable
mmaietta Mar 15, 2025
49a88b7
fix comments
beyondkmp Mar 17, 2025
dc6c1fb
Merge branch 'master' into StubExecutable
beyondkmp Mar 17, 2025
ecfa950
add vendor to package.json
beyondkmp Mar 18, 2025
b954be0
fix comments
beyondkmp Mar 18, 2025
9800401
fix fileNameWithoutExt with basename .exe
beyondkmp Mar 18, 2025
4c7599d
Merge branch 'master' into StubExecutable
beyondkmp Apr 3, 2025
a5733ba
Merge branch 'master' into StubExecutable
beyondkmp May 21, 2025
713d4f3
refactor: update Squirrel.Windows vendor handling and remove obsolete…
beyondkmp May 29, 2025
1825476
Merge branch 'master' into StubExecutable
beyondkmp May 29, 2025
73db025
chore: remove vendor directory from package.json files list to stream…
beyondkmp May 29, 2025
b7b1b58
chore: update Squirrel.Windows binary version to 2.0.1-patched for im…
beyondkmp May 29, 2025
0e5b61c
chore: update Squirrel.Windows binary download method to use new URL …
beyondkmp May 29, 2025
3b9ba8e
fix: update vendor directory resolution for Squirrel.Windows to ensur…
beyondkmp May 29, 2025
4d18d74
fix: correct path for copying custom Squirrel.Windows binaries to ens…
beyondkmp May 29, 2025
634c84c
Merge branch 'master' into StubExecutable
beyondkmp Jun 5, 2025
3dd31a0
Merge branch 'master' into StubExecutable
mmaietta Jun 5, 2025
439c4ce
Merge branch 'master' into StubExecutable
mmaietta Jun 8, 2025
1cd2bc9
fix comments
beyondkmp Jun 16, 2025
e78f7dd
refactor: improve error handling for missing app executable in Squirr…
beyondkmp Jun 18, 2025
69feef9
Merge branch 'master' into StubExecutable
mmaietta Jun 18, 2025
71ee208
Create lovely-brooms-move.md
mmaietta Jun 18, 2025
a08d1db
Merge branch 'master' into StubExecutable
beyondkmp Jun 22, 2025
390f631
refactor(SquirrelWindowsTarget): replace getBin with getBinFromUrl fo…
beyondkmp Jun 22, 2025
eb5d7b3
use getbin
beyondkmp Jun 22, 2025
f92b073
Merge branch 'master' into StubExecutable
mmaietta Jul 12, 2025
3ad8b8a
fix ut
beyondkmp Jul 17, 2025
2b86c16
Merge branch 'master' into StubExecutable
beyondkmp Jul 17, 2025
07badb5
delete log
beyondkmp Jul 31, 2025
afa0513
Merge branch 'master' into StubExecutable
beyondkmp Jul 31, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { InvalidConfigurationError, log, isEmptyOrSpaces } from "builder-util"
import { execWine } from "app-builder-lib/out/wine"
import { sanitizeFileName } from "builder-util/out/filename"
import { Arch, getArchSuffix, SquirrelWindowsOptions, Target, WinPackager } from "app-builder-lib"
import * as path from "path"
Expand All @@ -18,12 +19,10 @@ export default class SquirrelWindowsTarget extends Target {
}

private async prepareSignedVendorDirectory(): Promise<string> {
// If not specified will use the Squirrel.Windows that is shipped with electron-installer(https://github.com/electron/windows-installer/tree/main/vendor)
// After https://github.com/electron-userland/electron-builder-binaries/pull/56 merged, will add `electron-builder-binaries` to get the latest version of squirrel.
let vendorDirectory = this.options.customSquirrelVendorDir || path.join(require.resolve("electron-winstaller/package.json"), "..", "vendor")
let vendorDirectory = this.options.customSquirrelVendorDir
if (isEmptyOrSpaces(vendorDirectory) || !fs.existsSync(vendorDirectory)) {
log.warn({ vendorDirectory }, "unable to access Squirrel.Windows vendor directory, falling back to default electron-winstaller")
vendorDirectory = path.join(require.resolve("electron-winstaller/package.json"), "..", "vendor")
log.warn({ vendorDirectory }, "unable to access custom Squirrel.Windows vendor directory, falling back to default vendor ")
vendorDirectory = path.resolve(__dirname, "..", "vendor")
}

const tmpVendorDirectory = await this.packager.info.tempDirManager.createTempDir({ prefix: "squirrel-windows-vendor" })
Expand All @@ -33,16 +32,31 @@ export default class SquirrelWindowsTarget extends Target {

const files = await fs.promises.readdir(tmpVendorDirectory)
for (const file of files) {
if (["Squirrel.exe", "StubExecutable.exe"].includes(file)) {
if (file === "Squirrel.exe") {
const filePath = path.join(tmpVendorDirectory, file)
log.debug({ file: filePath }, "signing vendor executable")
await this.packager.sign(filePath)
break
}
}

return tmpVendorDirectory
}

private async generateStubExecutableExe(appOutDir: string, vendorDir: string) {
const files = await fs.promises.readdir(appOutDir, { withFileTypes: true })
for (const file of files) {
if (path.extname(file.name) === ".exe" && path.basename(file.name, "exe") !== "Squirrel") {
const filePath = path.join(appOutDir, file.name)
log.debug({ file: filePath }, "generating stub executable for exe")
const fileNameWithoutExt = file.name.slice(0, -4)
const stubExePath = path.join(appOutDir, `${fileNameWithoutExt}_ExecutionStub.exe`)
await fs.promises.copyFile(path.join(vendorDir, "StubExecutable.exe"), stubExePath)
await execWine(path.join(vendorDir, "WriteZipToSetup.exe"), null, ["--copy-stub-resources", filePath, stubExePath])
await this.packager.sign(stubExePath)
}
}
}

async build(appOutDir: string, arch: Arch) {
const packager = this.packager
const version = packager.appInfo.version
Expand All @@ -60,6 +74,7 @@ export default class SquirrelWindowsTarget extends Target {
})

const distOptions = await this.computeEffectiveDistOptions(appOutDir, installerOutDir, setupFile)
await this.generateStubExecutableExe(appOutDir, distOptions.vendorDirectory!)
await createWindowsInstaller(distOptions)

await packager.signAndEditResources(artifactPath, arch, installerOutDir)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
<file src="*.pak" target="lib\net45" />
<file src="*.exe.config" target="lib\net45" />
<file src="*.exe.sig" target="lib\net45" />
<file src="*_ExecutionStub.exe" target="lib\net45" />
<file src="icudtl.dat" target="lib\net45\icudtl.dat" />
<file src="Squirrel.exe" target="lib\net45\squirrel.exe" />
<file src="LICENSE.electron.txt" target="lib\net45\LICENSE.electron.txt" />
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8" ?>
<!--
<copyright file="app.config" company="Outercurve Foundation">
Copyright (c) 2004, Outercurve Foundation.
This software is released under Microsoft Reciprocal License (MS-RL).
The license and further copyright text can be found in the file
LICENSE.TXT at the root directory of the distribution.
</copyright>
-->
<configuration>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0" />
<supportedRuntime version="v2.0.50727" />
</startup>
<runtime>
<loadFromRemoteSources enabled="true"/>
</runtime>
</configuration>
Binary file not shown.
Binary file not shown.
18 changes: 18 additions & 0 deletions packages/electron-builder-squirrel-windows/vendor/light.exe.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8" ?>
<!--
<copyright file="app.config" company="Outercurve Foundation">
Copyright (c) 2004, Outercurve Foundation.
This software is released under Microsoft Reciprocal License (MS-RL).
The license and further copyright text can be found in the file
LICENSE.TXT at the root directory of the distribution.
</copyright>
-->
<configuration>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0" />
<supportedRuntime version="v2.0.50727" />
</startup>
<runtime>
<loadFromRemoteSources enabled="true"/>
</runtime>
</configuration>
Binary file not shown.
Binary file not shown.
Binary file not shown.
39 changes: 39 additions & 0 deletions packages/electron-builder-squirrel-windows/vendor/template.wxs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension" xmlns:netfx="http://schemas.microsoft.com/wix/NetFxExtension">
<Product Id="*" Name="{{Title}} Deployment Tool" Language="1033" Codepage="{{Codepage}}" Version="!(bind.FileVersion.{{Id}}.exe)" UpgradeCode="{{IdAsGuid1}}" Manufacturer="{{Author}}">

<Package Description="This package installs a deployment tool for {{Title}}. Not {{Title}} itself. {{Title}} is only installed if a user logs into the machine." InstallScope="perMachine" Comments="Comments" InstallerVersion="200" Compressed="yes" Platform="{{Platform}}"/>
<MajorUpgrade AllowSameVersionUpgrades="yes" DowngradeErrorMessage="A later version of this product is already installed. Setup will now exit."/>
<Media Id="1" Cabinet="contents.cab" EmbedCab="yes" CompressionLevel="high"/>

<PropertyRef Id="NETFRAMEWORK45" />

<Condition Message="This application requires .NET Framework 4.5 or higher. Please install the latest .NET Framework then run this installer again.">
<![CDATA[Installed OR NETFRAMEWORK45]]>
</Condition>

<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="{{ProgramFilesFolder}}">
<Directory Id="APPLICATIONROOTDIRECTORY" Name="{{Title}} Deployment" />
</Directory>
</Directory>

<DirectoryRef Id="APPLICATIONROOTDIRECTORY">
<Component Id="{{Id}}.exe" Guid="{{IdAsGuid2}}" Win64="{{Win64YesNo}}">
<File Id="{{Id}}.exe" Name="{{Id}}DeploymentTool.exe" Source="./Setup.exe" KeyPath="yes"/>
</Component>
</DirectoryRef>

<DirectoryRef Id="TARGETDIR">
<Component Id="RegistryEntries" Guid="{{IdAsGuid3}}" Win64="{{Win64YesNo}}">
<RegistryKey Root="HKLM" Key="SOFTWARE\Microsoft\Windows\CurrentVersion\Run">
<RegistryValue Type="expandable" Name="{{Id}}Deployment" Value="&quot;[#{{Id}}.exe]&quot; --checkInstall" />
</RegistryKey>
</Component>
</DirectoryRef>

<Feature Id="MainApplication" Title="Main Application" Level="1">
<ComponentRef Id="{{Id}}.exe" />
<ComponentRef Id="RegistryEntries" />
</Feature>
</Product>
</Wix>
Binary file not shown.
Binary file not shown.
Binary file not shown.