diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..c286c33f --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,69 @@ +# Contributing to JavaScriptKit + +Thank you for considering contributing to JavaScriptKit! We welcome contributions of all kinds and value your time and effort. + +## Getting Started + +### Reporting Issues +- If you find a bug, have a feature request, or need help, please [open an issue](https://github.com/swiftwasm/JavaScriptKit/issues). +- Provide as much detail as possible: + - Steps to reproduce the issue + - Expected vs. actual behavior + - Relevant error messages or logs + +### Setting Up the Development Environment +1. Clone the repository: + ```bash + git clone https://github.com/swiftwasm/JavaScriptKit.git + cd JavaScriptKit + ``` + +2. Install **OSS** Swift toolchain (not the one from Xcode): +
+ For macOS users + + ```bash + ( + SWIFT_TOOLCHAIN_CHANNEL=swift-6.0.2-release; + SWIFT_TOOLCHAIN_TAG="swift-6.0.2-RELEASE"; + SWIFT_SDK_TAG="swift-wasm-6.0.2-RELEASE"; + pkg="$(mktemp -d)/InstallMe.pkg"; set -ex; + curl -o "$pkg" "https://download.swift.org/$SWIFT_TOOLCHAIN_CHANNEL/xcode/$SWIFT_TOOLCHAIN_TAG/$SWIFT_TOOLCHAIN_TAG-osx.pkg"; + installer -pkg "$pkg" -target CurrentUserHomeDirectory; + export TOOLCHAINS="$(plutil -extract CFBundleIdentifier raw ~/Library/Developer/Toolchains/$SWIFT_TOOLCHAIN_TAG.xctoolchain/Info.plist)"; + swift sdk install "https://github.com/swiftwasm/swift/releases/download/$SWIFT_SDK_TAG/$SWIFT_SDK_TAG-wasm32-unknown-wasi.artifactbundle.zip"; + ) + ``` + +
+ +
+ For Linux users + Install Swift 6.0.2 by following the instructions on the official Swift website. + + ```bash + ( + SWIFT_SDK_TAG="swift-wasm-6.0.2-RELEASE"; + swift sdk install "https://github.com/swiftwasm/swift/releases/download/$SWIFT_SDK_TAG/$SWIFT_SDK_TAG-wasm32-unknown-wasi.artifactbundle.zip"; + ) + ``` + +
+ +3. Install dependencies: + ```bash + make bootstrap + ``` + +### Running Tests +- Run unit tests: + ```bash + make unittest SWIFT_SDK_ID=wasm32-unknown-wasi + ``` +- Run integration tests: + ```bash + make test SWIFT_SDK_ID=wasm32-unknown-wasi + ``` + +## 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). diff --git a/README.md b/README.md index 63f432ca..4bc6d2d1 100644 --- a/README.md +++ b/README.md @@ -257,33 +257,6 @@ You can also build your project with webpack.js and a manually installed SwiftWa see the following sections and the [Example](https://github.com/swiftwasm/JavaScriptKit/tree/main/Example) directory for more information in this more advanced use case. -## Manual toolchain installation - -This library only supports [`swiftwasm/swift`](https://github.com/swiftwasm/swift) toolchain distribution. -The toolchain can be installed via [`swiftenv`](https://github.com/kylef/swiftenv), in -the same way as the official Swift nightly toolchain. - -You have to install the toolchain manually when working on the source code of JavaScriptKit itself, -especially if you change anything in the JavaScript runtime parts. This is because the runtime parts are -embedded in `carton` and currently can't be replaced dynamically with the JavaScript code you've -updated locally. - -Just pass a toolchain archive URL for [the latest SwiftWasm 5.6 -release](https://github.com/swiftwasm/swift/releases/tag/swift-wasm-5.6.0-RELEASE) appropriate for your platform: - -```sh -$ swiftenv install "https://github.com/swiftwasm/swift/releases/download/swift-wasm-5.6.0-RELEASE/swift-wasm-5.6.0-RELEASE-macos_$(uname -m).pkg" -``` - -You can also use the `install-toolchain.sh` helper script that uses a hardcoded toolchain snapshot: - -```sh -$ ./scripts/install-toolchain.sh -$ swift --version -Swift version 5.6 (swiftlang-5.6.0) -Target: arm64-apple-darwin20.6.0 -``` - ## Sponsoring [Become a gold or platinum sponsor](https://github.com/sponsors/swiftwasm/) and contact maintainers to add your logo on our README on Github with a link to your site.