Skip to content

Commit cdde208

Browse files
committed
Merge branch 'node-postgres' of https://github.com/drizzle-team/waddler into node-postgres
2 parents c957e33 + 4038120 commit cdde208

3 files changed

Lines changed: 115 additions & 19 deletions

File tree

.github/workflows/test.yaml renamed to .github/workflows/release-feature-branch.yaml

Lines changed: 96 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,10 @@ jobs:
1111
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
1212
runs-on: ubuntu-22.04
1313
steps:
14-
# This action checks-out your repository under $GITHUB_WORKSPACE, so your workflow can access it.
1514
- uses: actions/checkout@v4
16-
1715
- uses: actions/setup-node@v4
1816
with:
19-
node-version: "20.19"
17+
node-version: "22"
2018
registry-url: "https://registry.npmjs.org"
2119

2220
- uses: pnpm/action-setup@v3
@@ -43,10 +41,6 @@ jobs:
4341
- name: Install dependencies
4442
run:
4543
pnpm install
46-
# pnpm approve-builds
47-
48-
# - name: Rebuild duckdb, better-sqlite3
49-
# run: cd integration-tests && pnpm rebuild duckdb better-sqlite3
5044

5145
- name: Build
5246
run: pnpm build
@@ -71,7 +65,7 @@ jobs:
7165

7266
working-directory: integration-tests
7367
run: |
74-
if [[ ${{ github.event_name }} == "push" || "${{ github.event.pull_request.head.repo.full_name }}" == "${{ github.repository }}" ]]; then
68+
if [[ ${{ github.event_name }} != "push" && "${{ github.event.pull_request.head.repo.full_name }}" != "${{ github.repository }}" ]]; then
7569
export RUN_EXTERNAL_DB_TESTS=1
7670
fi
7771
@@ -82,12 +76,11 @@ jobs:
8276
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
8377
runs-on: ubuntu-22.04
8478
steps:
85-
# This action checks-out your repository under $GITHUB_WORKSPACE, so your workflow can access it.
8679
- uses: actions/checkout@v4
8780

8881
- uses: actions/setup-node@v4
8982
with:
90-
node-version: "20.19"
83+
node-version: "22"
9184
registry-url: "https://registry.npmjs.org"
9285

9386
- uses: pnpm/action-setup@v3
@@ -152,3 +145,96 @@ jobs:
152145
if: steps.checks.outputs.has_new_release == 'true'
153146
working-directory: waddler
154147
run: bunx attw package.tgz --profile node16
148+
release:
149+
# only run on all pushes or pull requests from forks
150+
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
151+
needs:
152+
- test
153+
- attw
154+
runs-on: ubuntu-22.04
155+
permissions:
156+
contents: read
157+
id-token: write
158+
steps:
159+
- uses: actions/checkout@v4
160+
161+
- uses: actions/setup-node@v4
162+
with:
163+
node-version: '22'
164+
registry-url: 'https://registry.npmjs.org'
165+
166+
- uses: pnpm/action-setup@v3
167+
name: Install pnpm
168+
id: pnpm-install
169+
with:
170+
version: latest
171+
run_install: false
172+
173+
- name: Get pnpm store directory
174+
id: pnpm-cache
175+
shell: bash
176+
run: |
177+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_OUTPUT
178+
179+
- uses: actions/cache@v4
180+
name: Setup pnpm cache
181+
with:
182+
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
183+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
184+
restore-keys: |
185+
${{ runner.os }}-pnpm-store-
186+
187+
- name: Install dependencies
188+
run: pnpm install
189+
190+
- name: Check preconditions
191+
id: checks
192+
shell: bash
193+
working-directory: waddler
194+
run: |
195+
old_version="$(jq -r .version package.json)"
196+
version="$old_version-$(git rev-parse --short HEAD)"
197+
npm version $version
198+
tag="${{ github.ref_name }}"
199+
is_version_published="$(npm view waddler versions --json | jq -r '.[] | select(. == "'$version'") | . == "'$version'"')"
200+
201+
if [[ "$is_version_published" == "true" ]]; then
202+
echo "\`waddler$version\` already published, adding tag \`$tag\`" >> $GITHUB_STEP_SUMMARY
203+
npm dist-tag add waddler@$version $tag
204+
else
205+
{
206+
echo "version=$version"
207+
echo "tag=$tag"
208+
echo "has_new_release=true"
209+
} >> $GITHUB_OUTPUT
210+
fi
211+
212+
- name: Build
213+
if: steps.checks.outputs.has_new_release == 'true'
214+
run: pnpm build
215+
216+
- name: Pack
217+
if: steps.checks.outputs.has_new_release == 'true'
218+
working-directory: waddler
219+
shell: bash
220+
env:
221+
NODE_AUTH_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }}
222+
run: npm run pack
223+
224+
- name: Publish
225+
if: github.event_name == 'push' && steps.checks.outputs.has_new_release == 'true'
226+
run: |
227+
tag="${{ steps.checks.outputs.tag }}"
228+
version="${{ steps.checks.outputs.version }}"
229+
230+
echo "Publishing waddler@$tag using version $version"
231+
npm run publish -- --tag $tag
232+
233+
echo "npm: \`waddler@$tag | waddler@$version\`" >> $GITHUB_STEP_SUMMARY
234+
235+
# Post release message to Discord
236+
# curl -X POST -H "Content-Type: application/json" -d "{\"embeds\": [{\"title\": \"New \`waddler\` release! 🎉\", \"url\": \"https://www.npmjs.com/package/waddler/v/$version\", \"color\": \"12907856\", \"fields\": [{\"name\": \"Version\", \"value\": \"\`$version\`\"}, {\"name\": \"Tag\", \"value\": \"\`$tag\`\"}]}]}" ${{ secrets.DISCORD_DEV_RELEASE_WEBHOOK_URL }}
237+
working-directory: waddler
238+
shell: bash
239+
env:
240+
NODE_AUTH_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }}

