TauriTavern/scripts/README.md
LeenHawk 0077e15241
feat: add experimental OpenHarmony HAP support (#300)
* feat: add experimental OpenHarmony application build

* build(ohos): isolate experimental NAPI dependencies

* ci(ohos): build in this repository with public toolchain image

* ci: run existing checks for OHOS adaptation

* fix(ohos): generate QuickJS bindings for the OHOS target

* fix(ohos): use private caches and exclude desktop migration logs

* feat(ohos): restore native plugins and trusted endpoint confirmation

* ci(ohos): verify native plugin integration with existing checks

* chore(ohos): remove completed one-off validation workflow

* fix(ohos): clean dependency warnings and enable HAP LTO

* fix(ohos): retain shared plugin callbacks for the native bridge

* refactor(ohos): keep the native project and align the framework baseline

* fix(ohos): pin frame authorization and name the launcher entry

* fix(ohos): bind native builds and HAP packaging to the selected ABI

* fix(ohos): pin ordered Tauri bridge initialization

* fix(ohos): compress native libraries in HAP packages

* refactor(ohos): simplify HAP builds and Canary publishing

Build Rust once through the OHOS CLI and derive HAP versions from its merged
configuration. Replace the demo with the application page and remove generated
configuration writes, CMake scaffolding, and redundant preparation steps.

Keep ARM64 HAPs optional for Canary, report unsupported dev-log exports clearly,
and document the current build and host contracts.

Validated with pnpm run check, a local x86_64 HAP build and simulator smoke checks,
and Windows notification smoke checks.

---------

Co-authored-by: Darkatse <39111369+Darkatse@users.noreply.github.com>
2026-10-04 14:09:37 +08:00

5.3 KiB
Raw Permalink Blame History

Scripts

这个目录存放仓库内的开发、构建、迁移导出与 CI 辅助脚本。

Linux 一键安装

install-linux.sh 为 Debian 12+、Ubuntu 22.04 LTS+、Fedora 与 openSUSE Leap 16.0 配置签名软件源,并安装或更新 TauriTavern:

curl -fsSL https://get.tauritavern.com/linux.sh | sh

使用 Canary 渠道:

curl -fsSL https://get.tauritavern.com/linux.sh \
  | sh -s -- --channel canary

NixOS 会自动使用项目 flake;其他已经安装 Nix 的 Linux 可显式选择 Nix:

curl -fsSL https://get.tauritavern.com/linux.sh \
  | sh -s -- --method nix

Nix 安装进入当前用户 profile,不使用 sudo,也不修改 /etc/nix/nix.conf。脚本使用 POSIX sh 语法,可由 sh、Dash、Bash 或 Zsh 执行。运行前可先下载并检查内容,或使用 --dry-run 查看识别结果和执行计划:

curl -fsSL \
  https://get.tauritavern.com/linux.sh \
  -o install-tauritavern.sh
sh install-tauritavern.sh --dry-run

原生软件源安装会核对完整的 OpenPGP 主密钥和签名子密钥指纹。Nix 安装接受项目 flake 声明的 binary cache;multi-user Nix 仍要求 daemon 预先信任该 cache,否则可能回退到本地构建。

SillyTavern 迁移导出

这两个脚本会交互式生成一个可直接导入 TauriTavern data-migration 扩展的 zip:

  • 自动检测当前目录是否为 SillyTavern 根目录
  • 可选是否导出 data/default-user/backups
  • 自动将 public/scripts/extensions/third-party 映射到 data/extensions/third-party
  • 提供明显的压缩进度提示

一键执行

一键执行需要在可交互终端中运行;脚本通过终端读取选项,避免与 curl | sh 的脚本输入流冲突。

Unix / macOS / Linux / Termux:

curl -fsSL https://get.tauritavern.com/export.sh | sh

Windows PowerShell:

iex (iwr 'https://get.tauritavern.com/export.ps1').Content

本地执行

Unix / macOS / Linux / Termux:

sh scripts/export-sillytavern-migration.sh

Windows PowerShell:

powershell -ExecutionPolicy Bypass -File .\scripts\export-sillytavern-migration.ps1

目录说明

Flatpak 构建配方位于 packaging/flatpak/,软件源发布工具位于 distribution/。

  • install-linux.sh 通过受支持的 APT/RPM 软件源或 Nix flake 安装 TauriTavern。
  • export-sillytavern-migration.sh 面向 Unix/macOS/Linux/Termux 的 SillyTavern 迁移导出脚本。
  • export-sillytavern-migration.ps1 面向 Windows PowerShell 的 SillyTavern 迁移导出脚本。
  • build-portable.mjs 构建 Tauri portable 二进制,并将产物复制到指定输出目录。对应 pnpm run tauri:build:portable。
  • tauri-before-build.mjs 统一生成 Tauri 打包所需的前端 bundle;pnpm 启动入口也复用它以覆盖移动端 IDE 构建。
  • tauri-dev-server.mjs 为 tauri dev 提供轻量静态前端服务器、页面刷新通道与开发态 Service Worker 会话 bootstrap。静态文件通过 @parcel/watcher 的原生事件监听,Rspack 依赖在成功重编译后刷新。
  • check-frontend-guardrails.mjs 校验前端宿主层文件规模和依赖边界,避免 Host Kernel 持续膨胀。对应 pnpm run check:frontend。
  • tauri-ios-xcode-script.sh 包装 tauri ios xcode-script,补齐 Xcode GUI 构建环境中的 PATH / Node / pnpm,并在构建后处理 iOS 图标。
  • generate-ios-app-icon-variants.swift 从 src-tauri/crates/tauritavern/icons/icon.png 生成 iOS Any / Dark / Tinted 三个 1024px App Icon 源图。
  • ios-policy.mjs iOS Dev/Build 包装脚本:为构建过程注入 TAURITAVERN_IOS_POLICY_PROFILE,并在 ios_internal_full / ios_external_beta 构建时自动使用 --export-method app-store-connect。
  • ios-opaque-app-icons.swift 校验 iOS App Icon appearance 变体,并只将基础 Any 图标展平为不透明背景,供 tauri-ios-xcode-script.sh 调用。
  • ci/setup-macos-signing.sh GitHub Actions / CI 中的 macOS 签名初始化脚本,用于导入证书、创建 keychain 与写入 Apple API Key 路径。
  • ci/verify-release-version.mjs 校验 Stable Release tag 与前端、Cargo、Tauri、Cargo lock 和 Nix 包版本一致。
  • ci/collect-release-assets.mjs 校验必需的跨平台构建产物,并按 Stable 与 Canary 共用的用户可见命名契约收集 Release 资产。实验性的鸿蒙 HAP 是可选产物,存在时才收集。
  • ci/distribute-testflight.mjs 等待 App Store Connect 处理指定 iOS 构建,写入 What to Test,关联公开外测组,并按当前状态提交 Beta App Review。
  • ohos/ 鸿蒙实验构建:prepare.py 在一次性 checkout 中准备钉住的框架栈,env.sh 设置交叉编译环境,validate-hap.py 校验 HAP。流程见 docs/OpenHarmonyDevelopment.md §3。
  • guardrails/frontend-lines-baseline.json check-frontend-guardrails.mjs 使用的基线数据文件,文件行数硬性限制指标。

维护约定

  • 面向最终用户的一次性脚本,优先保持交互友好、依赖少、失败直出。
  • 面向仓库内部的脚本,优先通过 pnpm script 或 CI 调用,不额外扩散入口。
  • 如果修改迁移导出脚本涉及归档结构,请同步确认它仍符合当前 data-migration 导入器的 data/... 契约。