electron使用electron-builder macOS windows 打包 签名 更新 上架

0. 前言

0.1 项目工程

看清目录结构,以便您阅读后续内容

0.2 参考资料

(1)macOS开发 证书等配置/打包后导出及上架

https://www.jianshu.com/p/c9c71f2f6eac首先需要为Mac App创建App ID: 填写信息如下—Description为"ProjectNameForMac"、Bundle ID为"com.CompanyName...icon-default.png?t=N7T8https://www.jianshu.com/p/c9c71f2f6eac(2) electron应用提交到Mac App Store(MAS)全流程

https://www.jianshu.com/p/3f4765c319b6icon-default.png?t=N7T8https://www.jianshu.com/p/3f4765c319b6

1. 安装electron-builder

2. macOS

2.1 创建 Certificates, Identifiers & Profiles Devices

在mac上安装xcode,打开xcode,然后按以下步骤操作。

(1) xcode的菜单栏:xcode > settings。登录apple id。

(2) 登录后,点击“Download  Manual Profiles”,再然后点击“Manage Certificates...”

再添加下面4个证书,创建后,该证书会自动在 网页上显示出来。

Sign In - Appleicon-default.png?t=N7T8https://developer.apple.com/account/resources/certificates/list

(3)打开以下网址,就会看到前一步创建的 证书

https://developer.apple.com/account/resources/certificates/list

(4) 创建 Identifiers

(5)创建 Devices(这个自行百度吧)

(6)创建Profiles

2.2 下载 Certificates Profiles 到本地 resource文件中

点击 Certificates 列表中的证书,然后点击“download”

在 Profiles 列表中点击“download”

2.3 检查macOS系统的证书配置情况

在 2.1 的步骤用xcode创建证书后,证书会显示在 钥匙串 中(自行百度打开这个程序)

(1) 登录>我的证书 中会看到以下两个证书(还有一个证书 Mac Developer ID Application的证书让我删除了,没在截图中)

(2) 登录>密钥 中会看到以下四个密钥

(3) 系统>我的证书 中会看到以下一个证书

(4) 系统>证书 中会看到以下两个证书

注意注意注意注意注意:

(1) 在每一张单个截图(不是所有截图,只指单个截图)中,证书不能重复,切记(血的教训,不要问为什么,我也不能给你解释清楚)。

如果重复了,就删除这些证书,然后把 2.2下载的cer后缀的证书 在macOS中双击,则就会安装到 “钥匙串访问”程序中

(2) 如果在 系统>证书 的列表中找到“Apple Worldwide Developer Relations Certification Authority”,则从官网下载,至于下载哪个,我也忘记了,你自己 研究一下,大概是 截图中任意一个即可,呵呵。

(3)以上截图中证书的位置大抵如此,反正我就是这么成功的,我也没空再去研究了。如果你没成功,那可以参考我的截图中证书的位置,至少能成功。

https://www.apple.com/certificateauthority/

2.4 安装 provisionprofile 文件

我也不知道要不要安装,反正我是安装了,干脆你也安装吧。

安装后,在此处 会显示这玩意,貌似“greader_distribution.provisionprofile”装上上

2.4 导出 p12文件,以备后用

导出以下四个文件,导出时要求输入密码,你自己输入吧(假设我设置的密码为 gege123)

四个文件的名字各种对应哪个证书,你自己猜猜看。

2.5 再次查看证书情况

打开shell,输入如下命令

xcrun security find-identity -v -p codesigning

注意:不要他奶奶的切换到 sudo su,就用你的正常 用户

看到没,有4个证书安装成功了,如果不成功,就根据2.3重新来一次。

2.6 创建plist文件,以备后用

我也不知道为啥要搞这些文件,你搞就对了。

(1) entitlements.mas.loginhelper.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0"><dict><key>com.apple.security.app-sandbox</key><true/></dict>
</plist>

(2) entitlements.mas.plist

