'electron how to create delta file
I use electron-builder
to build my app and succeed to build the first version which contains three outputs: foosetup.exe, foo-0.0.1-full.nupkg and RELEASES.Now I want to implement the auto-update and I have deployed a back-end service by using electron-release-server
.
The auto-update need to set a feedURL
which will be used to fetch updates,but the problem is that I don't know what the updates exactly means?Is it the foo-0.0.1-full.nupkg
or the foo-0.0.1-delta.nupkg
or another file?
The second problem is that I don't know how to create the delta file.I can just find an option remoteReleases
in electron-builder
which is a URL to your existing updates.If given,these will be downloaded to create delta file
.But what's the URL exactly means?I find a example i which "remoteRelease": "https://github.com/user/repo"
,and it creates some releases and uploads many extra files for each release such as foosetup.exe
, foo-xx-full-nupkg
, RELEASES
.I guess electron-builder
will fetch the ${remoteReleases/release/download/some-version/xxx}
to download file and then diff the two file to create delta file,but I can't upload RELEASES
when I create release on github,it reports that they don't support this file type
.
Is there anyone can help?There're to few docs to follow for a beginer
Solution 1:[1]
For electron-release-server please take a look at the docs.
The delta-file will be create automatically if you use electron-builder. But in order for this to work remoteReleases
must be set to a valid (and reachable) URL plus there must at least an empty file called RELEASES
. So for the very first build just create an empty file and call it RELEASES
.
On every future build there will be a RELEASES
file created for you. Threw all the generated files in your release server (overwrite existing RELEASES
) and it'll be fine.
Attention: For electron-release-server
you do not need the RELEASES
generated by electron-builder
. electron-release-server will create one by itself.
To get started with auto-updates I'd recommend that you set up a dead-simple release-server locally. I. e.:
- Create a directory and throw an empty file
RELEASES
in there. - Then start a simple webserver pointing at that directory (e. g.
cd into/your/dir && php -S 0.0.0.0:80
). - Edit your
package.json
:"remoteRelease": "http://localhost"
- Then build your installer:
npm run dist
It should successfully build and you should see some GET requests on your local server. - Take the generated files and stuff them into the directory you created.
- Now increment your version and start another build:
npm run dist
You should see some GET requests again and there should be an addition delta-file being created. - Again stuff all those things into the directory (or for electron-release-server upload the assets .nupkg, .exe and delta into a new release).
Hope that helps. Feel free to comment if something is unclear.
Solution 2:[2]
Check out this sample app that I have created https://github.com/electron-delta/electron-sample-app
It uses two npm packages.
- @electron-delta/builder
- @electron-delta/updater
More details https://github.com/electron-delta/electron-delta#installation
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | m02ph3u5 |
Solution 2 | Sandeep Acharya |