Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# 桌面端按行读消息码清单,换行不能随平台变
crates/tw-api/msg-codes.txt text eol=lf
10 changes: 10 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,16 @@ jobs:
- name: Test
run: cargo test --workspace

# 桌面端从 tw-api 导出前端类型(`ts` feature)。**默认关**,上面几步一行都
# 不编它 —— 而它坏掉的表现是桌面端接下一个 tag 时才发现导不出来。导出来
# 的文件再过一遍 tsc:ts-rs 生成的东西本身也可能不是合法的 TypeScript
- name: TypeScript bindings (tw-api, ts)
run: |
cargo clippy -p tw-api --all-targets --features ts -- -D warnings
cargo test -p tw-api --features ts
cargo run -p tw-api --features ts --example export_ts -- "$RUNNER_TEMP/tw-api-ts"
npx --yes -p typescript@5 tsc --noEmit --strict --target es2022 "$RUNNER_TEMP/tw-api-ts/tw-api.ts"

- name: Build
run: cargo build --release -p twcore

Expand Down
34 changes: 34 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,9 @@ uuid = { version = "1", features = ["v4", "serde"] }
rand = "0.10"

clap = { version = "4", features = ["derive"] }
# 控制面契约导出成 TypeScript(tw-api 的 `ts` feature)。**不开任何 serde 以外的
# 类型实现**:契约里只有 std 和 serde 的类型
ts-rs = { version = "12", default-features = false, features = ["serde-compat"] }

[profile.release]
# 桌面 sidecar:体积比极限吞吐重要。企业版用 lto = true + codegen-units = 1,
Expand Down
4 changes: 2 additions & 2 deletions bin/twcore/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -723,8 +723,8 @@ fn cmd_serve(path: &Path, port: Option<u16>, safe: bool, parent: Option<u32>) ->
let rt = tokio::runtime::Builder::new_multi_thread()
.enable_all()
.build()?;
// 控制面听在哪由平台决定,见 `tw_api::control::Endpoint`。
let endpoint = tw_api::control::Endpoint::in_dir(&dir);
// 控制面听在哪由平台决定,见 `tw_api::control::Address`。
let endpoint = tw_api::control::Address::in_dir(&dir);
// **在起任何东西之前问**。等到 bind 失败时,网关已经在监听、客户端
// 可能已经连上来了,而这条错误当时只会进日志。
tw_control::endpoint_usable(&endpoint)?;
Expand Down
Loading
Loading