Skip to content

Commit

Permalink
Update README file to include new carton 1.0 implementation. (#243)
Browse files Browse the repository at this point in the history
* Update README file to include new carton 1.0 implementation.

* Update README to include the updated Carton 1.0 dependency to the JavaScriptKit Example.

* Collapsible Legacy Section.

* Fix Readme Package description for carton usage.

* Add horizontal rules to Legacy block for readability.

* Added instruction to run carton from swift in README.
  • Loading branch information
kuhl authored May 3, 2024
1 parent 8780e5f commit b682179
Showing 1 changed file with 32 additions and 2 deletions.
34 changes: 32 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ a few additional steps though (you can skip these steps if your app depends on
name: "JavaScriptKitExample",
dependencies: [
"JavaScriptKit",
.product(name: "JavaScriptEventLoop", package: "JavaScriptKit")
.product(name: "JavaScriptEventLoop", package: "JavaScriptKit"),
]
)
```
Expand Down Expand Up @@ -179,7 +179,33 @@ Not all of these versions are tested on regular basis though, compatibility repo
## Usage in a browser application

The easiest way to get started with JavaScriptKit in your browser app is with [the `carton`
bundler](https://carton.dev).
bundler](https://carton.dev). Add carton to your swift package dependencies:

```diff
dependencies: [
+ .package(url: "https://github.com/swiftwasm/carton", from: "1.0.0"),
],
```

Now you can activate the package dependency through swift:

```
swift run carton dev
```

If you have multiple products in your package, you can also used the product flag:

```
swift run carton dev --product MyApp
```

> [!WARNING]
> - If you already use `carton` before 0.x.x versions via Homebrew, you can remove it with `brew uninstall carton` and install the new version as a SwiftPM dependency.
> - Also please remove the old `.build` directory before using the new `carton`
<details><summary>Legacy Installation</summary>

---

As a part of these steps
you'll install `carton` via [Homebrew](https://brew.sh/) on macOS (you can also use the
Expand Down Expand Up @@ -218,6 +244,10 @@ carton init --template basic
carton dev
```

---

</details>

5. Open [http://127.0.0.1:8080/](http://127.0.0.1:8080/) in your browser and a developer console
within it. You'll see `Hello, world!` output in the console. You can edit the app source code in
your favorite editor and save it, `carton` will immediately rebuild the app and reload all
Expand Down

0 comments on commit b682179

Please sign in to comment.