文件中部分内容替换您自己的

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0"><dict><key>com.apple.security.app-sandbox</key><true/><key>com.apple.security.application-groups</key><array><string>GN5XP7HD2C.cn.rouhuasuan.greader (改成你自己的哈)</string></array><key>com.apple.application-identifier</key><string>GN5XP7HD2C.cn.rouhuasuan.greader (改成你自己的哈)</string><key>com.apple.security.network.client</key><true/><key>com.apple.security.network.server</key><true/><key>com.apple.security.cs.allow-jit</key><true/><key>com.apple.security.cs.allow-unsigned-executable-memory</key><true/><key>com.apple.security.cs.allow-dyld-environment-variables</key><true/><key>com.apple.security.files.user-selected.read-only</key><true/><key>com.apple.security.files.user-selected.read-write</key><true/><key>com.apple.security.files.downloads.read-write</key><true/></dict>
</plist>

(3)entitlements.mas.inherit.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0"><dict><key>com.apple.security.app-sandbox</key><true/><key>com.apple.security.inherit</key><true/></dict>
</plist>

2.7 package.json 配置

2.7.1 整体配置

(1)总体配置如下,但是根据不同的包格式,得做简单修改。

(2)在后文我也不解释有啥区别,你自己对比一下就知道了。

{"name": "greader","productName": "greader","version": "22.7.8","description": "A reader with transparent window background, arbitrary window size, and auto-hide","author": {"name": "youername","email": "youeremail","url": "youer office site"},"main": "src/bootstrap.js","scripts": {"pack": " electron-builder --dir ","win": " electron-builder --win --x64","mac": " electron-builder --mac","postinstall": "electron-builder install-app-deps"},"keywords": [],"license": "MIT","dependencies": {"bytenode": "^1.5.0","dayjs": "^1.11.8","electron-log": "^4.4.8","iconv-lite": "^0.6.3","jschardet": "^3.0.0","node-machine-id": "^1.1.12","yarn": "^1.22.21"},"devDependencies": {"electron": "25.3.0","electron-builder": "^24.6.4"},"build": {"appId": "GN5XP7HD2C.cn.rouhuasuan.greader","productName": "Greader","copyright": "Copyright © 2021 Alaso","directories": {"buildResources": "build","output": "dist"},"mac": {"category": "public.app-category.utilities","target":["dmg", "pkg", "mas", "mas-dev"],"hardenedRuntime": true,"gatekeeperAssess": false,"icon":"resource/mac.icns","entitlements": "./resource/entitlements.mas.plist","entitlementsInherit": "./resource/entitlements.mas.inherit.plist","extendInfo": {"ElectronTeamID": "GN5XP7HD2C","com.apple.developer.team-identifier": "GN5XP7HD2C","com.apple.application-identifier": "GN5XP7HD2C.cn.rouhuasuan.greader","Bundle name": "Greader","LSHasLocalizedDisplayName": true,"ITSAppUsesNonExemptEncryption": "NO"}},"mas": {"type": "distribution","identity": "penghui deng (GN5XP7HD2C)","hardenedRuntime" : false,   "provisioningProfile": "./resource/greader_distribution.provisionprofile"},"masDev": {"type": "development","identity": "penghui deng (8MUK7LXZQ5)","hardenedRuntime": false,"provisioningProfile": "./resource/greader_development.provisionprofile"},"dmg": {},"pkg": {"identity": "penghui deng (GN5XP7HD2C)"},"win":{"target": ["nsis", "msi", "zip"],"icon": "resource/win.ico"},"nsis": {"oneClick": false,"perMachine": false,"allowToChangeInstallationDirectory": true},"msi": {"menuCategory": "bestapp"}}
}

2.7.2 编译mas-dev

(1)package配置

