Skip to content

Commit b0ae09e

Browse files
download core with script
1 parent 6cb18df commit b0ae09e

File tree

8 files changed

+43
-11
lines changed

8 files changed

+43
-11
lines changed

README.md

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,19 +46,15 @@ git clone [this repo]
4646
```
4747

4848
```bash
49-
git submodule init
49+
make -B
5050
```
5151

52-
```bash
53-
git submodule update --init --recursive
54-
```
52+
### PowerSync Core
5553

56-
```bash
57-
yarn install
58-
```
54+
To update the PowerSync SQLite core see the [script](./scripts/powersync-core.js). Edit the `CORE_VERSION` and run the script with
5955

6056
```bash
61-
make -B
57+
node scripts/powersync-core.js
6258
```
6359

6460
## API

demo/demo-worker.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ const BUILDS = new Map([
1212
]);
1313

1414
const EXT_WASM = new Map([
15-
['default', 'side_module.wasm'],
16-
['asyncify', 'side_module_async.wasm'],
17-
['jspi', 'side_module_jspi.wasm'],
15+
['default', 'libpowersync.wasm'],
16+
['asyncify', 'libpowersync-async.wasm'],
17+
['jspi', 'libpowersync-jspi.wasm'],
1818
]);
1919

2020
/**

dist/libpowersync-async.wasm

219 KB
Binary file not shown.

dist/libpowersync.wasm

163 KB
Binary file not shown.

dist/shim.o

-208 Bytes
Binary file not shown.

dist/side_module.wasm

-1.04 MB
Binary file not shown.

dist/side_module_asyncify.wasm

-1.68 MB
Binary file not shown.

scripts/powersync-core.js

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/**
2+
* This script downloads PowerSync SQLite Core side-module binaries.
3+
* These modules are placed in the `dist` folder along other binaries.
4+
*/
5+
import fs from 'fs';
6+
import path from 'path';
7+
import { fileURLToPath } from 'url';
8+
9+
const __filename = fileURLToPath(import.meta.url);
10+
const __dirname = path.dirname(__filename);
11+
12+
const CORE_VERSION = 'v0.3.4';
13+
14+
const RELEASE_BASE_URL = `https://github.com/powersync-ja/powersync-sqlite-core/releases/download/${CORE_VERSION}`;
15+
const RELEASE_FILES = [`libpowersync.wasm`, `libpowersync-async.wasm`];
16+
17+
const DIST_DIR = path.resolve(__dirname, '../dist');
18+
19+
async function downloadCore() {
20+
for (const file of RELEASE_FILES) {
21+
console.log(`Downloading ${file}`);
22+
23+
const fileURL = path.join(RELEASE_BASE_URL, file);
24+
const response = await fetch(fileURL);
25+
if (!response.ok) {
26+
throw new Error(`Could not download PowerSync core files. ${await response.text()}`);
27+
}
28+
29+
const distFilePath = path.join(DIST_DIR, file);
30+
const fileContent = await response.arrayBuffer();
31+
fs.writeFileSync(distFilePath, Buffer.from(fileContent));
32+
console.log(`File downloaded to ${distFilePath}`);
33+
}
34+
}
35+
36+
downloadCore();

0 commit comments

Comments
 (0)