Skip to content

Commit

Permalink
Merge branch 'main' into type-safe-seed-template
Browse files Browse the repository at this point in the history
  • Loading branch information
igalklebanov authored Jun 28, 2024
2 parents 798cc9f + 7d40e6a commit a79fb96
Show file tree
Hide file tree
Showing 18 changed files with 1,190 additions and 226 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,32 @@ on:
branches: [main]

jobs:
unit:
runs-on: ubuntu-latest

name: Unit Tests

steps:
- uses: actions/checkout@v4

- name: Install pnpm
uses: pnpm/action-setup@v4

- name: Use Node.js 22
uses: actions/setup-node@v4
with:
node-version: 22
cache: "pnpm"

- name: Install dependencies
run: pnpm i

- name: Build
run: pnpm build

- name: Test
run: pnpm test

node:
strategy:
matrix:
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -133,4 +133,6 @@ migrations
!examples/**/migrations
seeds
!src/seeds
examples/**/example.db
examples/**/example.db

tsconfig.vitest-temp.json
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ folder. Run `kysely init` in your terminal to create one.
import { defineConfig } from "kysely-ctl";

export default defineConfig({
dialect, // a Kysely dialect instance OR the name of an underlying driver library (e.g. `'pg'`).
dialect, // a `Kysely` dialect instance OR the name of an underlying driver library (e.g. `'pg'`).
dialectConfig, // optional. when `dialect` is the name of an underlying driver library, `dialectConfig` is the options passed to the Kysely dialect that matches that library.
migrations: { // optional.
getMigrationPrefix, // optional. a function that returns a migration prefix. affects `migrate make` command. default is `() => ${Date.now()}_`.
Expand All @@ -108,6 +108,19 @@ export default defineConfig({
});
```

Alternatively, you can pass a `Kysely` instance, instead of `dialect`, `dialectConfig` & `plugins`:

```ts
import { defineConfig } from "kysely-ctl";
import { kysely } from 'path/to/kysely/instance';

export default defineConfig({
// ...
kysely,
// ...
});
```

To use Knex's timestamp prefixes:

```ts
Expand Down
4 changes: 2 additions & 2 deletions biome.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
"files": {
"include": ["src"],
"ignore": ["src/templates/seed-type-safe-template.ts"]
"include": ["src", "tests"],
"ignore": ["src/templates/seed-type-safe-template.ts"]
},
"javascript": {
"formatter": {
Expand Down
12 changes: 7 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@
"build": "tsup",
"check:dts": "attw --pack .",
"prepublishOnly": "biome check && pnpm build && pnpm check:dts",
"start": "pnpm build --watch"
"start": "pnpm build --watch",
"test": "vitest"
},
"dependencies": {
"c12": "^1.8.0",
Expand All @@ -57,17 +58,18 @@
},
"devDependencies": {
"@arethetypeswrong/cli": "^0.15.3",
"@biomejs/biome": "1.8.2",
"@biomejs/biome": "1.8.3",
"@tsconfig/node20": "^20.1.4",
"@types/better-sqlite3": "^7.6.10",
"@types/node": "^20.14.8",
"better-sqlite3": "^11.0.0",
"@types/node": "^20.14.9",
"better-sqlite3": "^11.1.1",
"kysely": "^0.27.3",
"kysely-postgres-js": "^2.0.0",
"postgres": "^3.4.4",
"tsup": "^8.1.0",
"type-fest": "^4.20.1",
"typescript": "^5.5.2"
"typescript": "^5.5.2",
"vitest": "^1.6.0"
},
"engines": {
"node": ">=18"
Expand Down
Loading

0 comments on commit a79fb96

Please sign in to comment.