构建
当你开发完成之后,需要构建相应的资源或程序,并通过预览模式(未打包的prod环境),检查你的程序是否运行正常。
# 构建
# 静态资源
./public
目录,electron 生产环境使用。
# 前端资源
./public/dist
# 一些页面
./public/html
# 一些图片
./public/images
# ssl证书
./public/ssl
./go/public
目录,由move
命令生成;go 生产环境使用,会打包进程go的可执行程序中。
# 程序基础信息
./go/public/package.json
# 配置
./go/public/config
./go/public/dist
./go/public/html
./go/public/images
./go/public/ssl
# 生成 go 程序
首先生成前端资源并移动,查看教程中,
构建前端资源并移动
部分。把静态资源嵌入到go 并 构建程序。
配置 package.json
"scripts": {
// 构建 windows 平台程序
"build-go-w": "ee-bin move --flag=go_static,go_config,go_package,go_images && ee-bin build --cmds=go_w",
// 构建 macOS 平台程序
"build-go-m": "ee-bin move --flag=go_static,go_config,go_package,go_images && ee-bin build --cmds=go_m",
// 构建 linux 平台程序
"build-go-l": "ee-bin move --flag=go_static,go_config,go_package,go_images && ee-bin build --cmds=go_l",
}
举例说明:
npm run build-go-w
该命令执行 配置中的:
"ee-bin move --flag=go_static,go_config,go_package,go_images && ee-bin build --cmds=go_w"
它包含两个命令:
ee-bin move
把public/
中的资源,移动到./go/public/
,它会被嵌入go的可执行程序中。ee-bin build
用来生产go的可执行程序。
ee-bin配置与说明:查看
- 程序位置
./build/extraResources/goapp
# 预发布模式
测试一下功能是否正常(当前环境变量为:prod)
npm run start
# 生成桌面软件
请参见:生成软件
上次更新: 2025/04/10, 03:07:49