README.md

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,26 @@
33
<a href="https://waddler.drizzle.team/docs/overview">Documentation</a> •
44
<a href="https://x.com/drizzleorm">Twitter</a> • by [Drizzle Team](https://drizzle.team)
55

6-
Waddler is a thin SQL client on top of official DuckDB NodeJS driver with modern API inspired by `postgresjs` and based on ES6 Tagged Template Strings.
6+
Waddler - is a thin SQL client on top of official DuckDB NodeJS driver with modern API inspired by [`postgresjs`](https://github.com/porsager/postgres) and based on ES6 Tagged Template Strings.
77

8-
Waddler has a baked in database pooling which unlocks full potential of hosted DuckDB services like MotherDuck. It does create multiple database instances under the hood and lets you concurrently fetch data from the remote MotherDuck database.
8+
> You don't need to learn an api for db clients; just use the `sql` template tag for everything
9+
10+
Waddler is our vision of a modern, all-in-one client for any database dialect.
11+
It doesn't perform any specific mappings to or from a database, doesn't handle complex query building, and doesn't parse queries.
12+
Waddler simply unifies communication with your database using any client you
13+
choose - whether it's a simple TCP connection or an HTTP-based DB client.
14+
15+
We support all the dialects and drivers that [Drizzle](https://orm.drizzle.team/docs/get-started) supports
16+
17+
You can check a full list of clients you can use - [here](/docs/get-started)
918

1019
```ts
11-
import { waddler } from "waddler";
20+
import { waddler } from "waddler/node-postgres";
21+
import { waddler } from "waddler/mysql2";
22+
import { waddler } from "waddler/libsql";
1223

13-
const sql = waddler({ dbUrl: ":memory:" });
14-
const sql = waddler({ dbUrl: "file.db" });
15-
const sql = waddler({ dbUrl: "md?:" }); // mother duck url
16-
const sql = waddler({ dbUrl: "md?:", min: 1, max: 8 }); // automatic database pooling
24+
const sql = waddler({ dbUrl: process.env.DB_URL });
25+
const sql = waddler();
1726

1827
// promisified SQL template API
1928
const result = await sql`select * from users`;

waddler/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "waddler",
3-
"version": "0.0.12",
3+
"version": "0.1.0",
44
"type": "module",
55
"repository": "https://github.com/drizzle-team/waddler",
66
"license": "MIT",
@@ -9,7 +9,8 @@
99
"start:db": "npx tsx ./src/dev/db-test.ts ",
1010
"lint": "concurrently -n eslint,dprint \"eslint --ext ts .\" \"dprint check --list-different\"",
1111
"build": "pnpm tsx scripts/build.ts",
12-
"pack": "(cd dist && npm pack --pack-destination ..) && rm -f package.tgz && mv *.tgz package.tgz"
12+
"pack": "(cd dist && npm pack --pack-destination ..) && rm -f package.tgz && mv *.tgz package.tgz",
13+
"publish": "npm publish package.tgz"
1314
},
1415
"devDependencies": {
1516
"@clickhouse/client": "^1.11.2",

0 commit comments

Comments
 (0)