Skip to content

Commit 3d06a63

Browse files
authored
Merge pull request #1410 from itowlson/exterminate-js2wasm
Remove js2wasm from v3 docs
2 parents 5b70d2e + 3ad02bc commit 3d06a63

File tree

3 files changed

+30
-48
lines changed

3 files changed

+30
-48
lines changed

content/spin/v3/managing-plugins.md

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ url = "https://github.com/fermyon/developer/blob/main/content/spin/v3/managing-p
2020
- [Downgrading Plugins](#downgrading-plugins)
2121
- [Next Steps](#next-steps)
2222

23-
Plugins are a way to extend the functionality of Spin. Spin provides commands for installing and removing them, so you don't need to use separate installation tools. When you have installed a plugin into Spin, you can call it as if it were a Spin subcommand. For example, the JavaScript SDK uses a tool called `js2wasm` to package JavaScript code into a Wasm module, and JavaScript applications run it via the `spin js2wasm` command.
23+
Plugins are a way to extend the functionality of Spin. Spin provides commands for installing and removing them, so you don't need to use separate installation tools. When you have installed a plugin into Spin, you can call it as if it were a Spin subcommand. For example, Fermyon Cloud can be accessed with a plugin called `cloud`, and you run it via the `spin cloud` command.
2424

2525
## Installing Plugins
2626

@@ -33,7 +33,7 @@ The Spin maintainers curate a catalogue of "known" plugins. You can install plug
3333
<!-- @selectiveCpy -->
3434

3535
```bash
36-
$ spin plugins install js2wasm
36+
$ spin plugins install cloud
3737
```
3838

3939
Spin checks that the plugin is available for your version of Spin and your operating system, and prompts you to confirm the installation. To skip the prompt, pass the `--yes` flag.
@@ -47,7 +47,7 @@ To install a specific version of a plugin, pass the `--version` flag:
4747
<!-- @nocpy -->
4848

4949
```bash
50-
$ spin plugins install js2wasm --version 0.4.0
50+
$ spin plugins install cloud --version 0.9.1
5151
```
5252

5353
### Installing a Plugin From a URL
@@ -77,7 +77,7 @@ You run plugins in the same way as built-in Spin subcommands. For example:
7777
<!-- @selectiveCpy -->
7878

7979
```bash
80-
$ spin js2wasm --help
80+
$ spin cloud --help
8181
```
8282

8383
## Viewing Available Plugins
@@ -89,8 +89,8 @@ To see what plugins are available in the catalogue, run `spin plugins search`:
8989
```bash
9090
$ spin plugins search
9191
befunge2wasm 1.4.0 [incompatible]
92-
js2wasm 0.3.0 [installed]
93-
js2wasm 0.4.0
92+
cloud 0.8.0 [installed]
93+
cloud 0.9.0
9494
trigger-sqs 0.1.0
9595
```
9696

@@ -130,13 +130,13 @@ The `spin plugins upgrade` command has the same options as the `spin plugins ins
130130

131131
> The `upgrade` command uses your local cache of the catalogue. This might not include recently added plugins or versions. So always remember to run `spin plugins update` to refresh your local cache of the catalogue before performing the `spin plugins upgrade` command.
132132
133-
The following example shows how to upgrade one plugin at a time (i.e. the `js2wasm` plugin):
133+
The following example shows how to upgrade one plugin at a time (i.e. the `cloud` plugin):
134134

135135
<!-- @selectiveCpy -->
136136

137137
```bash
138138
$ spin plugins update
139-
$ spin plugins upgrade js2wasm
139+
$ spin plugins upgrade cloud
140140
```
141141

142142
The following example shows how to upgrade all installed plugins at once:
@@ -161,27 +161,25 @@ $ spin plugins upgrade --file ~/dev/spin-befunge-sdk/befunge2wasm.json
161161

162162
## Downgrading Plugins
163163

164-
By default, Spin will only _upgrade_ plugins. Pass the `--downgrade` flag and specify the `--version` if you want Spin to roll back to an earlier version. The following abridged example (which doesn't list the full console output for simplicity) lists the versions of plugins, downgrades the `js2wasm` to an older version (`0.6.0`) and then lists the versions again to show the results:
164+
By default, Spin will only _upgrade_ plugins. Pass the `--downgrade` flag and specify the `--version` if you want Spin to roll back to an earlier version. The following abridged example (which doesn't list the full console output for simplicity) lists the versions of plugins, downgrades the `cloud` to an older version (`0.9.0`) and then lists the versions again to show the results:
165165

166166
<!-- @nocpy -->
167167

168168
```bash
169169
$ spin plugins update
170170
$ spin plugins list
171171
// --snip--
172-
js2wasm 0.6.0
173-
js2wasm 0.6.1 [installed]
174-
$ spin plugins upgrade js2wasm --downgrade --version 0.6.0
172+
cloud 0.9.0
173+
cloud 0.9.1 [installed]
174+
$ spin plugins upgrade cloud --downgrade --version 0.9.0
175175
$ spin plugins list
176176
// --snip--
177-
js2wasm 0.6.0 [installed]
178-
js2wasm 0.6.1
177+
cloud 0.9.0 [installed]
178+
cloud 0.9.1
179179
```
180180

181-
After downgrading, the `[installed]` indicator is aligned with the `0.6.0` version of `js2wasm`, as intended in the example.
181+
After downgrading, the `[installed]` indicator is aligned with the `0.9.0` version of `cloud`, as intended in the example.
182182

183183
## Next Steps
184184

185-
- [Install the JavaScript or Python plugins](quickstart)
186-
- [Use the JavaScript or Python plugins to build a Wasm module](build)
187-
- [Checkout the spin cloud plugin](https://github.com/fermyon/cloud-plugin)
185+
- [Check out the spin cloud plugin](https://github.com/fermyon/cloud-plugin)

content/spin/v3/plugin-authoring.md

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ Spin plugins add new functionality or subcommands to Spin without modifying the
1818
Spin codebase. They make Spin easily extensible while keeping it lightweight.
1919
Spin plugins can add new triggers to Spin (such as the [example timer
2020
trigger](https://github.com/fermyon/spin/blob/main/examples/spin-timer/trigger-timer.json)),
21-
enable new language SDKs (such as
22-
[`js2wasm`](https://github.com/fermyon/spin-plugins/blob/main/manifests/js2wasm/js2wasm.json)),
21+
add deployment integrations (such as
22+
[`kube`](https://github.com/fermyon/spin-plugins/blob/main/manifests/kube/kube.json)),
2323
and more.
2424

2525
This document will cover what Spin plugins are, how to use a plugin, and how to
@@ -46,19 +46,16 @@ and creates a local snapshot. To ensure that the local snapshot is up to date,
4646
it is best to run `spin plugins update` before installing any plugins.
4747

4848
To list available plugins, run `spin plugins search`. Now, decide which plugin to
49-
install. For example, the `js2wasm` plugin, which is needed in order to build
50-
JavaScript Spin applications, can be installed by running:
49+
install. For example, the `kube` plugin, which is needed in order to deploy
50+
applications to [SpinKube](https://www.spinkube.dev/), can be installed by running:
5151

5252
<!-- @selectiveCpy -->
5353

5454
```bash
55-
$ spin plugins install js2wasm
55+
$ spin plugins install kube
5656
```
5757

58-
With the plugin installed, you can now call `spin js2wasm` to run it. In this
59-
case, for example, you might call it from your JavaScript application's npm
60-
build script. Learn more about building Spin components in JavaScript
61-
[here](./javascript-components.md).
58+
With the plugin installed, you can now call `spin kube` to run it.
6259

6360
To upgrade installed plugins to newer versions, run `spin plugin update` to
6461
fetch the latest plugins to the local catalogue and `spin plugin upgrade` to perform the

content/spin/v3/quickstart.md

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -194,16 +194,7 @@ $ rustup target add wasm32-wasi
194194

195195
{{ startTab "TypeScript" }}
196196

197-
> If you used the installer script above, the `js2wasm` plugin is already installed, and you can skip this section!
198-
199-
You'll need the Spin `js2wasm` plugin:
200-
201-
<!-- @selectiveCpy -->
202-
203-
```bash
204-
$ spin plugins update
205-
$ spin plugins install js2wasm --yes
206-
```
197+
You will need `npm` installed and on the path. `npm` will install any additional build tools as part of building the application.
207198

208199
[Learn more in the language guide.](javascript-components)
209200

@@ -410,18 +401,15 @@ Now let's have a look at the code. Below is the complete source
410401
code for a Spin HTTP component written in TypeScript — a regular function named `handleRequest` that
411402
takes an HTTP request as a parameter and returns an HTTP response. (The
412403
JavaScript version looks slightly different, but is still a function with
413-
the same signature.) The Spin `js2wasm` plugin looks for the `handleRequest` function
404+
the same signature.) The Spin integration looks for the `handler` function
414405
by name when building your application into a Wasm module:
415406

416407
```javascript
417-
import { HandleRequest, HttpRequest, HttpResponse } from "@fermyon/spin-sdk"
418-
419-
export const handleRequest: HandleRequest = async function (request: HttpRequest): Promise<HttpResponse> {
420-
return {
421-
status: 200,
422-
headers: { "content-type": "text/plain" },
423-
body: "Hello from TS-SDK"
424-
}
408+
import { ResponseBuilder } from "@fermyon/spin-sdk";
409+
410+
export async function handler(req: Request, res: ResponseBuilder) {
411+
console.log(req);
412+
res.send("hello universe");
425413
}
426414
```
427415

@@ -743,7 +731,7 @@ $ spin build
743731
Executing the build command for component hello-typescript: npm run build
744732

745733
746-
> npx webpack --mode=production && mkdir -p target && spin js2wasm -o target/spin-http-js.wasm dist/spin.js
734+
> npx webpack --mode=production && npx mkdirp target && npx j2w -i dist.js -d combined-wit -n combined -o target/hello-typescript.wasm
747735

748736
asset spin.js 4.57 KiB [emitted] (name: main)
749737
runtime modules 670 bytes 3 modules
@@ -761,7 +749,6 @@ If the build fails, check:
761749

762750
* Are you in the `hello_typescript` directory?
763751
* Did you run `npm install` before building`?
764-
* Did you install the `js2wasm` plugin?
765752

766753
If you would like to know what build command Spin runs for a component, you can find it in the manifest, in the `component.(id).build` section:
767754

0 commit comments

Comments
 (0)