Skip to content

Commit d17c6e3

Browse files
modernize code
1 parent 2606e50 commit d17c6e3

36 files changed

+222
-266
lines changed

.github/workflows/ci.yml

+10-10
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,11 +12,11 @@ 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

@@ -30,16 +30,16 @@ jobs:
3030
uses: actions/checkout@master
3131

3232
- name: Build tests container
33-
run: docker-compose build tests
34-
33+
run: docker compose build tests
34+
3535
- name: Run tests
36-
run: docker-compose run tests
36+
run: docker compose run tests
3737

3838
- name: Run tests without typechecking
3939
id: no_typecheck
4040
uses: mathiasvr/[email protected]
4141
with:
42-
run: docker-compose run no_check_tests
42+
run: docker compose run no_check_tests
4343
continue-on-error: true
4444

4545
- name: Report no typechecking tests status
@@ -51,7 +51,7 @@ jobs:
5151
no_typecheck_status: ${{ steps.no_typecheck_status.outputs.status }}
5252

5353
report_warnings:
54-
needs: [ code_quality, test ]
54+
needs: [code_quality, test]
5555
runs-on: ubuntu-latest
5656
steps:
5757
- name: Set no-typecheck fail comment
@@ -70,4 +70,4 @@ jobs:
7070
<pre><code>
7171
${{ needs.test.outputs.no_typecheck }}
7272
</code></pre>
73-
</details>
73+
</details>

.github/workflows/publish_jsr.yml

+8-9
Original file line numberDiff line numberDiff line change
@@ -22,27 +22,26 @@ 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

3837
- name: Documentation tests
3938
run: deno test --doc client.ts mod.ts pool.ts client/ connection/ query/ utils/
4039

4140
- name: Build tests container
42-
run: docker-compose build tests
43-
41+
run: docker compose build tests
42+
4443
- name: Run tests
45-
run: docker-compose run tests
44+
run: docker compose run tests
4645

4746
- name: Publish (dry run)
4847
if: startsWith(github.ref, 'refs/tags/') == false

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.1.4
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 . .

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# deno-postgres
22

3-
![Build Status](https://img.shields.io/github/workflow/status/denodrivers/postgres/ci?label=Build&logo=github&style=flat-square)
3+
![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)
55
[![Manual](https://img.shields.io/github/v/release/denodrivers/postgres?color=orange&label=Manual&logo=deno&style=flat-square)](https://deno-postgres.com)
66
[![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)
@@ -86,8 +86,8 @@ result assertions.
8686

8787
To run the tests, run the following commands:
8888

89-
1. `docker-compose build tests`
90-
2. `docker-compose run tests`
89+
1. `docker compose build tests`
90+
2. `docker compose run tests`
9191

9292
The build step will check linting and formatting as well and report it to the
9393
command line

client/error.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { type Notice } from "../connection/message.ts";
1+
import type { Notice } from "../connection/message.ts";
22

33
/**
44
* A connection error
@@ -20,7 +20,7 @@ export class ConnectionParamsError extends Error {
2020
/**
2121
* Create a new ConnectionParamsError
2222
*/
23-
constructor(message: string, cause?: Error) {
23+
constructor(message: string, cause?: unknown) {
2424
super(message, { cause });
2525
this.name = "ConnectionParamsError";
2626
}

connection/auth.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
import { crypto, hex } from "../deps.ts";
1+
import { crypto } from "@std/crypto/crypto";
2+
import { encodeHex } from "@std/encoding/hex";
23

34
const encoder = new TextEncoder();
45

56
async function md5(bytes: Uint8Array): Promise<string> {
6-
return hex.encodeHex(await crypto.subtle.digest("MD5", bytes));
7+
return encodeHex(await crypto.subtle.digest("MD5", bytes));
78
}
89

910
// AuthenticationMD5Password

0 commit comments

Comments
 (0)