Skip to content

Commit d3c0b5b

Browse files
build with rust extension
1 parent a796ae9 commit d3c0b5b

File tree

15 files changed

+332
-210
lines changed

15 files changed

+332
-210
lines changed

.changeset/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Changesets
2+
3+
Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
4+
with multi-package repos, or single-package repos to help you version and publish your code. You can
5+
find the full documentation for it [in our repository](https://github.com/changesets/changesets)
6+
7+
We have a quick list of common questions to get you started engaging with this project in
8+
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)

.changeset/config.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"$schema": "https://unpkg.com/@changesets/config@2.3.1/schema.json",
3+
"changelog": "@changesets/cli/changelog",
4+
"commit": false,
5+
"fixed": [],
6+
"linked": [],
7+
"access": "restricted",
8+
"baseBranch": "master",
9+
"updateInternalDependencies": "patch",
10+
"ignore": []
11+
}

.devcontainer/devcontainer.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
2+
// README at: https://github.com/devcontainers/templates/tree/main/src/debian
3+
{
4+
"name": "Debian",
5+
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
6+
"build": {
7+
"dockerfile": "../Dockerfile"
8+
},
9+
"features": {
10+
"ghcr.io/ebaskoro/devcontainer-features/emscripten:1": {}
11+
},
12+
13+
// Features to add to the dev container. More info: https://containers.dev/features.
14+
// "features": {},
15+
16+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
17+
"forwardPorts": [8000],
18+
19+
// Configure tool-specific properties.
20+
// "customizations": {},
21+
22+
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
23+
"remoteUser": "root"
24+
}

.github/workflows/ci.yml

Lines changed: 45 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,15 @@ name: wa-sqlite CI
55

66
on:
77
push:
8-
branches: [ "master" ]
8+
branches: ['master']
99
pull_request:
10-
branches: [ "master" ]
10+
branches: ['master']
1111

1212
env:
1313
EM_VERSION: 3.1.45
1414
EM_CACHE_FOLDER: 'emsdk-cache'
1515

1616
jobs:
17-
1817
build:
1918
runs-on: ubuntu-latest
2019

@@ -23,43 +22,49 @@ jobs:
2322
node-version: [16.x]
2423

2524
steps:
26-
- uses: actions/checkout@v3
27-
- name: Use Node.js ${{ matrix.node-version }}
28-
uses: actions/setup-node@v3
29-
with:
30-
node-version: ${{ matrix.node-version }}
31-
cache: 'npm'
32-
33-
# Install yarn dependencies.
34-
- name: Get yarn cache directory path
35-
id: yarn-cache-dir-path
36-
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
37-
- uses: actions/cache@v3
38-
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
39-
with:
40-
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
41-
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
42-
restore-keys: |
43-
${{ runner.os }}-yarn-
44-
- run: yarn install
25+
- uses: actions/checkout@v4
26+
with:
27+
submodules: 'recursive'
28+
- name: Use Node.js ${{ matrix.node-version }}
29+
uses: actions/setup-node@v3
30+
with:
31+
node-version: ${{ matrix.node-version }}
32+
cache: 'npm'
33+
34+
# Install yarn dependencies.
35+
- name: Get yarn cache directory path
36+
id: yarn-cache-dir-path
37+
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
38+
- uses: actions/cache@v3
39+
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
40+
with:
41+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
42+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
43+
restore-keys: |
44+
${{ runner.os }}-yarn-
45+
- run: yarn install
46+
- name: Rust Setup
47+
run: |
48+
rustup toolchain install nightly-2023-08-28-x86_64-unknown-linux-gnu
49+
rustup component add rust-src --toolchain nightly-2023-08-28-x86_64-unknown-linux-gnu
4550
46-
- name: Test with checked-in WASM files
47-
run: yarn test --reporters progress
51+
- name: Test with checked-in WASM files
52+
run: yarn test --reporters progress
4853

