Repository: electron-userland/electron-builder
File: packages/electron-builder-squirrel-windows/src/SquirrelWindowsTarget.ts (TypeScript)

Code before:
    distOptions.fixUpPaths = true
    distOptions.setupExe = setupFile
    if (this.options.msi) {
      distOptions.setupMsi = setupFile.replace(".exe", ".msi")
    }
    await createWindowsInstaller(distOptions)

    await packager.signAndEditResources(artifactPath, arch, installerOutDir)
    if (this.options.msi && process.platform === "win32") {
      await packager.sign(artifactPath.replace(".exe", ".msi"))
    }

    await packager.info.callArtifactBuildCompleted({
      file: artifactPath,
      target: this,
      arch,
      safeArtifactName: `${sanitizedName}-Setup-${version}${getArchSuffix(arch)}.exe`,
      packager: this.packager,
    })

    if (this.options.msi) {
      await packager.info.callArtifactBuildCompleted({
        file: artifactPath.replace(".exe", ".msi"),
        target: this,
        arch,
        safeArtifactName: `${sanitizedName}-Setup-${version}${getArchSuffix(arch)}.msi`,
        packager: this.packager,
      })
    }

    const packagePrefix = `${this.appName}-${convertVersion(version)}-`
    packager.info.dispatchArtifactCreated({
      file: path.join(installerOutDir, `${packagePrefix}full.nupkg`),
      target: this,
      arch,
      packager,
    })
    if (distOptions.remoteReleases != null) {
      packager.info.dispatchArtifactCreated({
        file: path.join(installerOutDir, `${packagePrefix}delta.nupkg`),
        target: this,
        arch,
        packager,
      })
    }

    packager.info.dispatchArtifactCreated({
      file: path.join(installerOutDir, "RELEASES"),
      target: this,
      arch,
      packager,

Review comment (security):
Nit: `safeArtifactName` is the same format. Could be worth pulling out into a common function
```
const safeArtifactName = (ext) => `${sanitizedName}-Setup-${version}${getArchSuffix(arch)}.${ext}`
```

Code after:
    await packager.info.callArtifactBuildCompleted({
      file: artifactPath,
      target: this,
      arch,
      safeArtifactName: safeArtifactName("exe"),
      packager: this.packager,
    })

    if (this.options.msi) {
      await packager.info.callArtifactBuildCompleted({
        file: msiArtifactPath,
        target: this,
        arch,
        safeArtifactName: safeArtifactName("msi"),
        packager: this.packager,
      })
    }

    const packagePrefix = `${this.appName}-${convertVersion(version)}-`
    packager.info.dispatchArtifactCreated({
      file: path.join(installerOutDir, `${packagePrefix}full.nupkg`),
      target: this,
      arch,
      packager,
    })
    if (distOptions.remoteReleases != null) {
      packager.info.dispatchArtifactCreated({
        file: path.join(installerOutDir, `${packagePrefix}delta.nupkg`),
        target: this,
        arch,
        packager,
      })
    }

    packager.info.dispatchArtifactCreated({
      file: path.join(installerOutDir, "RELEASES"),
      target: this,
      arch,
      packager,
    })
  }

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

  private select7zipArch(vendorDirectory: string) {
    // https://github.com/electron/windows-installer/blob/main/script/select-7z-arch.js
    // Even if we're cross-compiling for a different arch like arm64,
    // we still need to use the 7-Zip executable for the host arch
    const resolvedArch = os.arch