Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split migrations into separte bundle #29

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ jobs:
strategy:
matrix:
node-version: [18.x, 20.x]
deno-version: [1.42.x]
fail-fast: false

steps:
Expand All @@ -31,12 +32,20 @@ jobs:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'

- name: Use Deno ${{ matrix.deno-version }}
uses: denoland/setup-deno@v1
with:
deno-version: ${{ matrix.deno-version }}

- name: Install dependencies
run: pnpm i

- name: Test
- name: Run tests
run: pnpm test

- name: Run deno tests
run: npm run test:deno

run-misc-checks:
runs-on: ubuntu-latest

Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ Pass the migration source to all migrate commands as follows:

```ts
import {join} from 'node:path'
import {KyselyFsMigrationSource, PGColdDialect} from 'kysely-knex'
import {PGColdDialect} from 'kysely-knex'
import {KyselyFsMigrationSource} from 'kysely-knex/migrations'
import {knex} from '../src/knex'
import {kysely} from '../src/kysely'

Expand All @@ -130,7 +131,8 @@ or pass it to Knex CLI globally:
`knexfile.ts`:

```ts
const {KyselyFsMigrationSource, PGColdDialect} = require('kysely-knex')
const {PGColdDialect} = require('kysely-knex')
const {KyselyFsMigrationSource} = require('kysely-knex/migrations')

module.exports = {
// ...
Expand Down
3 changes: 2 additions & 1 deletion knexfile.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const {KyselyFsMigrationSource, PGColdDialect} = require('./dist/cjs')
const {PGColdDialect} = require('./dist')
const {KyselyFsMigrationSource} = require('./dist/migrations')

module.exports = {
client: 'pg',
Expand Down
15 changes: 11 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,16 @@
"homepage": "https://github.com/kysely-org/kysely-knex",
"author": "Igal Klebanov <[email protected]>",
"license": "MIT",
"main": "./dist/cjs/index.js",
"module": "./dist/esm/index.js",
"main": "./dist/index.js",
"module": "./dist/index.mjs",
"exports": {
".": {
"import": "./dist/esm/index.js",
"require": "./dist/cjs/index.js"
"import": "./dist/index.mjs",
"require": "./dist/index.js"
},
"./migrations": {
"import": "./dist/migrations.mjs",
"require": "./dist/migrations.js"
}
},
"files": [
Expand Down Expand Up @@ -39,13 +43,16 @@
"test": "pnpm build && pnpm test:nodejs && pnpm test:migrations",
"test:migrations": "knex --knexfile ./knexfile.ts migrate:latest && knex --knexfile ./knexfile.ts migrate:rollback",
"test:nodejs": "mocha ./tests/nodejs",
"test:deno": "deno run --allow-env --allow-read tests/deno/index.test.ts && deno run tests/deno/fs-migration-source.test.ts",
"test:types": "attw --pack .",
"type-check": "tsc --noEmit"
},
"peerDependencies": {
"knex": ">= 3.0.0 < 4",
"kysely": ">= 0.24.0 < 1"
},
"devDependencies": {
"@arethetypeswrong/cli": "^0.15.3",
"@tsconfig/node20": "^20.1.3",
"@types/chai": "^4.3.14",
"@types/lodash": "^4.17.0",
Expand Down
Loading