Skip to content
This repository has been archived by the owner on Mar 26, 2024. It is now read-only.

alias for pg.js to force Knex to use pure-JS PostgreSQL bindings

License

Notifications You must be signed in to change notification settings

WhoopInc/node-pg-pure-alias

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

node-pg-pure-alias

Notice

This repository is no longer maintained as of 3/26/2024.

A pg alias for pg.js.

Why?

The fantastic pg package bundles both native and pure JavaScript bindings for PostgreSQL. This means you have to compile the native bindings, whether you want them or not.

To compensate, pg.js bundles only the JavaScript bindings. This is great until you use a library like Knex, which is hard-coded to import a library called pg.

So this package aliases pg to pg.js to trick Knex into importing the right package.

Usage

node-pg exports whatever version of pg.js you depend on in your package.json.

If you forget to depend on pg.js yourself, node-pg will blow up when you try to require it.

package.json

{
  "dependencies": {
    "pg": "git+https://github.com/WhoopInc/node-pg-pure-alias.git#1.0.0",
    "pg.js": "x.x.x",
    "..."
  }
}

*.js

var pg = require("pg");
// `pg` is now vx.x.x of the pg.js package. No native bindings! Shh!

It's not in NPM!

We're shadowing the official NPM 'pg' package!

If you're concerned about depending on this GitHub repository, fork this repository and host the package under your own namespace.

About

alias for pg.js to force Knex to use pure-JS PostgreSQL bindings

Resources

License

Stars

Watchers

Forks

Packages

No packages published