Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,48 @@ jobs:

- name: Compile for wasm32 target
run: just check

comment:
name: Comment on PR
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
with:
script: |
const marker = '<!-- rust-code-modified -->';
const body = [
marker,
'⚠️ **This PR modifies the Rust code.**',
'',
'For these changes to take effect in the TypeScript code, you will need to:',
'',
'1. Publish a new version of the `argon2id-wasm` package on npm.',
'2. Update the dependency on `argon2id-wasm` in the `core` component.',
].join('\n');

const { data: comments } = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
});

const existing = comments.find((c) => c.body.includes(marker));

if (existing) {
await github.rest.issues.updateComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: existing.id,
body,
});
} else {
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body,
});
}
12 changes: 0 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,6 @@ This branch contains a WIP implementation of Convex Auth v2.

Use `pnpm install` at the root.

The `argon2id-wasm` package depends on some Rust code compiled to WebAssembly.
Its `prepare` script builds it automatically on `pnpm install` when the compiled
output is missing, so you'll need [`just`](https://github.com/casey/just) and the
toolchain pinned in `packages/argon2id-wasm/src/argon2-wasm/rust-toolchain.toml` (installed
automatically by `rustup` on first use).

To rebuild the WASM after changing the Rust source, run:

```bash
pnpm --filter argon2id-wasm build:wasm
```

Common tasks:

- `pnpm test` — run tests across packages (Vitest).
Expand Down
2 changes: 1 addition & 1 deletion packages/argon2id-wasm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
},
"scripts": {
"build:wasm": "cd rust && just build",
"prepare": "test -f src/argon2-wasm/pkg/argon2_wasm_bg.wasm || pnpm run build:wasm",
"prepack": "pnpm run build:wasm",
"typecheck": "tsc --noEmit"
},
"devDependencies": {
Expand Down
7 changes: 4 additions & 3 deletions packages/argon2id-wasm/rust/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ just build # regenerate pkg/ via wasm-pack (pinned version)
`pkg/` is gitignored and regenerated by `just build`. After changing `src/lib.rs`, run
`just build` (or `pnpm --filter argon2id-wasm build:wasm`) to regenerate it.

The `argon2id-wasm` package's `prepare` script runs `just build` automatically on
`pnpm install` whenever `pkg/` is missing, so a fresh checkout builds it without manual
steps.
The core package depends on the version of the package published to NPM,
so that contributors don’t need to run the Rust toolchain when doing NPM-only changes.
After making changes to argon2id-wasm, manually publish the package and update the
dependency version.
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
},
"dependencies": {
"@convex-dev/rate-limiter": "^0.3.2",
"argon2id-wasm": "workspace:*",
"argon2id-wasm": "0.0.0-alpha.1",
"jose": "^5.2.2"
},
"devDependencies": {
Expand Down
9 changes: 7 additions & 2 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading