Conversation
Major architectural change to build WASM from source instead of committing the binary to the repository. Changes: - Add ghostty-org/ghostty as root-level submodule (pinned to 0f64b9a8e) - Add patches/ghostty-wasm-api.patch (33KB, 1006 lines) - Exposes 16 C API functions for terminal integration - Based on coder/ghostty fork commit bfd067d - Rewrite scripts/build-wasm.sh: - Initialize submodule if needed - Apply patch, build WASM with Zig, revert patch - Keeps submodule clean for easy updates - Update CI workflow: - Add Zig 0.15.2 installation to test and build jobs - Build WASM before running tests/build - Add WASM size check (512KB limit) - Update package.json: - Add build:wasm script - Integrate WASM build into main build process - Update .gitignore: - Ignore ghostty-vt.wasm (built locally and in CI) - Ignore ghostty/zig-out/ and ghostty/zig-cache/ - Remove committed ghostty-vt.wasm binary (404KB) - Update README.md and INSTALL.md with new build instructions Benefits: - Transparent build process (exact Ghostty version + patches visible) - Easier to update upstream Ghostty - Smaller git history (no binary commits) - WASM still included in npm package (built during prepublishOnly) Build time: ~20 seconds for WASM, adds ~30 seconds to CI test/build jobs
- Remove ghostty/zig-out/ and ghostty/zig-cache/ from .gitignore (submodule contents are automatically ignored by git) - Simplify INSTALL.md to just run build script (script handles submodule initialization automatically)
Replace manual Zig installation with mlugg/setup-zig@v1 action: - Automatically caches Zig compiler between runs - Caches global Zig cache directory for faster builds - Verifies tarball signatures for security - Cleaner, more maintainable CI code Benefits: - Faster CI (caching saves ~10 seconds per run) - More reliable (uses community mirror list) - Less boilerplate (3 lines vs 7 lines)
Building WASM should be an explicit step, not part of dependency installation. Changes: - Remove postinstall script from package.json - Update README.md to remove postinstall mention - Update INSTALL.md to clarify git installs need manual build Benefits: - fmt/lint/typecheck CI jobs no longer need Zig or submodules - Cleaner separation: install = deps, build = artifacts - Users have explicit control over when WASM is built
Create .github/actions/setup-zig to install Zig compiler: - Supports Linux x86_64 and macOS (x86_64/aarch64) - Downloads from ziglang.org/builds (more reliable than /download) - Caches Zig installation between runs - Adds retry logic for network resilience - Verifies installation with zig version Benefits over third-party actions: - Full control over installation logic - No external dependencies - Can customize for our specific needs - Better error messages and debugging Fixes the curl error when downloading from /download endpoint.
Zig changed the download URL format starting with v0.14.1: - Old format: zig-linux-x86_64-VERSION.tar.xz - New format: zig-x86_64-linux-VERSION.tar.xz Changes: - Switch from /builds to /download endpoint - Use correct ARCH-PLATFORM order (not PLATFORM-ARCH) - Add comment documenting the format change This fixes the 404 error when downloading Zig 0.15.2.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Major architectural change to build WASM from source instead of committing the binary to the repository.
Changes:
Benefits:
Build time: ~20 seconds for WASM, adds ~30 seconds to CI test/build jobs