From 7814be9c048eef02ea458fbf1ac208e8d40515b8 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Fri, 15 Aug 2025 22:54:14 +0900 Subject: [PATCH 1/2] Add documentation for BridgeJS generation script to CONTRIBUTING.md Document the Utilities/bridge-js-generate.sh script and when to use it for updating AoT-generated BridgeJS files. --- CONTRIBUTING.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f71ca83a..f3cdb46c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -81,5 +81,24 @@ To make changes to the runtime, you need to edit the TypeScript files and regene make regenerate_swiftpm_resources ``` +### Working with BridgeJS + +BridgeJS is a Swift Package Manager plugin that automatically generates Swift bindings from TypeScript definitions. This repository contains pre-generated files created by BridgeJS in AoT (Ahead of Time) mode that are checked into version control. + +To update these pre-generated files, use the utility script: + +```bash +./Utilities/bridge-js-generate.sh +``` + +This script runs the BridgeJS plugin in AoT mode (`swift package bridge-js`) on several SwiftPM packages in this repository. + +Run this script when you've made changes to: +- TypeScript definitions +- BridgeJS configuration +- BridgeJS code generator itself + +These changes require updating the pre-generated Swift bindings committed to the repository. + ## Support If you have any questions or need assistance, feel free to reach out via [GitHub Issues](https://github.com/swiftwasm/JavaScriptKit/issues) or [Discord](https://discord.gg/ashJW8T8yp). From 223673e89cecd8e9c0dc1c2e65852043213be9cd Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Fri, 15 Aug 2025 22:58:19 +0900 Subject: [PATCH 2/2] Add CI job to check BridgeJS generated files are up-to-date Adds check-bridgejs-generated job that runs bridge-js-generate.sh and fails if generated files are not current. --- .github/workflows/test.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2766d6ef..e6da32aa 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -88,6 +88,24 @@ jobs: echo "::error::The formatting changed some files. Please run \`./Utilities/format.swift\` and commit the changes." exit 1 } + + check-bridgejs-generated: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v5 + - uses: ./.github/actions/install-swift + with: + download-url: https://download.swift.org/development/ubuntu2204/swift-DEVELOPMENT-SNAPSHOT-2025-06-12-a/swift-DEVELOPMENT-SNAPSHOT-2025-06-12-a-ubuntu22.04.tar.gz + - run: make bootstrap + - run: ./Utilities/bridge-js-generate.sh + - name: Check if BridgeJS generated files are up-to-date + run: | + git config --global --add safe.directory "$GITHUB_WORKSPACE" + git diff --exit-code || { + echo "::error::BridgeJS generated files are out of date. Please run \`./Utilities/bridge-js-generate.sh\` and commit the changes." + exit 1 + } + build-examples: runs-on: ubuntu-latest steps: