Skip to content

Commit

Permalink
Changes to support next npm publish - will it work?
Browse files Browse the repository at this point in the history
  • Loading branch information
noahgibbs committed Jul 9, 2024
1 parent 0742656 commit f1108a9
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 90 deletions.
2 changes: 2 additions & 0 deletions npm/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
node_modules
packed_ruby.wasm
spacewalk.js
7 changes: 4 additions & 3 deletions npm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

For quick start with SpaceShoes and applications that don't need extra asset files or custom gems, a simple NPM package based on ruby.wasm is all you need.


## Publishing

npm login
npm publish --access public
* Update version number in package.json
* Build correct version of space_shoes (packed_wasm and spacewalk) in main repo
* npm login
* npm publish --access public

2 changes: 1 addition & 1 deletion npm/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@spaceshoes/spacewalk",
"version": "0.1.4",
"version": "0.1.6",
"description": "Default SpaceShoes setup for easy in-browser Shoes apps",
"main": "index.js",
"scripts": {
Expand Down
7 changes: 7 additions & 0 deletions npm/publish.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

set -e

cp ../packaging/packed_ruby.wasm .
cp ../test/cache/spacewalk.js .
npm publish --access public
82 changes: 0 additions & 82 deletions npm/spacewalk.js

This file was deleted.

7 changes: 3 additions & 4 deletions test/cache/spacewalk.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
// version we used to build the Wasm package below?
import { DefaultRubyVM } from "https://cdn.jsdelivr.net/npm/@ruby/[email protected]/dist/browser/+esm";

// For Locally-compiled Ruby.wasm VM:
const response = await fetch("./packed_ruby.wasm");
// For Ruby.wasm VM:
const packedURL = import.meta.url.split("/").slice(0,-1).join("/") + "/packed_ruby.wasm";
const response = await fetch(packedURL);
const module = await WebAssembly.compile(await response.arrayBuffer());

const { vm } = await DefaultRubyVM(module);
Expand Down Expand Up @@ -48,10 +49,8 @@ async function runShoesApps(vm) {
if (script) {
const { scriptContent, evalStyle } = script;
vm.eval(scriptContent);
break;
}
}

}

async function loadScriptAsync(tag) {
Expand Down

0 comments on commit f1108a9

Please sign in to comment.