Skip to content

Commit b22f743

Browse files
move to jsr for dependencies and modernize some things (#487)
* modernize code * remove error type assertions * bump dependency versions * fix every test except the last one * format code * fix tests * update docs to point to jsr, fix docs tests * format * actually fix github action * make the test table if it doesn't exist, should fix gh action * update documentation
1 parent 15e40d0 commit b22f743

39 files changed

+511
-450
lines changed

.github/workflows/ci.yml

+16-41
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: ci
22

3-
on: [ push, pull_request, release ]
3+
on: [push, pull_request, release]
44

55
jobs:
66
code_quality:
@@ -12,62 +12,37 @@ jobs:
1212
- name: Setup Deno
1313
uses: denoland/setup-deno@v1
1414
with:
15-
deno-version: v1.x
16-
15+
deno-version: v2.x
16+
1717
- name: Format
1818
run: deno fmt --check
19-
19+
2020
- name: Lint
2121
run: deno lint
2222

23-
- name: Documentation tests
24-
run: deno test --doc client.ts mod.ts pool.ts client/ connection/ query/ utils/
25-
26-
test:
23+
test_docs:
2724
runs-on: ubuntu-latest
2825
steps:
2926
- name: Clone repo
3027
uses: actions/checkout@master
3128

3229
- name: Build tests container
3330
run: docker compose build tests
34-
35-
- name: Run tests
36-
run: docker compose run tests
37-
38-
- name: Run tests without typechecking
39-
id: no_typecheck
40-
uses: mathiasvr/[email protected]
41-
with:
42-
run: docker compose run no_check_tests
43-
continue-on-error: true
4431

45-
- name: Report no typechecking tests status
46-
id: no_typecheck_status
47-
if: steps.no_typecheck.outcome == 'success'
48-
run: echo "name=status::success" >> $GITHUB_OUTPUT
49-
outputs:
50-
no_typecheck: ${{ steps.no_typecheck.outputs.stdout }}
51-
no_typecheck_status: ${{ steps.no_typecheck_status.outputs.status }}
32+
- name: Run doc tests
33+
run: docker compose run doc_tests
5234

53-
report_warnings:
54-
needs: [ code_quality, test ]
35+
test:
5536
runs-on: ubuntu-latest
5637
steps:
57-
- name: Set no-typecheck fail comment
58-
if: ${{ needs.test.outputs.no_typecheck_status != 'success' && github.event_name == 'push' }}
59-
uses: peter-evans/commit-comment@v3
60-
with:
61-
body: |
62-
# No typecheck tests failure
38+
- name: Clone repo
39+
uses: actions/checkout@master
6340

64-
This error was most likely caused by incorrect type stripping from the SWC crate
41+
- name: Build tests container
42+
run: docker compose build tests
6543

66-
Please report the following failure to https://github.com/denoland/deno with a reproduction of the current commit
44+
- name: Run tests
45+
run: docker compose run tests
6746

68-
<details>
69-
<summary>Failure log</summary>
70-
<pre><code>
71-
${{ needs.test.outputs.no_typecheck }}
72-
</code></pre>
73-
</details>
47+
- name: Run tests without typechecking
48+
run: docker compose run no_check_tests

.github/workflows/publish_jsr.yml

+6-7
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,15 @@ jobs:
2222

2323
- name: Set up Deno
2424
uses: denoland/setup-deno@v1
25-
25+
with:
26+
deno-version: v2.x
27+
2628
- name: Check Format
2729
run: deno fmt --check
2830

29-
- name: Convert to JSR package
30-
run: deno run -A tools/convert_to_jsr.ts
31-
32-
- name: Format converted code
31+
- name: Format
3332
run: deno fmt
34-
33+
3534
- name: Lint
3635
run: deno lint
3736

@@ -40,7 +39,7 @@ jobs:
4039

4140
- name: Build tests container
4241
run: docker compose build tests
43-
42+
4443
- name: Run tests
4544
run: docker compose run tests
4645

Dockerfile

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM denoland/deno:alpine-1.40.3
1+
FROM denoland/deno:alpine-2.2.11
22
WORKDIR /app
33

44
# Install wait utility
@@ -11,7 +11,6 @@ USER deno
1111
# Cache external libraries
1212
# Test deps caches all main dependencies as well
1313
COPY tests/test_deps.ts tests/test_deps.ts
14-
COPY deps.ts deps.ts
1514
RUN deno cache tests/test_deps.ts
1615

1716
ADD . .

LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2018-2022 Bartłomiej Iwańczuk and Steven Guerrero
3+
Copyright (c) 2018-2025 Bartłomiej Iwańczuk, Steven Guerrero, and Hector Ayala
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

+47-45
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,22 @@
22

33
![Build Status](https://img.shields.io/github/actions/workflow/status/denodrivers/postgres/ci.yml?branch=main&label=Build&logo=github&style=flat-square)
44
[![Discord server](https://img.shields.io/discord/768918486575480863?color=blue&label=Ask%20for%20help%20here&logo=discord&style=flat-square)](https://discord.gg/HEdTCvZUSf)
5+
[![JSR](https://jsr.io/badges/@db/postgres?style=flat-square)](https://jsr.io/@db/postgres)
6+
[![JSR Score](https://jsr.io/badges/@db/postgres/score?style=flat-square)](https://jsr.io/@db/postgres)
57
[![Manual](https://img.shields.io/github/v/release/denodrivers/postgres?color=orange&label=Manual&logo=deno&style=flat-square)](https://deno-postgres.com)
6-
[![Documentation](https://img.shields.io/github/v/release/denodrivers/postgres?color=yellow&label=Documentation&logo=deno&style=flat-square)](https://doc.deno.land/https/deno.land/x/postgres/mod.ts)
8+
[![Documentation](https://img.shields.io/github/v/release/denodrivers/postgres?color=yellow&label=Documentation&logo=deno&style=flat-square)](https://jsr.io/@db/postgres/doc)
79
[![License](https://img.shields.io/github/license/denodrivers/postgres?color=yellowgreen&label=License&style=flat-square)](LICENSE)
810

911
A lightweight PostgreSQL driver for Deno focused on developer experience.
1012

11-
`deno-postgres` is being developed inspired by the excellent work of
13+
`deno-postgres` is inspired by the excellent work of
1214
[node-postgres](https://github.com/brianc/node-postgres) and
1315
[pq](https://github.com/lib/pq).
1416

1517
## Documentation
1618

17-
The documentation is available on the `deno-postgres` website
18-
[https://deno-postgres.com/](https://deno-postgres.com/)
19+
The documentation is available on the
20+
[`deno-postgres` website](https://deno-postgres.com/).
1921

2022
Join the [Discord](https://discord.gg/HEdTCvZUSf) as well! It's a good place to
2123
discuss bugs and features before opening issues.
@@ -24,14 +26,15 @@ discuss bugs and features before opening issues.
2426

2527
```ts
2628
// deno run --allow-net --allow-read mod.ts
27-
import { Client } from "https://deno.land/x/postgres/mod.ts";
29+
import { Client } from "jsr:@db/postgres";
2830

2931
const client = new Client({
3032
user: "user",
3133
database: "test",
3234
hostname: "localhost",
3335
port: 5432,
3436
});
37+
3538
await client.connect();
3639

3740
{
@@ -59,6 +62,40 @@ await client.connect();
5962
await client.end();
6063
```
6164

65+
## Deno compatibility
66+
67+
Due to breaking changes introduced in the unstable APIs `deno-postgres` uses,
68+
there has been some fragmentation regarding what versions of Deno can be used
69+
alongside the driver.
70+
71+
This situation will stabilize as `deno-postgres` approach version 1.0.
72+
73+
| Deno version | Min driver version | Max version | Note |
74+
| ------------- | ------------------ | ------------------- | ------------------------------------------------------------------------------ |
75+
| 1.8.x | 0.5.0 | 0.10.0 | |
76+
| 1.9.0 | 0.11.0 | 0.11.1 | |
77+
| 1.9.1 and up | 0.11.2 | 0.11.3 | |
78+
| 1.11.0 and up | 0.12.0 | 0.12.0 | |
79+
| 1.14.0 and up | 0.13.0 | 0.13.0 | |
80+
| 1.16.0 | 0.14.0 | 0.14.3 | |
81+
| 1.17.0 | 0.15.0 | 0.17.1 | |
82+
| 1.40.0 | 0.17.2 | currently supported | 0.17.2 [on JSR](https://jsr.io/@bartlomieju/postgres) |
83+
| 2.0.0 and up | 0.19.4 | currently supported | All versions available as [`@db/postgres` on JSR](https://jsr.io/@db/postgres) |
84+
85+
## Breaking changes
86+
87+
Although `deno-postgres` is reasonably stable and robust, it is a WIP, and we're
88+
still exploring the design. Expect some breaking changes as we reach version 1.0
89+
and enhance the feature set. Please check the Releases for more info on breaking
90+
changes. Please reach out if there are any undocumented breaking changes.
91+
92+
## Found issues?
93+
94+
Please
95+
[file an issue](https://github.com/denodrivers/postgres/issues/new/choose) with
96+
any problems with the driver. If you would like to help, please look at the
97+
issues as well. You can pick up one of them and try to implement it.
98+
6299
## Contributing
63100

64101
### Prerequisites
@@ -73,8 +110,8 @@ await client.end();
73110
it to run the linter and formatter locally
74111

75112
- https://deno.land/
76-
- `deno upgrade --version 1.40.0`
77-
- `dvm install 1.40.0 && dvm use 1.40.0`
113+
- `deno upgrade stable`
114+
- `dvm install stable && dvm use stable`
78115

79116
- You don't need to install Postgres locally on your machine to test the
80117
library; it will run as a service in the Docker container when you build it
@@ -96,8 +133,8 @@ It is recommended that you don't rely on any previously initialized data for
96133
your tests instead create all the data you need at the moment of running the
97134
tests
98135

99-
For example, the following test will create a temporal table that will disappear
100-
once the test has been completed
136+
For example, the following test will create a temporary table that will
137+
disappear once the test has been completed
101138

102139
```ts
103140
Deno.test("INSERT works correctly", async () => {
@@ -134,41 +171,6 @@ a local testing environment, as shown in the following steps:
134171
3. Run the tests manually by using the command\
135172
`deno test -A`
136173

137-
## Deno compatibility
138-
139-
Due to breaking changes introduced in the unstable APIs `deno-postgres` uses,
140-
there has been some fragmentation regarding what versions of Deno can be used
141-
alongside the driver.
142-
143-
This situation will stabilize as `std` and `deno-postgres` approach version 1.0.
144-
145-
| Deno version | Min driver version | Max driver version | Note |
146-
| ------------- | ------------------ | ------------------ | -------------------- |
147-
| 1.8.x | 0.5.0 | 0.10.0 | |
148-
| 1.9.0 | 0.11.0 | 0.11.1 | |
149-
| 1.9.1 and up | 0.11.2 | 0.11.3 | |
150-
| 1.11.0 and up | 0.12.0 | 0.12.0 | |
151-
| 1.14.0 and up | 0.13.0 | 0.13.0 | |
152-
| 1.16.0 | 0.14.0 | 0.14.3 | |
153-
| 1.17.0 | 0.15.0 | 0.17.1 | |
154-
| 1.40.0 | 0.17.2 | | Now available on JSR |
155-
156-
## Breaking changes
157-
158-
Although `deno-postgres` is reasonably stable and robust, it is a WIP, and we're
159-
still exploring the design. Expect some breaking changes as we reach version 1.0
160-
and enhance the feature set. Please check the Releases for more info on breaking
161-
changes. Please reach out if there are any undocumented breaking changes.
162-
163-
## Found issues?
164-
165-
Please
166-
[file an issue](https://github.com/denodrivers/postgres/issues/new/choose) with
167-
any problems with the driver in this repository's issue section. If you would
168-
like to help, please look at the
169-
[issues](https://github.com/denodrivers/postgres/issues) as well. You can pick
170-
up one of them and try to implement it.
171-
172174
## Contributing guidelines
173175

174176
When contributing to the repository, make sure to:
@@ -194,5 +196,5 @@ preserved their individual licenses and copyrights.
194196

195197
Everything is licensed under the MIT License.
196198

197-
All additional work is copyright 2018 - 2024 — Bartłomiej Iwańczuk, Steven
199+
All additional work is copyright 2018 - 2025 — Bartłomiej Iwańczuk, Steven
198200
Guerrero, Hector Ayala — All rights reserved.

0 commit comments

Comments
 (0)