-
Notifications
You must be signed in to change notification settings - Fork 68
chore(docs): Move relevant sh
codeblocks to console
#232
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
book | ||
.spin | ||
# package created from component tutorial | ||
examples/tutorial/add |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,7 +54,7 @@ wac plug command/target/wasm32-wasip1/release/command.wasm --plug composed.wasm | |
|
||
Now, run the component with Wasmtime: | ||
|
||
```sh | ||
```console | ||
wasmtime run final.wasm 1 2 add | ||
1 + 2 = 3 | ||
``` | ||
|
@@ -84,12 +84,12 @@ package example:composition; | |
let adder-instance = new docs:adder-impl { }; | ||
|
||
// Instantiate the calculator-impl component that implements the calculator world. | ||
// In the `new` expression, specify the source of the `add` import to be `adder-instance`'s `add` export. | ||
// In the `new` expression, specify the source of the `add` import to be `adder-instance`'s `add` export. | ||
let calculator-instance = new docs:calculator-impl { add: adder-instance.add }; | ||
|
||
// Instantiate a command-impl component that implements the app world. | ||
// The command component might import other interfaces, such as WASI interfaces, but we want to leave | ||
// those as imports in the final component, so supply `...` to allow those other imports to remain unresolved. | ||
// The command component might import other interfaces, such as WASI interfaces, but we want to leave | ||
// those as imports in the final component, so supply `...` to allow those other imports to remain unresolved. | ||
// The command's exports (in this case, `wasi:cli/run`) remain unaffected in the resulting instance. | ||
let command-instance = new docs:command-impl { calculate: calculator-instance.calculate,... }; | ||
|
||
|
@@ -101,7 +101,7 @@ export command-instance["wasi:cli/[email protected]"]; | |
Now, perform your composition by passing the WAC file to `wac compose`. | ||
|
||
```sh | ||
wac compose composition.wac -o final.wasm | ||
wac compose composition.wac -o final.wasm | ||
``` | ||
|
||
> Note, instead of moving all the components to a `deps/docs` directory, you can pass the paths to the components inline | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -57,13 +57,13 @@ You can use the [WAC](https://github.com/bytecodealliance/wac) CLI to compose co | |
|
||
To perform quick and simple compositions, use the `wac plug` command. `wac plug` satisfies the import of a "socket" component by plugging a "plug" component's export into the socket. For example, a component that implements the [`validator` world above](#what-is-composition) needs to satisfy it's `match` import. It is a socket. While a component that implements the `regex` world, exports the `match` interface, and can be used as a plug. `wac plug` can plug a regex component's export into the validator component's import, creating a resultant composition: | ||
|
||
```sh | ||
```console | ||
wac plug validator-component.wasm --plug regex-component.wasm -o composed.wasm | ||
``` | ||
|
||
A component can also be composed with two components it depends on. | ||
|
||
```sh | ||
```console | ||
wac plug path/to/component.wasm --plug path/to/dep1.wasm --plug path/to/dep2.wasm -o composed.wasm | ||
``` | ||
|
||
|
@@ -94,7 +94,7 @@ export validator...; | |
|
||
Then, `wac compose` can be used to compose the components, passing in the paths to the components. Alternatively, you can place the components in a `deps` directory with an expected structure, and in the near future, you will be able to pull in components from registries. See the [`wac` documentation](https://github.com/bytecodealliance/wac) for more details. | ||
|
||
```sh | ||
```console | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This would be a good time to space out the command line args to different lines so the block is a bit easier to read. |
||
wac compose --dep docs:regex-impl=regex-component.wasm --dep docs:validator-impl=validator-component.wasm -o composed.wasm composition.wac | ||
``` | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -79,7 +79,7 @@ working with WebAssembly modules and components. | |
4. Use `wasm-tools` to create a component from the core module, first embedding component metadata | ||
inside the core module and then encoding the WAT to a Wasm binary. | ||
|
||
```sh | ||
```console | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we have Ditto for the other places in the PR as well! |
||
$ wasm-tools component embed adder/world.wit add.wat -o add.wasm | ||
$ wasm-tools component new add.wasm -o add.component.wasm | ||
``` | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,7 +26,7 @@ You should also have [wasmtime](https://wasmtime.dev/) installed so you can run | |
|
||
Once you have the .NET SDK installed, create a new project: | ||
|
||
```sh | ||
```console | ||
dotnet new install BytecodeAlliance.Componentize.DotNet.Templates | ||
dotnet new componentize.wasi.cli -o adder | ||
cd adder | ||
|
@@ -106,7 +106,7 @@ public class AdderWorldImpl : IAdderWorld | |
|
||
Then, we can build our component: | ||
|
||
```sh | ||
```console | ||
dotnet build | ||
``` | ||
|
||
|
@@ -199,7 +199,7 @@ public class AddImpl : IAdd | |
|
||
Once again, compile an application to a Wasm component using `dotnet build`: | ||
|
||
```sh | ||
```console | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No need to do anything here, but this actually shouldn't be a I would normally leave this without a highlighting tag all together, but that's me. @itowlson this is a good example of the nuance IMO -- would love to know your thoughts here. |
||
$ dotnet build | ||
Restore complete (0.4s) | ||
You are using a preview version of .NET. See: https://aka.ms/dotnet-support-policy | ||
|
@@ -223,7 +223,7 @@ Now we will be taking the `adder` component and executing it from another WebAss | |
|
||
Back out of the current project and create a new one: | ||
|
||
```sh | ||
```console | ||
cd .. | ||
dotnet new componentize.wasi.cli -o host-app | ||
cd host-app | ||
|
@@ -275,7 +275,7 @@ Console.WriteLine($"{left} + {right} = {result}"); | |
|
||
Once again, compile your component with `dotnet build`: | ||
|
||
```sh | ||
```console | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same note here as above w/ the combination of command and output |
||
$ dotnet build | ||
Restore complete (0.4s) | ||
You are using a preview version of .NET. See: https://aka.ms/dotnet-support-policy | ||
|
@@ -293,7 +293,7 @@ Since the `host-app` component depends on the `add` function which is defined in | |
world, it needs to be composed the first component. You can compose your `host-app` component with | ||
your `adder` component by running [`wac plug`](https://github.com/bytecodealliance/wac): | ||
|
||
```sh | ||
```console | ||
wac plug \ | ||
bin/Debug/net10.0/wasi-wasm/native/host-app.wasm \ | ||
--plug ../adder/bin/Debug/net10.0/wasi-wasm/native/adder.wasm \ | ||
|
@@ -317,7 +317,7 @@ Run `dotnet build` again you will have a composed component in `./dist/main.wasm | |
|
||
Then you can run the composed component: | ||
|
||
```sh | ||
```console | ||
wasmtime run ./dist/main.wasm | ||
1 + 2 = 3 | ||
``` | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this could be
console
if we're doing that!