Skip to content

Commit

Permalink
rename + bump (#102)
Browse files Browse the repository at this point in the history
  • Loading branch information
kearfy authored Aug 13, 2024
1 parent b4d33e6 commit 3b4c61f
Show file tree
Hide file tree
Showing 8 changed files with 82 additions and 76 deletions.
51 changes: 27 additions & 24 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,32 @@ name: CI
on: push

jobs:
build:
name: Attempt Build
runs-on: ubuntu-latest
steps:
- name: "Checkout"
uses: actions/checkout@v3
- name: "Install Node & NPM"
uses: actions/setup-node@v3
with:
node-version: '18.x'
registry-url: 'https://registry.npmjs.org'
- uses: pnpm/action-setup@v2
name: Install pnpm
id: pnpm-install
with:
version: 8
- name: "Install wasm-pack"
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
build:
name: Attempt Build
runs-on: ubuntu-latest
steps:
- name: "Checkout"
uses: actions/checkout@v3
- name: "Install Node & NPM"
uses: actions/setup-node@v3
with:
node-version: "18.x"
registry-url: "https://registry.npmjs.org"
- uses: pnpm/action-setup@v2
name: Install pnpm
id: pnpm-install
with:
version: 8
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: 1.79.0
- name: "Install wasm-pack"
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh

- name: Install jq
uses: dcarbone/[email protected]
- name: Install jq
uses: dcarbone/[email protected]

- name: "Install NPM dependencies"
run: npm install
- name: "Build & Bundle"
run: npm run build
- name: "Install NPM dependencies"
run: npm install
- name: "Build & Bundle"
run: npm run build
63 changes: 33 additions & 30 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,35 +1,38 @@
name: Publish Package to npmjs
on:
push:
tags:
- '*'
push:
tags:
- "*"
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: "Checkout"
uses: actions/checkout@v3
- name: "Install Node & NPM"
uses: actions/setup-node@v3
with:
node-version: '18.x'
registry-url: 'https://registry.npmjs.org'
- uses: pnpm/action-setup@v2
name: Install pnpm
id: pnpm-install
with:
version: 8
- name: "Install wasm-pack"
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
build:
runs-on: ubuntu-latest
steps:
- name: "Checkout"
uses: actions/checkout@v3
- name: "Install Node & NPM"
uses: actions/setup-node@v3
with:
node-version: "18.x"
registry-url: "https://registry.npmjs.org"
- uses: pnpm/action-setup@v2
name: Install pnpm
id: pnpm-install
with:
version: 8
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: 1.79.0
- name: "Install wasm-pack"
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh

- name: Install jq
uses: dcarbone/[email protected]
- name: Install jq
uses: dcarbone/[email protected]

- name: "Install NPM dependencies"
run: npm install
- name: "Build & Bundle"
run: npm run build
- name: "Publish!"
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: "Install NPM dependencies"
run: npm install
- name: "Build & Bundle"
run: npm run build
- name: "Publish!"
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,21 @@
<a href="https://www.youtube.com/channel/UCjf2teVEuYVvvVC-gFZNq6w"><img src="https://img.shields.io/badge/youtube-subscribe-fc1c1c.svg?style=flat-square"></a>
</p>

# surrealdb.wasm
# @surrealdb/wasm

A WebAssembly engine for the SurrealDB [JavaScript SDK](https://github.com/surrealdb/surrealdb.js).

This library is a plugin for the SurrealDB JavaScript SDK, which can be used to run SurrealDB as an embedded database within a browser environment, not server side environments.

It enables SurrealDB to be run in-memory, or to persist data by running on top of IndexedDB. It allows for a consistent JavaScript and TypeScript API when using the `surrealdb.js` library by adding support for embedded storage engines (`memory`, `indxdb`) alongside the remote connection protocols (`http`, `https`, `ws`, `wss`).
It enables SurrealDB to be run in-memory, or to persist data by running on top of IndexedDB. It allows for a consistent JavaScript and TypeScript API when using the `surrealdb.js` library by adding support for embedded storage engines (`memory`, `indxdb`) alongside the remote connection protocols (`http`, `https`, `ws`, `wss`).

This library works with ES modules (`import`), not CommonJS (`require`).

## Example usage

```js
import { Surreal } from 'surrealdb.js';
import { surrealdbWasmEngines } from 'surrealdb.wasm';
import { Surreal } from 'surrealdb';
import { surrealdbWasmEngines } from '@surrealdb/wasm';

// Enable the WebAssembly engines
const db = new Surreal({
Expand All @@ -63,7 +63,7 @@ When using [Vite](https://vitejs.dev/) the following configuration is recommende

```js
optimizeDeps: {
exclude: ['surrealdb.wasm', 'surrealql.wasm'],
exclude: ['@surrealdb/wasm', 'surrealql.wasm'],
esbuildOptions: {
target: 'esnext',
},
Expand Down
2 changes: 1 addition & 1 deletion build/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ async function bundle(target) {
format: "esm",
platform: "node",
outfile: `dist/${target}/esm.js`,
external: ["surrealdb.js"],
external: ["surrealdb"],
plugins: [
copyFilePlugin({
after: Object.fromEntries(
Expand Down
10 changes: 5 additions & 5 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
</head>
<body>
<p>
All exports from surrealdb.js and surrealdb.wasm are assigned to the
window, and under "surreal", a new Surreal instance was created with
the wasm engine already installed. You can play around with it in
the browser console!
All exports from the surrealdb and @surrealdb/wasm packages are
assigned to the window, and under "surreal", a new Surreal instance
was created with the wasm engine already installed. You can play
around with it in the browser console!
</p>
<script type="module">
import * as surrealdb from "./node_modules/surrealdb.js/dist/esm.bundled.js";
import * as surrealdb from "./node_modules/surrealdb/dist/esm.bundled.js";
import * as wasm from "./dist/embedded/esm.bundled.js";
if (typeof window !== "undefined") {
Object.assign(window, surrealdb);
Expand Down
2 changes: 1 addition & 1 deletion lib/embedded.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
type RpcRequest,
type RpcResponse,
UnexpectedConnectionError,
} from "surrealdb.js";
} from "surrealdb";

export function surrealdbWasmEngines(opts?: ConnectionOptions) {
class WasmEmbeddedEngine extends AbstractEngine {
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "surrealdb.wasm",
"version": "1.0.0-beta.15",
"name": "@surrealdb/wasm",
"version": "1.0.0-beta.16",
"description": "WebAssembly driver for SurrealDB",
"repository": {
"type": "git",
Expand Down Expand Up @@ -34,9 +34,9 @@
"typescript": "^5.4.5"
},
"dependencies": {
"surrealdb.js": "^1.0.0-beta.11"
"surrealdb": "^1.0.0-beta.20"
},
"peerDependencies": {
"surrealdb.js": "^1.0.0-beta.11"
"surrealdb": "^1.0.0-beta.20"
}
}
12 changes: 6 additions & 6 deletions pnpm-lock.yaml

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

0 comments on commit 3b4c61f

Please sign in to comment.