docs: add note about win64 build

This commit is contained in:
Jixun Wu 2023-12-28 23:00:41 +00:00
parent d824620472
commit fd3b0aef75
3 changed files with 53 additions and 0 deletions

3
.gitignore vendored
View File

@ -27,3 +27,6 @@ dist-ssr
# Files created when running "drone exec" locally
/.pnpm-store/
/*.zip
/um-react-wry-*
/um-react*.exe

View File

@ -33,3 +33,29 @@ pnpm build
如果需要预览构建版本,运行 `pnpm preview` 然后打开[项目预览页面][vite-preview-url]即可。
[vite-preview-url]: http://localhost:4173/
## 打包 `.zip`
建议在 Linux 环境下执行,可参考 `.drone.yml` CI 文件。
1. 确保上述的构建步骤已完成。
2. 确保 `python3` 已安装。
3. 执行下述代码
```sh
python3 -m zipfile -c um-react.zip dist/.
```
## 打包 win64 单文件
利用 Windows 系统自带的 [WebView2 组件Edge 浏览器运行时)](https://learn.microsoft.com/zh-cn/microsoft-edge/webview2/)
和 [wry](https://github.com/tauri-apps/wry) 进行一个单文件的打包。
其它系统兼容性未知。
1. 确保你现在在 `linux-amd64` 环境下。
2. 确保上述的 `um-react.zip` 构建已完成。
3. 执行下述代码
```sh
./scripts/make-win64.sh
```
4. 等待提示 `done!` 即可。

24
scripts/make-win64.sh Executable file
View File

@ -0,0 +1,24 @@
#!/bin/bash
pushd "$(dirname "${BASH_SOURCE[0]}")/../"
dl_file() {
local FILE="$1"
if [[ ! -f "$FILE" ]]; then
curl -fsL "https://um-react.app/files/${FILE}.gz" | gzip -d >"${FILE}"
fi
}
dl_file "um-react-wry-builder-0.1.0-linux-amd64"
dl_file "um-react-wry-stub-0.1.0-win64.exe"
chmod a+x um-react-wry-builder-0.1.0-linux-amd64
APP_VERSION="$(jq -r '.version' <package.json)"
./um-react-wry-builder-0.1.0-linux-amd64 \
-t um-react-wry-stub-0.1.0-win64.exe \
-r um-react.zip \
-o "um-react-win64-${APP_VERSION}.exe"
echo "Built 'um-react-win64-${APP_VERSION}.exe'."
popd