Skip to content

Commit

Permalink
build
Browse files Browse the repository at this point in the history
  • Loading branch information
porsager committed Oct 10, 2023
1 parent 31f9856 commit 63ec056
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 8 deletions.
4 changes: 2 additions & 2 deletions cf/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ function parseOptions(a, b) {
return a

const env = process.env // eslint-disable-line
, o = (typeof a === 'string' ? b : a) || {}
, o = (!a || typeof a === 'string' ? b : a) || {}
, { url, multihost } = parseUrl(a)
, query = [...url.searchParams].reduce((a, [b, c]) => (a[b] = c, a), {})
, host = o.hostname || o.host || multihost || url.hostname || env.PGHOST || 'localhost'
Expand Down Expand Up @@ -529,7 +529,7 @@ function parseTransform(x) {
}

function parseUrl(url) {
if (typeof url !== 'string')
if (!url || typeof url !== 'string')
return { url: { searchParams: new Map() } }

let host = url
Expand Down
4 changes: 2 additions & 2 deletions cjs/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ function parseOptions(a, b) {
return a

const env = process.env // eslint-disable-line
, o = (typeof a === 'string' ? b : a) || {}
, o = (!a || typeof a === 'string' ? b : a) || {}
, { url, multihost } = parseUrl(a)
, query = [...url.searchParams].reduce((a, [b, c]) => (a[b] = c, a), {})
, host = o.hostname || o.host || multihost || url.hostname || env.PGHOST || 'localhost'
Expand Down Expand Up @@ -528,7 +528,7 @@ function parseTransform(x) {
}

function parseUrl(url) {
if (typeof url !== 'string')
if (!url || typeof url !== 'string')
return { url: { searchParams: new Map() } }

let host = url
Expand Down
6 changes: 5 additions & 1 deletion cjs/tests/bootstrap.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
const { spawnSync } = require('child_process')

exec('dropdb', ['postgres_js_test'])

exec('psql', ['-c', 'alter system set ssl=on'])
exec('psql', ['-c', 'drop user postgres_js_test'])
exec('psql', ['-c', 'create user postgres_js_test'])
exec('psql', ['-c', 'alter system set password_encryption=md5'])
exec('psql', ['-c', 'select pg_reload_conf()'])
exec('psql', ['-c', 'drop user if exists postgres_js_test_md5'])
exec('psql', ['-c', 'create user postgres_js_test_md5 with password \'postgres_js_test_md5\''])
exec('psql', ['-c', 'alter system set password_encryption=\'scram-sha-256\''])
exec('psql', ['-c', 'select pg_reload_conf()'])
exec('psql', ['-c', 'drop user if exists postgres_js_test_scram'])
exec('psql', ['-c', 'create user postgres_js_test_scram with password \'postgres_js_test_scram\''])

exec('dropdb', ['postgres_js_test'])
exec('createdb', ['postgres_js_test'])
exec('psql', ['-c', 'grant all on database postgres_js_test to postgres_js_test'])
exec('psql', ['-c', 'alter database postgres_js_test owner to postgres_js_test'])
Expand Down
4 changes: 2 additions & 2 deletions deno/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ function parseOptions(a, b) {
return a

const env = process.env // eslint-disable-line
, o = (typeof a === 'string' ? b : a) || {}
, o = (!a || typeof a === 'string' ? b : a) || {}
, { url, multihost } = parseUrl(a)
, query = [...url.searchParams].reduce((a, [b, c]) => (a[b] = c, a), {})
, host = o.hostname || o.host || multihost || url.hostname || env.PGHOST || 'localhost'
Expand Down Expand Up @@ -529,7 +529,7 @@ function parseTransform(x) {
}

function parseUrl(url) {
if (typeof url !== 'string')
if (!url || typeof url !== 'string')
return { url: { searchParams: new Map() } }

let host = url
Expand Down
6 changes: 5 additions & 1 deletion deno/tests/bootstrap.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
import { spawn } from 'https://deno.land/[email protected]/node/child_process.ts'

await exec('dropdb', ['postgres_js_test'])

await exec('psql', ['-c', 'alter system set ssl=on'])
await exec('psql', ['-c', 'drop user postgres_js_test'])
await exec('psql', ['-c', 'create user postgres_js_test'])
await exec('psql', ['-c', 'alter system set password_encryption=md5'])
await exec('psql', ['-c', 'select pg_reload_conf()'])
await exec('psql', ['-c', 'drop user if exists postgres_js_test_md5'])
await exec('psql', ['-c', 'create user postgres_js_test_md5 with password \'postgres_js_test_md5\''])
await exec('psql', ['-c', 'alter system set password_encryption=\'scram-sha-256\''])
await exec('psql', ['-c', 'select pg_reload_conf()'])
await exec('psql', ['-c', 'drop user if exists postgres_js_test_scram'])
await exec('psql', ['-c', 'create user postgres_js_test_scram with password \'postgres_js_test_scram\''])

await exec('dropdb', ['postgres_js_test'])
await exec('createdb', ['postgres_js_test'])
await exec('psql', ['-c', 'grant all on database postgres_js_test to postgres_js_test'])
await exec('psql', ['-c', 'alter database postgres_js_test owner to postgres_js_test'])
Expand Down

0 comments on commit 63ec056

Please sign in to comment.