49-
# Install EMSDK
50-
- name: Setup Emscripten
51-
id: cache-system-libraries
52-
uses: actions/cache@v3
53-
with:
54-
path: ${{env.EM_CACHE_FOLDER}}
55-
key: ${{env.EM_VERSION}}-${{ runner.os }}
56-
- uses: mymindstorm/setup-emsdk@v12
57-
with:
58-
version: ${{env.EM_VERSION}}
59-
actions-cache-folder: ${{env.EM_CACHE_FOLDER}}
60-
- run: emcc -v
54+
# Install EMSDK
55+
- name: Setup Emscripten
56+
id: cache-system-libraries
57+
uses: actions/cache@v3
58+
with:
59+
path: ${{env.EM_CACHE_FOLDER}}
60+
key: ${{env.EM_VERSION}}-${{ runner.os }}
61+
- uses: mymindstorm/setup-emsdk@v12
62+
with:
63+
version: ${{env.EM_VERSION}}
64+
actions-cache-folder: ${{env.EM_CACHE_FOLDER}}
65+
- run: emcc -v
6166

62-
- name: Test WASM build
63-
run: |
64-
make clean && make
65-
yarn test --reporters progress
67+
- name: Test WASM build
68+
run: |
69+
make clean && make
70+
yarn test --reporters progress

.github/workflows/dev-packages.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Action to publish packages under the `next` tag for testing
2+
# Packages are versioned as `0.0.0-{tag}-DATETIMESTAMP`
3+
name: Packages Deploy
4+
5+
on: workflow_dispatch
6+
7+
jobs:
8+
publish:
9+
name: Publish Dev Packages
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v3
13+
14+
- name: Setup NodeJS
15+
uses: actions/setup-node@v2
16+
with:
17+
node-version: 18
18+
19+
- name: Setup Yarn
20+
run: |
21+
npm install -g yarn
22+
echo "Yarn version: $(yarn -v)"
23+
echo "//registry.npmjs.org/:_authToken=${{secrets.NPM_TOKEN}}" >> ~/.npmrc
24+
25+
- name: Install Dependencies
26+
run: yarn install --frozen-lockfile
27+
28+
- name: Version packages
29+
run: yarn changeset version --no-git-tag --snapshot dev
30+
31+
- name: Publish
32+
run: yarn changeset publish --tag dev

.github/workflows/release.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
concurrency: ${{ github.workflow }}-${{ github.ref }}
9+
10+
jobs:
11+
release:
12+
name: Release
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout Repo
16+
uses: actions/checkout@v3
17+
18+
- name: Setup Node.js 18
19+
uses: actions/setup-node@v3
20+
with:
21+
node-version: 18
22+
23+
- name: Install Dependencies
24+
run: yarn
25+
26+
- name: Create Release Pull Request or Publish to npm
27+
id: changesets
28+
uses: changesets/action@v1
29+
with:
30+
# This expects you to have a script called release which does a build for your packages and calls changeset publish
31+
publish: yarn release
32+
version: yarn changeset version
33+
env:
34+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "powersync-sqlite-core"]
2+
path = powersync-sqlite-core
3+
url = git@github.com:powersync-ja/powersync-sqlite-core.git

demo/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
<div id="timestamp"></div>
4848
<div id="output"></div>
4949

50-
<script type="module" src="index.js"></script>
50+
<script type="module" src="demo/index.js"></script>
5151

5252
<a href="https://github.com/rhashimoto/wa-sqlite" class="github-corner" aria-label="View source on GitHub">
5353
<svg width="60" height="60" viewBox="0 0 250 250"

demo/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ window.addEventListener('DOMContentLoaded', async function() {
7777
const params = new URLSearchParams(window.location.search);
7878
if (params.has('clear')) {
7979
localStorage.clear();
80-
const worker = new Worker('./clean-worker.js', { type: 'module' });
80+
const worker = new Worker('./demo/clean-worker.js', { type: 'module' });
8181
await new Promise(resolve => {
8282
worker.addEventListener('message', resolve);
8383
});
@@ -129,7 +129,7 @@ window.addEventListener('DOMContentLoaded', async function() {
129129

130130
// Restart the worker.
131131
worker?.terminate();
132-
worker = new Worker('./demo-worker.js', { type: 'module' });
132+
worker = new Worker('./demo/demo-worker.js', { type: 'module' });
133133
await new Promise(resolve => {
134134
worker.addEventListener('message', resolve, { once: true });
135135
});

0 commit comments

Comments
 (0)