Cleanup things a bit

This commit is contained in:
Brian M. Carlson 2019-12-27 17:52:28 +00:00
parent 4c27ad294f
commit 637bcf355c
15 changed files with 78 additions and 5492 deletions

View File

@ -12,11 +12,10 @@ Non-blocking PostgreSQL client for Node.js. Pure JavaScript and optional native
This repo is a monorepo which contains the core [pg](https://github.com/brianc/node-postgres/tree/master/packages/pg) module as well as a handful of related modules.
- [pg](https://github.com/brianc/node-postgres/tree/master/packages/pg)
- [pg-pool](https://github.com/brianc/node-postgres/tree/master/packages/pg-pool)
- [pg-cursor](https://github.com/brianc/node-postgres/tree/master/packages/pg-cursor)
- [pg-query-stream](https://github.com/brianc/node-postgres/tree/master/packages/pg-query-stream)
_(more to come, I'm in the process of migrating repos over here)_
## Documenation

View File

@ -15,5 +15,6 @@
},
"devDependencies": {
"lerna": "^3.19.0"
}
},
"dependencies": {}
}

View File

@ -1 +0,0 @@
node_modules

View File

@ -1,15 +0,0 @@
.PHONY: test
test:
npm test
.PHONY: patch
patch: test
npm version patch -m "Bump version"
git push origin master --tags
npm publish
.PHONY: minor
minor: test
npm version minor -m "Bump version"
git push origin master --tags
npm publish

View File

@ -1,2 +0,0 @@
node_modules
npm-debug.log

View File

@ -1,13 +0,0 @@
language: node_js
matrix:
include:
- node_js: "6"
addons:
postgresql: "9.4"
- node_js: "8"
addons:
postgresql: "9.6"
- node_js: "10"
addons:
postgresql: "9.6"

View File

@ -1,14 +0,0 @@
.PHONY: jshint test publish-patch test
test:
npm test
patch: test
npm version patch -m "Bump version"
git push origin master --tags
npm publish
minor: test
npm version minor -m "Bump version"
git push origin master --tags
npm publish

File diff suppressed because it is too large Load Diff

View File

@ -7,7 +7,7 @@
"test": "test"
},
"scripts": {
"test": " node_modules/.bin/mocha && node_modules/.bin/standard"
"test": " node_modules/.bin/mocha"
},
"repository": {
"type": "git",
@ -31,10 +31,7 @@
"expect.js": "0.3.1",
"lodash": "^4.17.11",
"mocha": "^5.2.0",
"pg": "*",
"pg-cursor": "^1.3.0",
"standard": "7.1.2",
"standard-format": "^2.2.4"
"pg-cursor": "^1.3.0"
},
"dependencies": {},
"peerDependencies": {

View File

@ -31,7 +31,7 @@ describe('connection timeout', () => {
})
it('should callback with an error if timeout is passed', (done) => {
const pool = new Pool({ connectionTimeoutMillis: 10, port: this.port })
const pool = new Pool({ connectionTimeoutMillis: 10, port: this.port, host: 'localhost' })
pool.connect((err, client, release) => {
expect(err).to.be.an(Error)
expect(err.message).to.contain('timeout')
@ -42,7 +42,7 @@ describe('connection timeout', () => {
})
it('should reject promise with an error if timeout is passed', (done) => {
const pool = new Pool({ connectionTimeoutMillis: 10, port: this.port })
const pool = new Pool({ connectionTimeoutMillis: 10, port: this.port, host: 'localhost' })
pool.connect().catch(err => {
expect(err).to.be.an(Error)
expect(err.message).to.contain('timeout')
@ -51,9 +51,9 @@ describe('connection timeout', () => {
})
})
it('should handle multiple timeouts', co.wrap(function * () {
it('should handle multiple timeouts', co.wrap(function* () {
const errors = []
const pool = new Pool({ connectionTimeoutMillis: 1, port: this.port })
const pool = new Pool({ connectionTimeoutMillis: 1, port: this.port, host: 'localhost' })
for (var i = 0; i < 15; i++) {
try {
yield pool.connect()

View File

@ -13,7 +13,7 @@ describe('pool error handling', function () {
const pool = new Pool()
let errors = 0
let shouldGet = 0
function runErrorQuery () {
function runErrorQuery() {
shouldGet++
return new Promise(function (resolve, reject) {
pool.query("SELECT 'asd'+1 ").then(function (res) {
@ -35,7 +35,7 @@ describe('pool error handling', function () {
})
describe('calling release more than once', () => {
it('should throw each time', co.wrap(function * () {
it('should throw each time', co.wrap(function* () {
const pool = new Pool()
const client = yield pool.connect()
client.release()
@ -60,7 +60,7 @@ describe('pool error handling', function () {
})
describe('calling connect after end', () => {
it('should return an error', function * () {
it('should return an error', function* () {
const pool = new Pool()
const res = yield pool.query('SELECT $1::text as name', ['hi'])
expect(res.rows[0].name).to.equal('hi')
@ -106,7 +106,7 @@ describe('pool error handling', function () {
})
describe('error from idle client', () => {
it('removes client from pool', co.wrap(function * () {
it('removes client from pool', co.wrap(function* () {
const pool = new Pool()
const client = yield pool.connect()
expect(pool.totalCount).to.equal(1)
@ -138,7 +138,7 @@ describe('pool error handling', function () {
})
describe('error from in-use client', () => {
it('keeps the client in the pool', co.wrap(function * () {
it('keeps the client in the pool', co.wrap(function* () {
const pool = new Pool()
const client = yield pool.connect()
expect(pool.totalCount).to.equal(1)
@ -182,7 +182,7 @@ describe('pool error handling', function () {
})
describe('pool with lots of errors', () => {
it('continues to work and provide new clients', co.wrap(function * () {
it('continues to work and provide new clients', co.wrap(function* () {
const pool = new Pool({ max: 1 })
const errors = []
for (var i = 0; i < 20; i++) {
@ -208,7 +208,7 @@ describe('pool error handling', function () {
}).unref()
closeServer.listen(() => {
const pool = new Pool({ max: 1, port: closeServer.address().port })
const pool = new Pool({ max: 1, port: closeServer.address().port, host: 'localhost' })
pool.connect((err) => {
expect(err).to.be.an(Error)
if (err.errno) {

File diff suppressed because it is too large Load Diff

View File

@ -1 +0,0 @@
node_modules

File diff suppressed because it is too large Load Diff

View File

@ -1189,6 +1189,11 @@ before-after-hook@^2.0.0:
resolved "https://registry.yarnpkg.com/before-after-hook/-/before-after-hook-2.1.0.tgz#b6c03487f44e24200dd30ca5e6a1979c5d2fb635"
integrity sha512-IWIbu7pMqyw3EAJHzzHbWa85b6oud/yfKYg5rqB5hNE8CeMi3nX+2C2sj0HswfblST86hpVEOAb9x34NZd6P7A==
bluebird@3.4.1:
version "3.4.1"
resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.4.1.tgz#b731ddf48e2dd3bedac2e75e1215a11bcb91fa07"
integrity sha1-tzHd9I4t077awudeEhWhG8uR+gc=
bluebird@3.5.2:
version "3.5.2"
resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.5.2.tgz#1be0908e054a751754549c270489c1505d4ab15a"
@ -1511,6 +1516,11 @@ combined-stream@^1.0.6, combined-stream@~1.0.6:
dependencies:
delayed-stream "~1.0.0"
commander@2.15.1:
version "2.15.1"
resolved "https://registry.yarnpkg.com/commander/-/commander-2.15.1.tgz#df46e867d0fc2aec66a34662b406a9ccafff5b0f"
integrity sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag==
commander@~2.20.3:
version "2.20.3"
resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33"
@ -2246,6 +2256,11 @@ expand-brackets@^2.1.4:
snapdragon "^0.8.1"
to-regex "^3.0.1"
expect.js@0.3.1:
version "0.3.1"
resolved "https://registry.yarnpkg.com/expect.js/-/expect.js-0.3.1.tgz#b0a59a0d2eff5437544ebf0ceaa6015841d09b5b"
integrity sha1-sKWaDS7/VDdUTr8M6qYBWEHQm1s=
extend-shallow@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/extend-shallow/-/extend-shallow-2.0.1.tgz#51af7d614ad9a9f610ea1bafbb989d6b1c56890f"
@ -2645,6 +2660,18 @@ glob-to-regexp@^0.3.0:
resolved "https://registry.yarnpkg.com/glob-to-regexp/-/glob-to-regexp-0.3.0.tgz#8c5a1494d2066c570cc3bfe4496175acc4d502ab"
integrity sha1-jFoUlNIGbFcMw7/kSWF1rMTVAqs=
glob@7.1.2:
version "7.1.2"
resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.2.tgz#c19c9df9a028702d678612384a6552404c636d15"
integrity sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==
dependencies:
fs.realpath "^1.0.0"
inflight "^1.0.4"
inherits "2"
minimatch "^3.0.4"
once "^1.3.0"
path-is-absolute "^1.0.0"
glob@7.1.3:
version "7.1.3"
resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.3.tgz#3960832d3f1574108342dafd3a67b332c0969df1"
@ -2777,6 +2804,11 @@ has@^1.0.3:
dependencies:
function-bind "^1.1.1"
he@1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/he/-/he-1.1.1.tgz#93410fd21b009735151f8868c2f271f3427e23fd"
integrity sha1-k0EP0hsAlzUVH4howvJx80J+I/0=
he@1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/he/-/he-1.2.0.tgz#84ae65fa7eafb165fddb61566ae14baf05664f0f"
@ -3461,7 +3493,7 @@ lodash.uniq@^4.5.0:
resolved "https://registry.yarnpkg.com/lodash.uniq/-/lodash.uniq-4.5.0.tgz#d0225373aeb652adc1bc82e4945339a842754773"
integrity sha1-0CJTc662Uq3BvILklFM5qEJ1R3M=
lodash@^4.17.12, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.2.1:
lodash@^4.17.11, lodash@^4.17.12, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.2.1:
version "4.17.15"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548"
integrity sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==
@ -3732,6 +3764,23 @@ mkdirp@*, mkdirp@0.5.1, mkdirp@^0.5.0, mkdirp@^0.5.1:
dependencies:
minimist "0.0.8"
mocha@^5.2.0:
version "5.2.0"
resolved "https://registry.yarnpkg.com/mocha/-/mocha-5.2.0.tgz#6d8ae508f59167f940f2b5b3c4a612ae50c90ae6"
integrity sha512-2IUgKDhc3J7Uug+FxMXuqIyYzH7gJjXECKe/w43IGgQHTSj3InJi+yAA7T24L9bQMRKiUEHxEX37G5JpVUGLcQ==
dependencies:
browser-stdout "1.3.1"
commander "2.15.1"
debug "3.1.0"
diff "3.5.0"
escape-string-regexp "1.0.5"
glob "7.1.2"
growl "1.10.5"
he "1.1.1"
minimatch "3.0.4"
mkdirp "0.5.1"
supports-color "5.4.0"
mocha@^6.2.2:
version "6.2.2"
resolved "https://registry.yarnpkg.com/mocha/-/mocha-6.2.2.tgz#5d8987e28940caf8957a7d7664b910dc5b2fea20"
@ -4352,16 +4401,16 @@ pg-copy-streams@0.3.0:
resolved "https://registry.yarnpkg.com/pg-copy-streams/-/pg-copy-streams-0.3.0.tgz#a4fbc2a3b788d4e9da6f77ceb35422d8d7043b7f"
integrity sha1-pPvCo7eI1Onab3fOs1Qi2NcEO38=
pg-cursor@^1.3.0:
version "1.3.0"
resolved "https://registry.yarnpkg.com/pg-cursor/-/pg-cursor-1.3.0.tgz#b220f1908976b7b40daa373c7ada5fca823ab0d9"
integrity sha1-siDxkIl2t7QNqjc8etpfyoI6sNk=
pg-int8@1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/pg-int8/-/pg-int8-1.0.1.tgz#943bd463bf5b71b4170115f80f8efc9a0c0eb78c"
integrity sha512-WCtabS6t3c8SkpDBUlb1kjOs7l66xsGdKpIPZsg4wR+B3+u9UAum2odSsF9tnvxg80h4ZxLWMy4pRjOsFIqQpw==
pg-pool@^2.0.7:
version "2.0.7"
resolved "https://registry.yarnpkg.com/pg-pool/-/pg-pool-2.0.7.tgz#f14ecab83507941062c313df23f6adcd9fd0ce54"
integrity sha512-UiJyO5B9zZpu32GSlP0tXy8J2NsJ9EFGFfz5v6PSbdz/1hBLX1rNiiy5+mAm5iJJYwfCv4A0EBcQLGWwjbpzZw==
pg-types@^2.1.0:
version "2.2.0"
resolved "https://registry.yarnpkg.com/pg-types/-/pg-types-2.2.0.tgz#2d0250d636454f7cfa3b6ae0382fdfa8063254a3"
@ -5303,6 +5352,13 @@ strong-log-transformer@^2.0.0:
minimist "^1.2.0"
through "^2.3.4"
supports-color@5.4.0:
version "5.4.0"
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.4.0.tgz#1c6b337402c2137605efe19f10fec390f6faab54"
integrity sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w==
dependencies:
has-flag "^3.0.0"
supports-color@6.0.0:
version "6.0.0"
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-6.0.0.tgz#76cfe742cf1f41bb9b1c29ad03068c05b4c0e40a"