Merge 'Fix Wasm packaging' from Pekka Enberg

The `wasm-pack` too has a known bug where it forgets to add snippets to
`package.json`:
https://github.com/rustwasm/wasm-pack/issues/1206
Let's fix that with some bash magic.

Reviewed-by: Pere Diaz Bou <pere-altea@homail.com>

Closes #381
This commit is contained in:
Pekka Enberg
2024-11-13 12:02:20 +02:00
4 changed files with 34 additions and 1 deletions

9
bindings/wasm/README.md Normal file
View File

@@ -0,0 +1,9 @@
# Limbo Wasm bindings
This source tree contains Limbo Wasm bindings.
## Building
```
./scripts/build
```

View File

@@ -2,4 +2,4 @@ import { Database } from 'limbo-wasm';
const db = new Database('hello.db');
db.exec("SELECT 'hello, world' AS message");
console.log(db.exec("SELECT 'hello, world' AS message"));

View File

@@ -0,0 +1,20 @@
{
"name": "limbo-wasm",
"collaborators": [
"the Limbo authors"
],
"version": "0.0.4",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/penberg/limbo"
},
"files": [
"snippets",
"limbo_wasm_bg.wasm",
"limbo_wasm.js",
"limbo_wasm.d.ts"
],
"main": "limbo_wasm.js",
"types": "limbo_wasm.d.ts"
}

4
bindings/wasm/scripts/build Executable file
View File

@@ -0,0 +1,4 @@
#!/bin/bash
wasm-pack build --no-pack --target nodejs
cp package.json pkg/package.json