Skip to content

Commit 1063e09

Browse files
Add changeset. Simplify node.js demo
1 parent 54c30c4 commit 1063e09

File tree

2 files changed

+6
-11
lines changed

2 files changed

+6
-11
lines changed

.changeset/quiet-owls-flash.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@powersync/common': minor
3+
---
4+
5+
Added ability to specify appMetadata for sync/stream requests

demos/example-node/src/main.ts

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
import { once } from 'node:events';
2-
import { readFileSync } from 'node:fs';
3-
import { dirname, join } from 'node:path';
42
import repl_factory from 'node:repl';
5-
import { fileURLToPath } from 'node:url';
63
import { Worker } from 'node:worker_threads';
74

85
import {
@@ -62,18 +59,11 @@ const main = async () => {
6259
});
6360
console.log(await db.get('SELECT powersync_rs_version();'));
6461

65-
// Read package version for metadata
66-
const __filename = fileURLToPath(import.meta.url);
67-
const __dirname = dirname(__filename);
68-
const packageJsonPath = join(__dirname, '..', 'package.json');
69-
const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf-8'));
70-
const packageVersion = packageJson.version;
71-
7262
await db.connect(new DemoConnector(), {
7363
connectionMethod: SyncStreamConnectionMethod.WEB_SOCKET,
7464
clientImplementation: SyncClientImplementation.RUST,
7565
appMetadata: {
76-
package_version: packageVersion
66+
package_version: process.env.npm_package_version || 'unknown'
7767
}
7868
});
7969
// Example using a proxy agent for more control over the connection:

0 commit comments

Comments
 (0)