Skip to content

Commit 16daebb

Browse files
committed
feat: release initial version
0 parents  commit 16daebb

File tree

14 files changed

+20570
-0
lines changed

14 files changed

+20570
-0
lines changed

.eslintrc

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"root": true,
3+
"overrides": [
4+
{
5+
"files": "*.ts",
6+
"extends": [
7+
"canonical",
8+
"canonical/node",
9+
"canonical/typescript"
10+
],
11+
"parserOptions": {
12+
"project": "./tsconfig.json"
13+
},
14+
"rules": {
15+
"no-console": 0
16+
}
17+
},
18+
{
19+
"files": "*.json",
20+
"extends": [
21+
"canonical/json"
22+
]
23+
}
24+
]
25+
}

.github/workflows/feature.yaml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
jobs:
2+
test:
3+
runs-on: ubuntu-latest
4+
environment: release
5+
name: Test
6+
steps:
7+
- name: setup repository
8+
uses: actions/checkout@v2
9+
with:
10+
fetch-depth: 0
11+
- name: setup node.js
12+
uses: actions/setup-node@v2
13+
with:
14+
node-version: "16"
15+
cache: "npm"
16+
- run: npm install
17+
- run: npm run lint
18+
- run: npm run build
19+
timeout-minutes: 10
20+
name: Test and build
21+
on:
22+
pull_request:
23+
branches:
24+
- main
25+
paths-ignore:
26+
- ".editorconfig"
27+
- ".husky/**"
28+
- ".lintstagedrc.js"
29+
- ".mergify.yml"
30+
- ".nvmrc"
31+
- "README.md"
32+
types:
33+
- opened
34+
- synchronize
35+
- reopened
36+
- ready_for_review

.github/workflows/main.yaml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
jobs:
2+
test:
3+
runs-on: ubuntu-latest
4+
environment: release
5+
name: Test
6+
steps:
7+
- name: setup repository
8+
uses: actions/checkout@v2
9+
with:
10+
fetch-depth: 0
11+
- name: setup node.js
12+
uses: actions/setup-node@v2
13+
with:
14+
node-version: "16"
15+
cache: "npm"
16+
- run: npm install
17+
- run: npm run lint
18+
- run: npm run build
19+
- run: npx semantic-release
20+
env:
21+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
22+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
23+
name: Test, build and release
24+
on:
25+
push:
26+
branches:
27+
- main

.gitignore

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
dist
2+
node_modules
3+
*.log
4+
.*
5+
!.babelrc
6+
!.editorconfig
7+
!.eslintignore
8+
!.eslintrc
9+
!.eslintrc.js
10+
!.github
11+
!.gitignore
12+
!.npmignore
13+
!.releaserc

.npmignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
test
2+
coverage
3+
.*
4+
*.log

.releaserc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"branches": [
3+
"main"
4+
],
5+
"plugins": [
6+
"@semantic-release/commit-analyzer",
7+
"@semantic-release/github",
8+
"@semantic-release/npm"
9+
]
10+
}

LICENSE

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
Copyright (c) 2022, Gajus Kuizinas (http://gajus.com/)
2+
All rights reserved.
3+
4+
Redistribution and use in source and binary forms, with or without
5+
modification, are permitted provided that the following conditions are met:
6+
* Redistributions of source code must retain the above copyright
7+
notice, this list of conditions and the following disclaimer.
8+
* Redistributions in binary form must reproduce the above copyright
9+
notice, this list of conditions and the following disclaimer in the
10+
documentation and/or other materials provided with the distribution.
11+
* Neither the name of the Gajus Kuizinas (http://gajus.com/) nor the
12+
names of its contributors may be used to endorse or promote products
13+
derived from this software without specific prior written permission.
14+
15+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18+
DISCLAIMED. IN NO EVENT SHALL GAJUS KUIZINAS BE LIABLE FOR ANY
19+
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22+
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

README.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# `postgres`/`pg` compatibility layer
2+
3+
[![Canonical Code Style](https://img.shields.io/badge/code%20style-canonical-blue.svg?style=flat-square)](https://github.com/gajus/canonical)
4+
[![Twitter Follow](https://img.shields.io/twitter/follow/kuizinas.svg?style=social&label=Follow)](https://twitter.com/kuizinas)
5+
6+
Wraps [`postgres`](https://www.npmjs.com/package/postgres) API in a [`pg`](https://www.npmjs.com/package/pg) compatible API.
7+
8+
## Usage
9+
10+
```ts
11+
import postgres from 'postgres';
12+
import { bridge } from 'postgres-bridge';
13+
14+
// pg.Pool Configuration
15+
const configuration = {
16+
host: 'localhost',
17+
user: 'database-user',
18+
max: 20,
19+
idleTimeoutMillis: 30000,
20+
connectionTimeoutMillis: 2000,
21+
};
22+
23+
const pool = bridge(postgres, configuration);
24+
25+
const connection = await pool.connect();
26+
27+
await pg.query('SELECT $1::text as name', ['foo']);
28+
```
29+
30+
## Scope
31+
32+
`postgres-bridge` is limited to the API that is consumed by [Slonik PostgreSQL client](https://www.npmjs.com/package/slonik), i.e. Using `postgres-bridge` you are able to use [`postgres`](https://www.npmjs.com/package/postgres) with Slonik.
33+
34+
Supported features:
35+
36+
* `pool.connect`
37+
* `connection.query`
38+
39+
Please submit PR if you require additional compatibility.
40+
41+
## Development
42+
43+
Running `postgres-bridge` tests requires having a local PostgreSQL instance.
44+
45+
The easiest way to setup a temporary instance for testing is using Docker, e.g.
46+
47+
```bash
48+
docker run --rm -it -e POSTGRES_HOST_AUTH_METHOD=trust -p 5432:5432 postgres
49+
```

0 commit comments

Comments
 (0)