Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

尝试 Electron Builder #129

Open
lmk123 opened this issue Dec 21, 2023 · 0 comments
Open

尝试 Electron Builder #129

lmk123 opened this issue Dec 21, 2023 · 0 comments
Labels

Comments

@lmk123
Copy link
Owner

lmk123 commented Dec 21, 2023

昨天尝试了下 Electron Forge,今天尝试下 Electron Builder。

第一次尝试选择 Forge 有两个原因:

  • 它受到 Electron 官方支持
  • 它文档更简单直观

然后这次尝试了下 Electron Builder,我发现我被它文档里复杂的 Configuration 给骗了,虽然它文档看起来复杂,但是使用起来是真的简单……

给现有的 Electron 项目集成 electron builder 只需要一句命令:npx electron-builder

对的,只需要这一句命令就可以了——无需任何配置,这一条命令就能在我的 Apple M1 上打包好 arm64 的 dmg 命令,是真正意义上的零配置。

而且,它输出的日志也很有用,会提醒我 description / author 没有声明、没有找到 apple 账户所以无法给应用签名,甚至下载 electron 二进制文件的时候会使用我在 .npmrc 里定义的镜像地址。

真的太好用了 😂

要同时打包 arm64 和 x64 的 dmg 包,加如下配置文件即可:

electron-builder.yml

mac:
  target:
    - target: dmg
      arch:
        - x64
        - arm64

也不会遇到 electron forge 上奇奇怪怪的问题,一次就能成功。

一些注意事项:

  • electron builder 在所有操作上都会用 aser 包,但有时候(比如运行 electron-builder --dir 的时候)我想看一下哪些文件被打包进去了,这时候就需要避免使用 aser
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant