bin
# 介绍
命令行模块。从ee-core
包中分离出来,仅在开发环境使用,同时也减小了安装包大小。
# 配置文件
ee-bin:v1.2.0
v1.2.0 新增配置文件,便于处理更复杂的脚本,同时简化命令行。
查看教程:开发配置
./electron/config/bin.js
# 从ee-core升级ee-bin
ee-core v2.4.0
之后,将不在提供bin功能,请做如下修改:
# 安装 ee-bin
npm i ee-bin -D
# 修改 package.json
"scripts": {
"rd": "ee-bin rd",
"encrypt": "ee-bin encrypt",
"clean": "ee-bin clean",
"icon": "ee-bin icon",
}
# API列表
# dev
- serve - 'frontend' | 'electron' | go
启动模式,frontend
前端;electron
主进程;go
go服务;为空时,都启动。更多详情见bin配置。
ee-bin dev
ee-bin dev --serve=frontend
ee-bin dev --serve=electron
ee-bin dev --serve=go
# build
构建前端、go、或 自定义命令。更多详情见bin配置。
ee-bin build --cmds=frontend
ee-bin build --cmds=go_build_w
ee-bin build --cmds=go_build_m
ee-bin build --cmds=go_build_l
# start
预发布模式(环境变量为:prod),构建可执行程序前,请使用该模式测试程序功能是否正常。
ee-bin start
# rd (请使用move替代)
- dist - [v1.2.0]前端资源所在目录
- target - [v1.2.0]目标目录
rd命令会把 frontend/dist
复制到 /public/dist
, 服务最终加载的是 /public/dist
前端资源。
frontend目录代码不会被打包,防止源码泄露。
更多详情见bin配置。
ee-bin rd
# move
ee-bin:v1.4.0
移动前端、go、配置等静态资源到指定目录,供生产环境使用。
可自定义参数,更多详情见bin配置。
ee-bin move --flag=frontend_dist
ee-bin move --flag=go_static,go_config,go_package,go_images
# encrypt
ee-bin: v1.2.0 新增 读取 config/bin.js 配置
- out - 加密后的输出目录,默认:./public
将 electron/
复制到 /public/electron
, 然后对其加密。
electron目录代码不会被打包,防止源码泄露。
ee-bin encrypt
ee-bin encrypt --out ./public
# clean
- dir - 需要删除的目录,默认:./public/electron
清理加密代码(/public/electron
目录)
ee-bin clean
ee-bin clean --dir ./public/electron
# icon
- -i/-input : 处理的图片路径 (默认:/public/images/logo.png)
- -o/-output: 输出的路径 (默认:/build/icons/)
- -s/-size: 需要生成的资源大小 (默认: 16,32,64,256,512)
- -c : 处理前清空输出路径的 .ico .png 文件
- -img/-images: win窗口图标/tray 图片生成的路径 (默认:/public/images/)
其中 -s 图片大小中的 16 处理成 tray.png
,32 处理成 logo-32.png
根据原图一键生成多种尺寸图片,并复制到指定目录。
# 安装依赖库
npm install icon-gen -D
# command
ee-bin icon
注意
如果安装依赖失败,那么请使用 其它软件
上次更新: 2025/01/21, 10:05:58