Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Update build #12

Merged
merged 12 commits into from
Nov 10, 2024
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
2 changes: 1 addition & 1 deletion .github/workflows/lint-pr.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "Lint PR"
name: Lint PR
on:
pull_request_target:
types:
Expand Down
40 changes: 18 additions & 22 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,38 +14,34 @@ on:
jobs:
test:
name: Test
# running with macos since it contains the safari driver
runs-on: macos-latest
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- run: brew install --cask firefox
- name: Install Firefox
run: sudo apt-get update && sudo apt-get install -y firefox
- name: Update rust toolchains
run: rustup update
- name: Install wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- name: Setup node and yarn
- name: Cache
uses: Swatinem/rust-cache@v2
with:
workspaces: |
.
- name: Setup node
uses: actions/setup-node@v4
with:
node-version-file: ".node-version"
cache-dependency-path: "./yarn.lock"
cache-dependency-path: "yarn.lock"
cache: "yarn"
env:
SKIP_YARN_COREPACK_CHECK: "1"
- name: Enable corepack
run: corepack enable
- name: Run Yarn install
uses: borales/actions-yarn@v5
with:
cmd: --cwd ./ install
- name: Cache
uses: Swatinem/rust-cache@v2
with:
workspaces: |
.
- run: cargo build --target wasm32-unknown-unknown --tests --features unsafe-debug-query
- run: wasm-pack test --headless --chrome --features unsafe-debug-query
working-directory: ./
- run: wasm-pack test --headless --firefox --features unsafe-debug-query
working-directory: ./
- name: Install dependencies
run: yarn
- name: Build rust
run: cargo build --target wasm32-unknown-unknown --tests --features unsafe-debug-query
- name: Test in Chrome
run: yarn test:chrome:headless
- name: Test in Firefox
run: yarn test:firefox:headless
2 changes: 1 addition & 1 deletion .node-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
18.19.1
20.17.0
38 changes: 19 additions & 19 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
{
"rust-analyzer": {
"cargo": {
"sysroot": "discover",
"allTargets": false,
"target": "wasm32-unknown-unknown"
},
"procMacro": {
"enable": true,
"attributes.enable": true,
"ignored": {
"async-trait": ["async_trait"],
"napi-derive": ["napi"],
"async-recursion": ["async_recursion"],
"ctor": ["ctor"],
"tokio": ["test"],
"diesel": ["table"],
"wasm-bindgen": ["wasm-bindgen"]
}
}
"rust-analyzer.cargo.sysroot": "discover",
"rust-analyzer.cargo.allTargets": false,
"rust-analyzer.cargo.target": "wasm32-unknown-unknown",
"rust-analyzer.procMacro.enable": true,
"rust-analyzer.diagnostics.enable": true,
"rust-analyzer.diagnostics.disabled": [
"unlinked-file",
"unresolved-macro-call",
"unresolved-proc-macro"
],
"rust-analyzer.procMacro.attributes.enable": true,
"rust-analyzer.procMacro.ignored": {
"async-trait": ["async_trait"],
"napi-derive": ["napi"],
"async-recursion": ["async_recursion"],
"ctor": ["ctor"],
"tokio": ["test"],
"diesel": ["table"],
"wasm-bindgen": ["wasm-bindgen"]
},
"[toml]": {
"editor.defaultFormatter": "tamasfe.even-better-toml"
Expand Down
934 changes: 934 additions & 0 deletions .yarn/releases/yarn-4.5.1.cjs

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ enableGlobalCache: false
enableTelemetry: false

nodeLinker: node-modules

yarnPath: .yarn/releases/yarn-4.5.1.cjs
34 changes: 16 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Diesel Backend for SQLite and WASM

### Use SQLite with Diesel ORM in your web apps!
Use SQLite with Diesel ORM in your web apps!

## Quickstart

add `diesel-wasm-sqlite` to your project. SQLite is automatically bundled with
Add `diesel-wasm-sqlite` to your project. SQLite is automatically bundled with
the library.

```toml
Expand Down Expand Up @@ -63,39 +63,37 @@ async fn code_in_web_worker() -> Result<i32, diesel::QueryResult<usize>> {
}
```

look in `tests/web.rs` for working example!
Look in `tests/test/web.rs` for a working example!

## Contributing

### Building

#### Install yarn dependencies

`yarn install`
`yarn`

#### Build the SQLite/OPFS BUndle
#### Build the SQLite/OPFS JavaScript Bundle

`yarn run build`
`yarn build`

#### Build the rust code, and re-build `package.json` if it changed
#### Build the rust code

`cargo build --target wasm32-unknown-unknown`

#### Run Tests
#### Run tests (browser)

`wasm-pack test --safari --features unsafe-debug-query`
- `yarn test:chrome`
- `yarn test:firefox`
- `yarn test:safari`

navigate to `http://localhost:8000` to observe test output
Navigate to `http://localhost:8000` to observe test output.

#### Run Tests (headless)
#### Run tests (headless)

`wasm-pack test --safari --headless`

#### Setting up the project in VSCode

rust-analyzer does not like crates with different targets in the same workspace.
If you want this to work well with your LSP, open `diesel-wasm-sqlite` as it's
own project in VSCode.
- `yarn test:chrome:headless`
- `yarn test:firefox:headless`
- `yarn test:safari:headless`

### Opening a Pull Request

Expand Down
Loading