Skip to content

Commit

Permalink
Merge pull request #325 from ruby/katei/rename-package-names
Browse files Browse the repository at this point in the history
Move npm packages under @ruby org
  • Loading branch information
kateinoigakukun authored Dec 1, 2023
2 parents c7e4191 + ed36890 commit 4deeaec
Show file tree
Hide file tree
Showing 21 changed files with 802 additions and 2,059 deletions.
24 changes: 11 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Create and save `index.html` page with the following contents:

```html
<html>
<script src="https://cdn.jsdelivr.net/npm/ruby-3_2[email protected]/dist/browser.script.iife.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@ruby/3.2[email protected]/dist/browser.script.iife.js"></script>
<script type="text/ruby">
puts "Hello, world!"
</script>
Expand All @@ -28,18 +28,18 @@ Dependencies: [wasi-vfs](https://github.com/kateinoigakukun/wasi-vfs), [wasmtime

```console
# Download a prebuilt Ruby release
$ curl -LO https://github.com/ruby/ruby.wasm/releases/latest/download/ruby-3_2-wasm32-unknown-wasi-full.tar.gz
$ tar xfz ruby-3_2-wasm32-unknown-wasi-full.tar.gz
$ curl -LO https://github.com/ruby/ruby.wasm/releases/latest/download/ruby-3.2-wasm32-unknown-wasi-full.tar.gz
$ tar xfz ruby-3.2-wasm32-unknown-wasi-full.tar.gz

# Extract ruby binary not to pack itself
$ mv 3_2-wasm32-unknown-wasi-full/usr/local/bin/ruby ruby.wasm
$ mv 3.2-wasm32-unknown-wasi-full/usr/local/bin/ruby ruby.wasm

# Put your app code
$ mkdir src
$ echo "puts 'Hello'" > src/my_app.rb

# Pack the whole directory under /usr and your app dir
$ wasi-vfs pack ruby.wasm --mapdir /src::./src --mapdir /usr::./3_2-wasm32-unknown-wasi-full/usr -o my-ruby-app.wasm
$ wasi-vfs pack ruby.wasm --mapdir /src::./src --mapdir /usr::./3.2-wasm32-unknown-wasi-full/usr -o my-ruby-app.wasm

# Run the packed scripts
$ wasmtime my-ruby-app.wasm -- /src/my_app.rb
Expand All @@ -60,19 +60,19 @@ See the `README.md` of each package for more detail and its usage.
</thead>
<tbody>
<tr>
<td><a href="/packages/npm-packages/ruby-3_2-wasm-wasi">ruby-3_2-wasm-wasi</a></td>
<td><a href="/packages/npm-packages/ruby-3.2-wasm-wasi">@ruby/3.2-wasm-wasi</a></td>
<td>CRuby 3.2 built on WASI with JS interop support</td>
<td><a href="https://badge.fury.io/js/ruby-3_2-wasm-wasi" rel="nofollow"><img src="https://badge.fury.io/js/ruby-3_2-wasm-wasi.svg" alt="npm version" style="max-width: 100%;"></a></td>
<td><a href="https://badge.fury.io/js/@ruby/3.2-wasm-wasi" rel="nofollow"><img src="https://badge.fury.io/js/@ruby/3.2-wasm-wasi.svg" alt="npm version" style="max-width: 100%;"></a></td>
</tr>
<tr>
<td><a href="/packages/npm-packages/ruby-head-wasm-wasi">ruby-head-wasm-wasi</a></td>
<td><a href="/packages/npm-packages/ruby-head-wasm-wasi">@ruby/head-wasm-wasi</a></td>
<td>HEAD CRuby built on WASI with JS interop support</td>
<td><a href="https://badge.fury.io/js/ruby-head-wasm-wasi" rel="nofollow"><img src="https://badge.fury.io/js/ruby-head-wasm-wasi.svg" alt="npm version" style="max-width: 100%;"></a></td>
<td><a href="https://badge.fury.io/js/@ruby/head-wasm-wasi" rel="nofollow"><img src="https://badge.fury.io/js/@ruby/head-wasm-wasi.svg" alt="npm version" style="max-width: 100%;"></a></td>
</tr>
<tr>
<td><a href="/packages/npm-packages/ruby-head-wasm-emscripten">ruby-head-wasm-emscripten</a></td>
<td><a href="/packages/npm-packages/ruby-head-wasm-emscripten">@ruby/head-wasm-emscripten</a></td>
<td>HEAD CRuby built on Emscripten (not well tested)</td>
<td><a href="https://badge.fury.io/js/ruby-head-wasm-emscripten" rel="nofollow"><img src="https://badge.fury.io/js/ruby-head-wasm-emscripten.svg" alt="npm version" style="max-width: 100%;"></a></td>
<td><a href="https://badge.fury.io/js/@ruby/head-wasm-emscripten" rel="nofollow"><img src="https://badge.fury.io/js/@ruby/head-wasm-emscripten.svg" alt="npm version" style="max-width: 100%;"></a></td>
</tr>
</tbody>
</table>
Expand Down Expand Up @@ -132,8 +132,6 @@ A _build_ is a combination of ruby version, _profile_, and _target_.
</tbody>
</table>

Note: `*` is a wildcard that represents any other profile name except for itself, applied recursively. For example, `minimal-full-js-debug` is a valid profile.

## Notable Limitations

The current WASI target build does not yet support `Thread` related APIs. Specifically, WASI does not yet have an API for creating and managing threads yet.
Expand Down
16 changes: 3 additions & 13 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ BUILD_SOURCES = {
rev: "master",
patches: Dir["./patches/*.patch"].map { |p| File.expand_path(p) }
},
"3_2" => {
"3.2" => {
type: "github",
repo: "ruby/ruby",
rev: "v3_2_0"
Expand Down Expand Up @@ -48,16 +48,6 @@ BUILD_PROFILES = {
default_exts: "",
user_exts: []
},
"minimal-js" => {
debug: false,
default_exts: "",
user_exts: %w[js witapi]
},
"minimal-js-debug" => {
debug: true,
default_exts: "",
user_exts: %w[js witapi]
},
"full" => {
debug: false,
default_exts: FULL_EXTS,
Expand Down Expand Up @@ -118,8 +108,8 @@ NPM_PACKAGES = [
target: "wasm32-unknown-wasi"
},
{
name: "ruby-3_2-wasm-wasi",
build: "3_2-wasm32-unknown-wasi-full-js-debug",
name: "ruby-3.2-wasm-wasi",
build: "3.2-wasm32-unknown-wasi-full-js-debug",
target: "wasm32-unknown-wasi"
}
]
Expand Down
Loading

0 comments on commit 4deeaec

Please sign in to comment.