mikedmcfarland / slonik-tools

Various utilities for slonik

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

slonik-tools

Build Status Coverage Status

Various utilities for slonik

Packages

  1. @slonik/migrator - A cli migration tool for postgres sql scripts, using slonik.
  2. @slonik/typegen - A library that uses slonik to generate typescript interfaces based on your sql queries.
  3. slonik-tools-demo - A demo project which uses @slonik/typegen and @slonik/migrator, intended to show a working example for each package.

Development

Requirements:

  • node + yarn
  • docker + docker-compose

lerna is used to manage the packages.

To get started:

yarn
yarn dependencies

This starts a local postgres database that the tests will connect to (depends on docker-compose). After running that in its own window:

yarn ci

will build, migrate and test all packages.

While developing, it can be useful to run yarn build -w to compile continuously in the background and yarn test to just run tests. The tests use jest, so all the usual jest features can be used. For example, yarn test packages/migrator will run the tests only for the migrator package. yarn test $(npx lerna changed --parseable) runs tests for all changed packages.

Publishing

On master, and with write permissions to both master and npm (this isn't automated yet):

npx lerna version
npx lerna publish from-package

About

Various utilities for slonik

License:MIT License


Languages

Language:TypeScript 95.9%Language:JavaScript 2.1%Language:HTML 2.0%