Skip to content

Commit

Permalink
Add CONTRIBUTING.md
Browse files Browse the repository at this point in the history
  • Loading branch information
kateinoigakukun committed Nov 28, 2024
1 parent 1546b94 commit 115ca29
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 27 deletions.
69 changes: 69 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -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):
<details>
<summary>For macOS users</summary>

```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";
)
```

</details>

<details>
<summary>For Linux users</summary>
Install Swift 6.0.2 by following the instructions on the <a href="https://www.swift.org/install/linux/tarball/">official Swift website</a>.

```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";
)
```

</details>

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).
27 changes: 0 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 115ca29

Please sign in to comment.