{"name": "greader","productName": "greader","version": "22.7.8","description": "A reader with transparent window background, arbitrary window size, and auto-hide","author": {"name": "youername","email": "youeremail","url": "youer office site"},"main": "src/bootstrap.js","scripts": {"pack": " electron-builder --dir ","win": " electron-builder --win --x64","mac": " electron-builder --mac","postinstall": "electron-builder install-app-deps"},"keywords": [],"license": "MIT","dependencies": {"bytenode": "^1.5.0","dayjs": "^1.11.8","electron-log": "^4.4.8","iconv-lite": "^0.6.3","jschardet": "^3.0.0","node-machine-id": "^1.1.12","yarn": "^1.22.21"},"devDependencies": {"electron": "25.3.0","electron-builder": "^24.6.4"},"build": {"appId": "GN5XP7HD2C.cn.rouhuasuan.greader","productName": "Greader","copyright": "Copyright © 2021 Alaso","directories": {"buildResources": "build","output": "dist"},"mac": {"category": "public.app-category.utilities","target":["mas-dev"],"hardenedRuntime": true,"gatekeeperAssess": false,"icon":"resource/mac.icns","entitlements": "./resource/entitlements.mas.plist","entitlementsInherit": "./resource/entitlements.mas.inherit.plist","extendInfo": {"ElectronTeamID": "GN5XP7HD2C","com.apple.developer.team-identifier": "GN5XP7HD2C","com.apple.application-identifier": "GN5XP7HD2C.cn.rouhuasuan.greader","Bundle name": "Greader","LSHasLocalizedDisplayName": true,"ITSAppUsesNonExemptEncryption": "NO"}},"mas": {"type": "distribution","identity": "penghui deng (GN5XP7HD2C)","hardenedRuntime" : false,   "provisioningProfile": "./resource/greader_distribution.provisionprofile"},"masDev": {"type": "development","identity": "penghui deng (8MUK7LXZQ5)","hardenedRuntime": false,"provisioningProfile": "./resource/greader_development.provisionprofile"},"dmg": {},"pkg": {"identity": "penghui deng (GN5XP7HD2C)"},"win":{"target": ["nsis", "msi", "zip"],"icon": "resource/win.ico"},"nsis": {"oneClick": false,"perMachine": false,"allowToChangeInstallationDirectory": true},"msi": {"menuCategory": "bestapp"}}
}

(2)执行命令

export CSC_IDENTITY_AUTO_DISCOVERY=false
export CSC_LINK=/Users/dhzy/Desktop/project2/cer/appdev.p12
export CSC_KEY_PASSWORD=gege123
export CSC_NAME="penghui deng (8MUK7LXZQ5)"
yarn mac注意:yarn mac 也可以用 npm run mac代替

2.7.3 编译mas

这个是要发布到 mac store的,不能直接运行

(1)package配置

{"name": "greader","productName": "greader","version": "22.7.8","description": "A reader with transparent window background, arbitrary window size, and auto-hide","author": {"name": "youername","email": "youeremail","url": "youer office site"},"main": "src/bootstrap.js","scripts": {"pack": " electron-builder --dir ","win": " electron-builder --win --x64","mac": " electron-builder --mac","postinstall": "electron-builder install-app-deps"},"keywords": [],"license": "MIT","dependencies": {"bytenode": "^1.5.0","dayjs": "^1.11.8","electron-log": "^4.4.8","iconv-lite": "^0.6.3","jschardet": "^3.0.0","node-machine-id": "^1.1.12","yarn": "^1.22.21"},"devDependencies": {"electron": "25.3.0","electron-builder": "^24.6.4"},"build": {"appId": "GN5XP7HD2C.cn.rouhuasuan.greader","productName": "Greader","copyright": "Copyright © 2021 Alaso","directories": {"buildResources": "build","output": "dist"},"mac": {"category": "public.app-category.utilities","target":["mas"],"hardenedRuntime": true,"gatekeeperAssess": false,"icon":"resource/mac.icns","entitlements": "./resource/entitlements.mas.plist","entitlementsInherit": "./resource/entitlements.mas.inherit.plist","extendInfo": {"ElectronTeamID": "GN5XP7HD2C","com.apple.developer.team-identifier": "GN5XP7HD2C","com.apple.application-identifier": "GN5XP7HD2C.cn.rouhuasuan.greader","Bundle name": "Greader","LSHasLocalizedDisplayName": true,"ITSAppUsesNonExemptEncryption": "NO"}},"mas": {"type": "distribution","identity": "penghui deng (GN5XP7HD2C)","hardenedRuntime" : false,   "provisioningProfile": "./resource/greader_distribution.provisionprofile"},"masDev": {"type": "development","identity": "penghui deng (8MUK7LXZQ5)","hardenedRuntime": false,"provisioningProfile": "./resource/greader_development.provisionprofile"},"dmg": {},"pkg": {"identity": "penghui deng (GN5XP7HD2C)"},"win":{"target": ["nsis", "msi", "zip"],"icon": "resource/win.ico"},"nsis": {"oneClick": false,"perMachine": false,"allowToChangeInstallationDirectory": true},"msi": {"menuCategory": "bestapp"}}
}

