Skip to content

Commit 7ec4a6b

Browse files
committed
fix npm pkg issues
1 parent ecce7b7 commit 7ec4a6b

File tree

6 files changed

+26
-13
lines changed

6 files changed

+26
-13
lines changed

README.md

+10-3
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,19 @@
33
A WebSocket-TCP proxy that enables PostgreSQL clients to connect to a Postgres database running in the browser. Designed to work with [PGlite](https://pglite.dev/), a lightweight embeddable Postgres that runs in WebAssembly.
44

55
This allows you to:
6+
67
- Use standard PostgreSQL clients (psql, pgAdmin, [Drizzle Studio](https://orm.drizzle.team/drizzle-studio/overview), etc.) to connect to a browser-based database
78
- Use tools like `pg_dump` to backup your database
89

910
## How it Works
1011

1112
The proxy creates two servers:
13+
1214
1. A WebSocket server that communicates with the database instance in the browser
1315
2. A TCP server that accepts standard PostgreSQL client connections
1416

1517
When a PostgreSQL client connects to the TCP server, the proxy:
18+
1619
1. Forwards the client's messages to the browser through WebSocket
1720
2. Returns the browser's responses back to the client through TCP
1821

@@ -32,16 +35,19 @@ bun add pg-browser-proxy
3235
### 2. Start the Proxy
3336

3437
Using bunx:
38+
3539
```sh
3640
bunx pg-browser-proxy
3741
```
3842

3943
To use custom ports:
44+
4045
```sh
4146
bunx pg-browser-proxy -t 5433 -w 8080
4247
```
4348

4449
See all options:
50+
4551
```sh
4652
bunx pg-browser-proxy -h
4753
```
@@ -55,7 +61,7 @@ import { PGliteWorker } from "@electric-sql/pglite/worker";
5561
const db = await PGliteWorker.create(
5662
new Worker(new URL("./worker", import.meta.url), {
5763
type: "module",
58-
})
64+
}),
5965
);
6066

6167
// Connect to the proxy in development
@@ -81,13 +87,14 @@ pg_dump -h localhost -p 5432 -U postgres > backup.sql
8187
```
8288

8389
For tools like Drizzle Studio, configure your connection in your drizzle config:
90+
8491
```typescript
8592
export default defineConfig({
8693
dialect: "postgresql",
8794
dbCredentials: {
8895
url: "postgres://localhost:5432",
8996
ssl: false,
90-
}
97+
},
9198
});
9299
```
93100

@@ -98,4 +105,4 @@ export default defineConfig({
98105
## Further Reading
99106

100107
- [pg-gateway](https://github.com/supabase-community/pg-gateway) - Built on top of this project
101-
- [postgres.new](https://supabase.com/blog/postgres-new) - A blog post by Supabase about running Postgres in the browser
108+
- [postgres.new](https://supabase.com/blog/postgres-new) - A blog post by Supabase about running Postgres in the browser

examples/pglite-drizzle/src/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!DOCTYPE html>
1+
<!doctype html>
22
<html lang="en">
33
<head>
44
<meta charset="UTF-8" />

examples/pglite-prisma/src/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!DOCTYPE html>
1+
<!doctype html>
22
<html lang="en">
33
<head>
44
<meta charset="UTF-8" />

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
},
2121
"repository": {
2222
"type": "git",
23-
"url": "https://github.com/f0rr0/pg-browser-proxy"
23+
"url": "git+https://github.com/f0rr0/pg-browser-proxy.git"
2424
},
2525
"funding": {
2626
"type": "github",

packages/pg-browser-proxy/package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"license": "MIT",
3333
"repository": {
3434
"type": "git",
35-
"url": "https://github.com/f0rr0/pg-browser-proxy"
35+
"url": "git+https://github.com/f0rr0/pg-browser-proxy.git"
3636
},
3737
"homepage": "https://github.com/f0rr0/pg-browser-proxy#readme",
3838
"bugs": {
@@ -73,11 +73,11 @@
7373
"types": "./dist/browser/index.d.ts"
7474
},
7575
"./proxy": {
76-
"import": "./bin/src/proxy.js",
77-
"types": "./bin/src/proxy.d.ts"
76+
"import": "./dist/proxy/proxy.js",
77+
"types": "./dist/proxy/proxy.d.ts"
7878
}
7979
},
8080
"bin": {
81-
"pg-proxy": "./bin/src/cli/bin.js"
81+
"pg-browser-proxy": "bin/bin.js"
8282
}
8383
}

packages/pg-browser-proxy/src/cli/help.ts

+9-3
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,17 @@ const command: GluegunCommand = {
1313
print.info(`
1414
${chalk.bold.blue("🔌 PG Browser Proxy")}
1515
16-
${chalk.blue("A WebSocket-TCP proxy that enables PostgreSQL clients to connect to in-browser databases")}
16+
${chalk.blue(
17+
"A WebSocket-TCP proxy that enables PostgreSQL clients to connect to in-browser databases",
18+
)}
1719
1820
${chalk.bold("Options:")}
19-
-t, --tcp-port <port> TCP port for PostgreSQL clients ${chalk.dim(`(default: ${DEFAULT_CONFIG.tcpPort})`)}
20-
-w, --ws-port <port> WebSocket port for browser connections ${chalk.dim(`(default: ${DEFAULT_CONFIG.wsPort})`)}
21+
-t, --tcp-port <port> TCP port for PostgreSQL clients ${chalk.dim(
22+
`(default: ${DEFAULT_CONFIG.tcpPort})`,
23+
)}
24+
-w, --ws-port <port> WebSocket port for browser connections ${chalk.dim(
25+
`(default: ${DEFAULT_CONFIG.wsPort})`,
26+
)}
2127
-s, --silent Suppress all output
2228
-h, --help Display help
2329
-v, --version Display version

0 commit comments

Comments
 (0)