From 65b041b6c90083b2482163707f709c557f23d58f Mon Sep 17 00:00:00 2001 From: SirBlobby Date: Wed, 22 Jul 2026 16:34:31 -0400 Subject: [PATCH] Vendor Typst compiler locally instead of depending on typstdrive folder --- .gitea/workflows/build.yml | 18 +++++++++--------- .gitea/workflows/ci.yml | 4 ++-- .gitignore | 1 + README.md | 12 +++++++----- src-tauri/Cargo.toml | 14 +++++++------- 5 files changed, 26 insertions(+), 23 deletions(-) diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml index 5ba29c4..475fbd1 100644 --- a/.gitea/workflows/build.yml +++ b/.gitea/workflows/build.yml @@ -23,8 +23,8 @@ jobs: - name: Clone Typst compiler run: | - git clone https://github.com/typst/typst.git typstdrive/typst - git -C typstdrive/typst checkout "$TYPST_COMMIT" + git clone https://github.com/typst/typst.git typst-desktop/typst + git -C typst-desktop/typst checkout "$TYPST_COMMIT" - name: Install build dependencies run: | @@ -85,17 +85,18 @@ jobs: path: packages/* if-no-files-found: error - - name: Publish to GitHub release + - name: Publish to Gitea release if: startsWith(github.ref, 'refs/tags/v') env: - TOKEN: ${{ secrets.RELEASE_TOKEN }} + TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITEA_URL: https://git.sirblob.co REPOSITORY: sirblobby/typst-desktop TAG: ${{ github.ref_name }} run: | set -euo pipefail - api="https://api.github.com/repos/$REPOSITORY" - auth="Authorization: Bearer $TOKEN" + api="$GITEA_URL/api/v1/repos/$REPOSITORY" + auth="Authorization: token $TOKEN" json="Content-Type: application/json" existing=$(curl -sS -H "$auth" "$api/releases/tags/$TAG" | jq -r '.id // empty') @@ -118,9 +119,8 @@ jobs: name=$(basename "$package") echo "Uploading $name" curl -sS --fail -X POST -H "$auth" \ - -H "Content-Type: application/octet-stream" \ - --data-binary "@$package" \ - "https://uploads.github.com/repos/$REPOSITORY/releases/$release_id/assets?name=$name" \ + -F "attachment=@$package" \ + "$api/releases/$release_id/assets?name=$name" \ > /dev/null done diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index c880299..ec42c55 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -41,8 +41,8 @@ jobs: - name: Clone Typst compiler run: | - git clone https://github.com/typst/typst.git typstdrive/typst - git -C typstdrive/typst checkout "$TYPST_COMMIT" + git clone https://github.com/typst/typst.git typst-desktop/typst + git -C typst-desktop/typst checkout "$TYPST_COMMIT" - name: Install build dependencies run: | diff --git a/.gitignore b/.gitignore index 6635cf5..16365f0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ .DS_Store node_modules +/typst /build /.svelte-kit /package diff --git a/README.md b/README.md index e5bf4a6..eed1150 100644 --- a/README.md +++ b/README.md @@ -169,10 +169,10 @@ The editor header shows the language server status. Without `tinymist` the edito ## Development -The app compiles Typst from source, so clone the compiler into TypstDrive's `typst/` folder first — both projects share it: +The app compiles Typst from source, so clone the compiler into this repo's `typst/` folder first: ```bash -git clone https://github.com/typst/typst.git ../typstdrive/typst +git clone https://github.com/typst/typst.git typst ``` Then: @@ -200,11 +200,11 @@ macOS builds are unsigned. Gatekeeper blocks unsigned apps on first launch, so o ### Building locally for another platform -Building on the target platform is the supported path. The Typst compiler is a path dependency, so any machine or runner needs it checked out beside this repository: +Building on the target platform is the supported path. The Typst compiler is a path dependency, so any machine or runner needs it checked out inside this repository: ```bash -git clone https://github.com/typst/typst.git ../typstdrive/typst -git -C ../typstdrive/typst checkout 44b3f78ed37fedea75e911dde2269ef86c45316f +git clone https://github.com/typst/typst.git typst +git -C typst checkout 9dfd3a08500b7896045f907433cf7b4b02434fad ``` Linux builds also need the WebKit and GTK development packages: @@ -217,6 +217,8 @@ sudo apt-get install libwebkit2gtk-4.1-dev libgtk-3-dev librsvg2-dev patchelf bun run build:linux ``` +Build on Ubuntu 22.04 (the CI baseline) rather than a rolling-release distro. glibc compatibility only works forward, so a binary is only guaranteed to run on distros with a glibc version equal to or newer than the one it was built against. This won't cover musl-based distros like Alpine, or glibc-based distros older than the build machine. + ## License Apache License 2.0. See [LICENSE](LICENSE). diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 1a82118..93404f8 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -27,13 +27,13 @@ serde = { version = "1", features = ["derive"] } serde_json = "1" rusqlite = { version = "0.32", features = ["bundled"] } -typst = { version = "0.15.1", path = "../../typstdrive/typst/crates/typst" } -typst-kit = { path = "../../typstdrive/typst/crates/typst-kit", features = ["system-downloader", "system-packages", "embedded-fonts"] } -typst-pdf = { path = "../../typstdrive/typst/crates/typst-pdf" } -typst-render = { path = "../../typstdrive/typst/crates/typst-render" } -typst-svg = { path = "../../typstdrive/typst/crates/typst-svg" } -typst-html = { path = "../../typstdrive/typst/crates/typst-html" } -typst-layout = { path = "../../typstdrive/typst/crates/typst-layout" } +typst = { version = "0.15.1", path = "../typst/crates/typst" } +typst-kit = { path = "../typst/crates/typst-kit", features = ["system-downloader", "system-packages", "embedded-fonts"] } +typst-pdf = { path = "../typst/crates/typst-pdf" } +typst-render = { path = "../typst/crates/typst-render" } +typst-svg = { path = "../typst/crates/typst-svg" } +typst-html = { path = "../typst/crates/typst-html" } +typst-layout = { path = "../typst/crates/typst-layout" } typst-assets = { version = "0.15.1", features = ["fonts"] } chrono = { version = "0.4", features = ["serde"] }