电子如何创建增量文件 [英] electron how to create delta file

查看:40
本文介绍了电子如何创建增量文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 electron-builder 来构建我的应用程序,并成功构建了包含三个输出的第一个版本:foosetup.exe,foo-0.0.1-full.nupkg和RELEASES.现在我想要为了实现自动更新,我已经使用 electron-release-server 部署了后端服务.

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.

自动更新需要设置用于获取更新的 feedURL ,但是问题是我不知道更新的确切含义是 foo-0.0.1-full.nupkg foo-0.0.1-delta.nupkg 或其他文件?

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?

第二个问题是我不知道如何创建增量文件.我只能在 electron-builder 中找到一个 remoteReleases 选项,即现有更新的URL.如果给出,将下载这些URL以创建增量文件.但是URL的确切含义是什么?我找到一个示例,其中"remoteRelease":"https://github.com.com/user/repo" ,它会创建一些版本并为每个版本上传许多额外的文件,例如 foosetup.exe foo-xx-full-nupkg 释放.我想 electron-builder 将获取 $ {remoteReleases/release/download/some-version/xxx} 来下载文件然后比较这两个文件以创建增量文件,但是当我在github上创建发行版时,我无法上传 RELEASES ,它报告它们不支持此文件类型.有没有人可以提供帮助?对于初学者而言,需要遵循的文档很少

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

推荐答案

对于电子发布服务器,请查看如果使用 electron-builder ,则将自动创建增量文件.但是,要使此功能正常运行,必须将 remoteReleases 设置为有效(且可访问)的URL plus ,至少必须有一个名为 RELEASES 的空文件..因此,对于第一个版本,只需创建一个空文件,并将其命名为 RELEASES .

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.

在以后的每个版本中,都会为您创建一个 RELEASES 文件.将所有生成的文件扔到发布服务器中(覆盖现有的 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.

注意:对于 electron-release-server ,您不需要 electron-builder 生成的 RELEASES .电子释放服务器将自行创建一个.

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.:

  • 创建目录,然后在其中放置一个空文件 RELEASES .
  • 然后启动指向该目录的简单网络服务器(例如 cd into/your/dir&& php -S 0.0.0.0:80).
  • 编辑您的 package.json :"remoteRelease":"http://localhost"
  • 然后构建您的安装程序: npm run dist 它应该可以成功构建,并且您应该在本地服务器上看到一些GET请求.
  • 接收生成的文件,并将其填充到您创建的目录中.
  • 现在增加您的版本并开始另一个构建: npm run dist 您应该再次看到一些GET请求,并且应该创建一个附加的增量文件.
  • 再次将所有这些内容填充到目录中(或者对于电子发行服务器,将资产.nupkg,.exe和delta上载到新发行版中.)
  • 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.

这篇关于电子如何创建增量文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