(2)执行命令

export CSC_IDENTITY_AUTO_DISCOVERY=false
export CSC_LINK=/Users/dhzy/Desktop/project2/cer/appdis.p12
export CSC_KEY_PASSWORD=greader123
export CSC_NAME="penghui deng (GN5XP7HD2C)"
yarn mac

2.7.4 编译dmg、pkg包

(1)package配置

{"name": "greader","productName": "greader","version": "22.7.8","description": "A reader with transparent window background, arbitrary window size, and auto-hide","author": {"name": "youername","email": "youeremail","url": "youer office site"},"main": "src/bootstrap.js","scripts": {"pack": " electron-builder --dir ","win": " electron-builder --win --x64","mac": " electron-builder --mac","postinstall": "electron-builder install-app-deps"},"keywords": [],"license": "MIT","dependencies": {"bytenode": "^1.5.0","dayjs": "^1.11.8","electron-log": "^4.4.8","iconv-lite": "^0.6.3","jschardet": "^3.0.0","node-machine-id": "^1.1.12","yarn": "^1.22.21"},"devDependencies": {"electron": "25.3.0","electron-builder": "^24.6.4"},"build": {"appId": "GN5XP7HD2C.cn.rouhuasuan.greader","productName": "Greader","copyright": "Copyright © 2021 Alaso","directories": {"buildResources": "build","output": "dist"},"mac": {"category": "public.app-category.utilities","target":["dmg", "pkg"],"hardenedRuntime": true,"gatekeeperAssess": false,"icon":"resource/mac.icns","entitlements": "./resource/entitlements.mas.plist","entitlementsInherit": "./resource/entitlements.mas.inherit.plist","extendInfo": {"ElectronTeamID": "GN5XP7HD2C","com.apple.developer.team-identifier": "GN5XP7HD2C","com.apple.application-identifier": "GN5XP7HD2C.cn.rouhuasuan.greader","Bundle name": "Greader","LSHasLocalizedDisplayName": true,"ITSAppUsesNonExemptEncryption": "NO"}},"mas": {"type": "distribution","identity": "penghui deng (GN5XP7HD2C)","hardenedRuntime" : false,   "provisioningProfile": "./resource/greader_distribution.provisionprofile"},"masDev": {"type": "development","identity": "penghui deng (8MUK7LXZQ5)","hardenedRuntime": false,"provisioningProfile": "./resource/greader_development.provisionprofile"},"dmg": {},"pkg": {"identity": "penghui deng (GN5XP7HD2C)"},"win":{"target": ["nsis", "msi", "zip"],"icon": "resource/win.ico"},"nsis": {"oneClick": false,"perMachine": false,"allowToChangeInstallationDirectory": true},"msi": {"menuCategory": "bestapp"}}
}

(2)执行命令

export CSC_IDENTITY_AUTO_DISCOVERY=false
export CSC_LINK=/Users/dhzy/Desktop/project2/cer/appdis.p12
export CSC_KEY_PASSWORD=greader123
export CSC_NAME="penghui deng (GN5XP7HD2C)"
yarn mac

2.7.5 相关异常问题

(1)如果出现什么 timestamp XXXX 的

没有联网,或者网络不好,多次尝试。也不要使用代理,代理可能导致失败。

(2)

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.rhkb.cn/news/200465.html

