Skip to content
Open
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
6 changes: 3 additions & 3 deletions .github/workflows/npm-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:

- name: Install Playwright browsers with dependencies
run: |
cd svelte-test
cd packages/ui
npx playwright install --with-deps

- name: Test full integration
Expand Down Expand Up @@ -72,7 +72,7 @@ jobs:
NEW_NPM_VERSION=$(npm --prefix pkg version prerelease --preid alpha --no-git-tag-version)
NEW_VERSION=${NEW_NPM_VERSION#v}
echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV
for manifest in packages/sqlite-web/Cargo.toml packages/sqlite-web-core/Cargo.toml; do
for manifest in crates/sqlite-web/Cargo.toml crates/sqlite-web-core/Cargo.toml; do
sed -i.bak "s/^version = \".*\"/version = \"$NEW_VERSION\"/" "$manifest"
rm "$manifest".bak
done
Expand All @@ -81,7 +81,7 @@ jobs:
- name: Commit And Tag
if: ${{ env.OLD_HASH != env.NEW_HASH }}
run: |
git add pkg/package.json packages/sqlite-web/Cargo.toml packages/sqlite-web-core/Cargo.toml
git add pkg/package.json crates/sqlite-web/Cargo.toml crates/sqlite-web-core/Cargo.toml
git commit -m "NPM Package Release v${{ env.NEW_VERSION }}"
git tag npm-v${{ env.NEW_VERSION }}

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-ui.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ jobs:

- name: Install Playwright browsers with dependencies
run: |
cd svelte-test
cd packages/ui
npx playwright install --with-deps

- run: nix develop -c test-ui

- name: Frontend linting and formatting
run: |
cd svelte-test
cd packages/ui
npm run lint-format-check
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
!pkg/package.json
!pkg/.gitignore
# Generated files from bundle.sh
packages/sqlite-web/src/embedded_worker.js
crates/sqlite-web/src/embedded_worker.js
pkg/sqlite_web_bg.wasm.b64

# macOS
Expand Down
4 changes: 2 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"rust-analyzer.cargo.target": "wasm32-unknown-unknown",
"rust-analyzer.linkedProjects": [
"./Cargo.toml",
"./packages/sqlite-web-core/Cargo.toml",
"./packages/sqlite-web/Cargo.toml",
"./crates/sqlite-web-core/Cargo.toml",
"./crates/sqlite-web/Cargo.toml",
"./lib/rain.math.float/Cargo.toml"
],
"[rust]": {
Expand Down
26 changes: 13 additions & 13 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,26 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
4. Packages with `npm pack` and updates Svelte test integration

### Individual Package Builds
- `cd packages/sqlite-web-core && wasm-pack build --target web --out-dir ../../pkg`
- `cd packages/sqlite-web && wasm-pack build --target web --out-dir ../../pkg`
- `cd crates/sqlite-web-core && wasm-pack build --target web --out-dir ../../pkg`
- `cd crates/sqlite-web && wasm-pack build --target web --out-dir ../../pkg`

### Testing
- `./test.sh` - Run all Rust WASM tests (both packages)
- `cd packages/sqlite-web-core && wasm-pack test --headless --chrome` - Test core package only
- `cd packages/sqlite-web && wasm-pack test --headless --chrome` - Test worker package only
- `cd crates/sqlite-web-core && wasm-pack test --headless --chrome` - Test core package only
- `cd crates/sqlite-web && wasm-pack test --headless --chrome` - Test worker package only

### Svelte Test App
- `cd svelte-test && bun dev` - Start development server
- `cd svelte-test && bun build` - Production build
- `cd svelte-test && bun run check` - TypeScript checking with svelte-check
### UI App
- `cd packages/ui && bun dev` - Start development server
- `cd packages/ui && bun build` - Production build
- `cd packages/ui && bun run check` - TypeScript checking with svelte-check

## Project Architecture

This is a **Rust WebAssembly SQLite Worker** project with a workspace architecture consisting of two main packages and a Svelte test application.
This is a **Rust WebAssembly SQLite Worker** project with a workspace architecture consisting of two main crates and a Svelte UI application.

### Core Components

#### 1. `packages/sqlite-web-core/`
#### 1. `crates/sqlite-web-core/`
- **Purpose**: Core SQLite functionality and worker implementation
- **Key modules**:
- `worker.rs` - Main worker entry point called by `worker_main()`
Expand All @@ -42,7 +42,7 @@ This is a **Rust WebAssembly SQLite Worker** project with a workspace architectu
- **Dependencies**: sqlite-wasm-rs, alloy (Ethereum tooling), rain-math-float
- **Output**: WASM module with JS glue code

#### 2. `packages/sqlite-web/`
#### 2. `crates/sqlite-web/`
- **Purpose**: Public API that creates self-contained workers with embedded core
- **Key files**:
- `lib.rs` - `SQLiteWasmDatabase` struct with async query interface
Expand All @@ -56,7 +56,7 @@ This is a **Rust WebAssembly SQLite Worker** project with a workspace architectu
- **Integration**: Custom functions accessible from SQLite via `database_functions.rs`
- **Architecture**: Solidity-compatible decimal float operations with Rust/WASM bindings

#### 4. `svelte-test/`
#### 4. `packages/ui/`
- **Purpose**: Integration test and example usage
- **Technology**: SvelteKit + TypeScript + Vite
- **Pattern**: Imports `sqlite-web` package from local tarball
Expand All @@ -66,7 +66,7 @@ This is a **Rust WebAssembly SQLite Worker** project with a workspace architectu
1. **Core Build**: `sqlite-web-core` compiled to WASM + JS glue
2. **Embedding**: WASM converted to base64 and embedded into JavaScript template
3. **Wrapper Build**: `sqlite-web` compiled with embedded worker generator
4. **Packaging**: NPM package created and integrated into Svelte test
4. **Packaging**: NPM package created and integrated into UI app

### Key Design Patterns

Expand Down
4 changes: 2 additions & 2 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[workspace]
members = [
"packages/sqlite-web-core",
"packages/sqlite-web"
"crates/sqlite-web-core",
"crates/sqlite-web"
]
exclude = [
"lib/rain.math.float"
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
12 changes: 6 additions & 6 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
name = "test-wasm";
body = ''
set -euxo pipefail
cd packages/sqlite-web-core
cd crates/sqlite-web-core
wasm-pack test --headless --chrome
cd ../..
cd packages/sqlite-web
cd crates/sqlite-web
wasm-pack test --headless --chrome
cd ../..
'';
Expand All @@ -28,10 +28,10 @@
name = "build-wasm";
body = ''
set -euxo pipefail
cd packages/sqlite-web-core
cd crates/sqlite-web-core
wasm-pack build --target web --out-dir ../../pkg
cd ../..
cd packages/sqlite-web
cd crates/sqlite-web
wasm-pack build --target web --out-dir ../../pkg
cd ../..
'';
Expand All @@ -50,9 +50,9 @@
body = ''
set -euxo pipefail
./scripts/local-bundle.sh
cd svelte-test
cd packages/ui
npm run test
cd ..
cd ../..
'';
};

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions svelte-test/bun.lock → packages/ui/bun.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
"lockfileVersion": 1,
"workspaces": {
"": {
"name": "svelte-test",
"name": "ui",
"dependencies": {
"@rainlanguage/sqlite-web": "file:../pkg/rainlanguage-sqlite-web-0.1.0.tgz",
"@rainlanguage/sqlite-web": "file:../../pkg/rainlanguage-sqlite-web-0.1.0.tgz",
},
"devDependencies": {
"@eslint/js": "^9.33.0",
Expand Down
File renamed without changes.
Loading