electronnsiselectron-builderelectron-updater

Electron nsis-web, how to change artifacts names


How to change artifacts name, for nsis-web with autoupdater? By default archives for web installer named like {appName}{version}-{arch}.{ext}

• building embedded block map  file=dist/nsis-web/app-1.0.0-ia32.nsis.7z
• building embedded block map  file=dist/nsis-web/app-1.0.0-x64.nsis.7z

How i can remove versioning from here?

It should be like this

• building embedded block map  file=dist/nsis-web/app-ia32.nsis.7z
• building embedded block map  file=dist/nsis-web/app-x64.nsis.7z

Solution

  • I have the same problem,
    in short, UNFORTUNATELY YOU CAN'T.

    I went to look at the code of electron-builder:

     const archiveFile = path.join(this.outDir, `${packager.appInfo.sanitizedName}-${packager.appInfo.version}-${Arch[arch]}.nsis.${format}`)   
    ... [some code]...
    
        // [THE NEXT CODE IS THE ONE ARCHIVING YOUR NSIS]
        if (isBuildDifferentialAware && this.isWebInstaller) {
          const data = await appendBlockmap(archiveFile)
    
    ... [more code]...
    
    

    https://github.com/electron-userland/electron-builder/blob/040327814e8299340c4755d3ad05958e6925aab1/packages/app-builder-lib/src/targets/nsis/NsisTarget.ts#L19

    this is the code that archive the webNsis,you can see that it uses const archiveFile as a parameter for appendBlockmap(), but you can't set the value of this const and it is hard coded

    artifactName controls only the .exe file name, not the nsis.7z constant.