如若内容造成侵权/违法违规/事实不符,请联系长河编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

(02)vite环境变量配置

文章目录 将开发环境和生产环境区分开环境变量vite处理环境变量loadEnv 业务代码需要使用环境变量.env.env.development.env.test修改VITE_前缀 将开发环境和生产环境区分开 分别创建三个vite 的配置文件&#xff0c;并将它们引入vite.config.js vite.base.config.js import…

Kubernetes Gateway API 攻略:解锁集群流量服务新维度!

Kubernetes Gateway API 刚刚 GA&#xff0c;旨在改进将集群服务暴露给外部的过程。这其中包括一套更标准、更强大的 API资源&#xff0c;用于管理已暴露的服务。在这篇文章中&#xff0c;我将介绍 Gateway API 资源&#xff0c;并以 Istio 为例来展示这些资源是如何关联的。通…

C语言scanf_s函数的使用

因为scanf函数存在缓冲区溢出的可能性&#xff1b;提供了scanf_s函数&#xff1b;增加一个参数&#xff1b; scanf_s最后一个参数是缓冲区的大小&#xff0c;表示最多读取n-1个字符&#xff1b; 下图代码&#xff1b; 读取整型数可以不指定长度&#xff1b;读取char&#xf…

VMware安装kali(详细版)

如果不详细&#xff0c;你就留言骂我&#xff01; 文章目录 前言一、安装VMware二、安装KALI安装KALI配置网络总结 前言 今天更VMware安装kali 一、安装VMware VMware网址 安装之前&#xff0c;建议先退出360、电脑管家等杀毒软件&#xff0c;Win10操作系统好像还需要检查一…

HTML5生成二维码

H5生成二维码 前言二维码实现过程页面实现关键点全部源码 前言 本文主要讲解如何通过原生HTML、CSS、Js中的qrcodejs二维码生成库&#xff0c;实现一个输入URL按下回车后输出URL。文章底部有全部源码&#xff0c;需要可以自取。 实现效果图&#xff1a; 上述实现效果为&#…

TensorFlow实战教程(十八)-Keras搭建卷积神经网络及CNN原理详解

从本专栏开始,作者正式研究Python深度学习、神经网络及人工智能相关知识。前一篇文章详细讲解了Keras实现分类学习,以MNIST数字图片为例进行讲解。本篇文章详细讲解了卷积神经网络CNN原理,并通过Keras编写CNN实现了MNIST分类学习案例。基础性文章,希望对您有所帮助! 一…

[Linux] 进程入门

&#x1f4bb;文章目录 &#x1f4c4;前言计算机的结构体系与概念冯诺依曼体系结构操作系统概念目的与定位 进程概念描述进程-PCBtask_struct检查进程利用fork创建子进程 进程状态进程状态查看僵尸进程孤儿进程 &#x1f4d3;总结 &#x1f4c4;前言 作为一名程序员&#xff0c…

同为科技(TOWE)桌面PDU插排:一款可以DIY定制的“超级插座”

当今社会&#xff0c;各种电子产品和家用电器已成为人们日常生活中不可或缺的一部分&#xff0c;在带给人们便利的同时&#xff0c;也使得电力使用变得更加频繁和重要。然而&#xff0c;当前市面上很多普通插座由于功能单一、材质粗劣、插口数量受限、充电速度过慢、插头间互相…

【shell】 1、bash语法超详细介绍

文章目录 修改前缀路径dirname set常用函数参数变量local 返回值正则打印第 n 行获取行号核对数据库各表数量jq查询检查日志 sshpassexpect数组xargs bash manual 修改前缀 参考 export PS1"bash> "路径 dirname strip last component from file name dir$(…

CMap数据库筛选化学药物

数据库clue.io 文献链接&#xff1a;连接图谱&#xff1a;使用基因表达特征连接小分子、基因和疾病 |科学 (science.org) 基本模式&#xff1a;利用CMap将差异基因列表与数据库参考数据集比对&#xff1b;根据差异表达基因在参考基因表达谱富集情况得到一个相关性分数&#…

新加坡服务器托管-金融企业的选择

新加坡作为一个亚洲金融中心&#xff0c;其优越的地理位置和先进的信息通信技术基础设施&#xff0c;使得其成为了众多金融机构企业选择服务器机房托管的理想地点。金融行业对于服务器的安全性和可靠性要求很高&#xff0c;而将服务器托管在新加坡有许多好处。 首先&#xff0c…

复杂类型,查询--学习笔记

1&#xff0c;复杂类型 解决问题&#xff1a;一些不容易获取到的数据&#xff0c;例如数组类型&#xff0c;集合类型等&#xff0c;获取他们的数据 -- 1.创建表 create table tb_array_person(name string,city_array array<string> )row format delimited fields term…

HarmonyOS ArkTSTabs组件的使用(六)

Tabs组件的使用 ArkUI开发框架提供了一种页签容器组件Tabs&#xff0c;开发者通过Tabs组件可以很容易的实现内容视图的切换。页签容器Tabs的形式多种多样&#xff0c;不同的页面设计页签不一样&#xff0c;可以把页签设置在底部、顶部或者侧边。 Tabs组件的简单使用 Tabs组件…

网络参考模型与标准协议(二)-TCP/IP对等模型详细介绍

应用层 应用层为应用软件提供接口&#xff0c;使应用程序能够使用网络服务。应用层协议会指定使用相应的传输层协议&#xff0c;以及传输层所使用的端口等。TCP/IP每一层都让数据得以通过网络进行传输&#xff0c;这些层之间使用PDU ( Paket Data Unit,协议数据单元)彼此交换信…

局域网文件共享神器:Landrop

文章目录 前言解决方案Landrop软件界面手机打开效果 软件操作 前言 平常为了方便传文件&#xff0c;我们都是使用微信或者QQ等聊天软件&#xff0c;互传文件。这样传输有两个问题&#xff1a; 必须登录微信或者QQ聊天软件。手机传电脑还有网页版微信&#xff0c;电脑传手机比…

gitlab 实战

一.安装依赖 yum install -y curl policycoreutils-python openssh-server perl 二.安装gitlab yum install gitlab-jh-16.0.3-jh.0.el7.x86_64.rpm 三.修改下面的 vim /etc/gitlab/gitlab.rbexternal_url http://192.168.249.156 四.初始化 gitlab-ctl reconfigure 五.查看状…

OpenStack-train版安装之环境准备

环境准备 环境介绍VMware配置WMware虚拟机最低配置WMware添加网卡WMware添加硬盘 基础环境安装修改各节点的主机名修改各节点的hosts文件修改各节点的内核参数关闭各节点的防火墙和selinux安装NPT&#xff08;时间同步&#xff09;安装OpenStack基础服务包 CentOS升级内核 环境…

C++ Qt 学习(九):模型视图代理

1. Qt 模型视图代理 Qt 模型视图代理&#xff0c;也可以称为 MVD 模式 模型(model)、视图(view)、代理(delegate)主要用来显示编辑数据 1.1 模型 模型 (Model) 是视图与原始数据之间的接口 原始数据可以是&#xff1a;数据库的一个数据表、内存中的一个 StringList&#xff…

集合的自反关系和对称关系

集合的自反关系和对称关系 一&#xff1a;集合的自反关系1&#xff1a;原理&#xff1a;2&#xff1a;代码实现 二&#xff1a;对称关系1&#xff1a;原理&#xff1a;2&#xff1a;代码实现 三&#xff1a;总结 一&#xff1a;集合的自反关系 1&#xff1a;原理&#xff1a; …

简单但好用:4种Selenium截图方法了解一下!

前言 我们执行UI自动化操作时&#xff0c;大多数时间都是不在现场的&#xff0c;出现错误时&#xff0c;没有办法第一时间查看到&#xff0c;这时我们可以通过截图当时出错的场景保存下来&#xff0c;后面进行查看报错的原因&#xff0c;Selenium中提供了几种截图的方法&#x…