Skip to content

Commit 0c18517

Browse files
hi-ogawaOpenCode
andauthored
chore: add pkg.pr.new for wasm package (#63)
Co-authored-by: Hiroshi Ogawa <4232207+hi-ogawa@users.noreply.github.com> Co-authored-by: OpenCode <noreply@opencode.ai>
1 parent c3713ec commit 0c18517

8 files changed

Lines changed: 73 additions & 10 deletions

File tree

.github/workflows/pkg-pr-new.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: pkg.pr.new
2+
3+
on:
4+
pull_request:
5+
6+
concurrency:
7+
group: pkg-pr-new-${{ github.event.pull_request.number }}
8+
cancel-in-progress: true
9+
10+
permissions:
11+
contents: read
12+
13+
jobs:
14+
publish:
15+
runs-on: ubuntu-latest
16+
timeout-minutes: 10
17+
18+
steps:
19+
- uses: actions/checkout@v6
20+
21+
- uses: actions/setup-node@v6
22+
with:
23+
node-version: "lts/*"
24+
25+
- run: corepack enable
26+
27+
- run: pnpm install --frozen-lockfile
28+
29+
- run: pnpm build-wasm
30+
31+
- run: pnpm exec pkg-pr-new publish --no-compact ./crates/wasm

crates/wasm/package.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"name": "@hiogawa/demucs-onnx-wasm",
3+
"version": "0.0.0",
4+
"files": [
5+
"pkg"
6+
],
7+
"type": "module",
8+
"exports": "./pkg/demucs_wasm.js",
9+
"scripts": {
10+
"build": "wasm-pack build . --target web --no-pack --release && rm -f pkg/.gitignore"
11+
},
12+
"devDependencies": {
13+
"wasm-pack": "0.15.0"
14+
}
15+
}

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"build-model": "uv run python tools/model-export/build_models.py",
1010
"verify-parity": "uv run python tools/model-export/verify_parity.py",
1111
"model-release": "uv run --no-sync tools/model_release.py",
12-
"build-wasm": "wasm-pack build crates/wasm --target web --release",
12+
"build-wasm": "pnpm -C crates/wasm build",
1313
"wasm-separate": "pnpm -C packages/app wasm-separate",
1414
"build": "pnpm build-wasm && pnpm -C packages/app build",
1515
"build-cf": "(command -v cargo >/dev/null || curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal) && PATH=\"$HOME/.cargo/bin:$PATH\" pnpm build",
@@ -23,9 +23,9 @@
2323
},
2424
"devDependencies": {
2525
"fallow": "^3.3.0",
26+
"pkg-pr-new": "0.0.75",
2627
"typescript": "^7.0.2",
2728
"vite-plus": "^0.2.4",
28-
"wasm-pack": "0.15.0",
2929
"wrangler": "4.110.0"
3030
},
3131
"packageManager": "pnpm@11.11.0+sha512.4463f65fd80ed80d69bc1d4bf163ee94f605c7380fc318bb5b2ebe15f8cd12d49c51a4d59e951b401e764d3b6ca751cbf51bc50ed7001a6bcb4935e684c34882"

packages/app/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@
1616
</head>
1717
<body>
1818
<div id="root"></div>
19-
<script type="module" src="/src/main.tsx"></script>
19+
<script type="module" src="./src/main.tsx"></script>
2020
</body>
2121
</html>

packages/app/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"zod": "^4.4.3"
1919
},
2020
"devDependencies": {
21+
"@hiogawa/demucs-onnx-wasm": "workspace:*",
2122
"@playwright/test": "^1.61.1",
2223
"@tailwindcss/vite": "^4.3.2",
2324
"@types/node": "^26.1.1",

packages/app/src/lib/audio/separate.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1+
import init, {
2+
separate as separateWasm,
3+
type Host,
4+
} from "@hiogawa/demucs-onnx-wasm";
15
import ortWasmModuleUrl from "onnxruntime-web/ort-wasm-simd-threaded.mjs?url";
26
import ortWasmUrl from "onnxruntime-web/ort-wasm-simd-threaded.wasm?url";
37
// Browser capabilities plugged into the Rust/WASM separation driver. The worker owns
48
// messaging; this module owns fetch and onnxruntime-web only.
59
import * as ort from "onnxruntime-web/wasm";
6-
import init, {
7-
separate as separateWasm,
8-
type Host,
9-
} from "../../../../../crates/wasm/pkg/demucs_wasm.js";
1010
import {
1111
MODEL_INPUT_LENGTH,
1212
MODEL_OUTPUT_LENGTH,

pnpm-lock.yaml

Lines changed: 18 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pnpm-workspace.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
packages:
22
- packages/*
3+
- crates/wasm
34
verifyDepsBeforeRun: false
45
allowBuilds:
56
esbuild: false

0 commit comments

Comments
 (0)