Skip to content

Commit

Permalink
initial commit, pt. 2.
Browse files Browse the repository at this point in the history
  • Loading branch information
igalklebanov committed Jan 2, 2024
1 parent 0e973f0 commit 7d717fd
Show file tree
Hide file tree
Showing 12 changed files with 4,871 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
node_modules
dist
assets
.prettierrc.js
jest.config.js
package.json
pnpm-lock.yaml
README.md
tsconfig.json
tsup.config.ts
scripts
examples
tests
14 changes: 14 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"root": true,
"extends": ["prettier"],
"parser": "@typescript-eslint/parser",
"parserOptions": {"project": ["./tsconfig.json"]},
"plugins": ["prettier", "import", "@typescript-eslint"],
"rules": {
"prettier/prettier": ["error"],
"import/extensions": [2, "ignorePackages"]
},
"settings": {
"import/extensions": [".ts"]
}
}
97 changes: 97 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
name: Tests
on:
pull_request:
branches: [main]
push:
branches: [main]
jobs:
run-node-tests:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [16.x, 18.x, 20.x]
fail-fast: false

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Run docker compose
run: docker-compose up -d

- name: Install Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}

- name: Install pnpm
uses: pnpm/[email protected]
with:
version: 8
run_install: false

- name: Get pnpm store directory
id: pnpm-cache
run: |
echo "::set-output name=pnpm_cache_dir::$(pnpm store path)"
- name: Setup pnpm cache
uses: actions/cache@v3
with:
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm i

- name: Build
run: pnpm run build

- name: Test
run: pnpm run test:nodejs

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

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 16.x

- name: Install pnpm
uses: pnpm/[email protected]
with:
version: 8
run_install: false

- name: Get pnpm store directory
id: pnpm-cache
run: |
echo "::set-output name=pnpm_cache_dir::$(pnpm store path)"
- name: Setup pnpm cache
uses: actions/cache@v3
with:
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm i

- name: Build
run: pnpm run build

- name: Type Check
run: pnpm run type-check

- name: Lint
run: pnpm run lint
6 changes: 6 additions & 0 deletions .mocharc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"extension": ["ts"],
"recursive": true,
"require": ["esbuild-runner/register"],
"timeout": 30000
}
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
dist/
pnpm-lock.yaml
8 changes: 8 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module.exports = {
printWidth: 120,
semi: false,
singleQuote: true,
trailingComma: 'all',
bracketSpacing: false,
plugins: [require('prettier-plugin-organize-imports'), require('prettier-plugin-pkg')],
}
44 changes: 44 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
version: '3'
services:
# credit to Knex.js team for the following mssql setup here:
mssql:
image: mcr.microsoft.com/mssql/server:2022-latest
ports:
- '21433:1433'
environment:
ACCEPT_EULA: Y
MSSQL_PID: Express
SA_PASSWORD: KyselyTest0
healthcheck:
test: /opt/mssql-tools/bin/sqlcmd -S mssql -U sa -P 'KyselyTest0' -Q 'select 1'
waitmssql:
image: mcr.microsoft.com/mssql/server:2017-latest
links:
- mssql
depends_on:
- mssql
environment:
MSSQL_PID: Express
entrypoint:
- bash
- -c
# https://docs.microsoft.com/en-us/sql/relational-databases/logs/control-transaction-durability?view=sql-server-ver15#bkmk_DbControl
- 'until /opt/mssql-tools/bin/sqlcmd -S mssql -U sa -P KyselyTest0 -d master -Q "CREATE DATABASE kysely_test; ALTER DATABASE kysely_test SET ALLOW_SNAPSHOT_ISOLATION ON; ALTER DATABASE kysely_test SET DELAYED_DURABILITY = FORCED"; do sleep 5; done'
mysql:
image: 'mysql/mysql-server'
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: kysely_test
ports:
- '3308:3306'
volumes:
- ./tests/scripts/mysql-init.sql:/data/application/init.sql
command: --init-file /data/application/init.sql
postgres:
image: 'postgres'
environment:
POSTGRES_DB: kysely_test
POSTGRES_USER: kysely
POSTGRES_HOST_AUTH_METHOD: trust
ports:
- '5434:5432'
85 changes: 85 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
{
"name": "kysely-typeorm",
"version": "0.1.0",
"description": "Kysely dialect for TypeORM",
"repository": "https://github.com/kysely-org/kysely-typeorm.git",
"homepage": "https://github.com/kysely-org/kysely-typeorm",
"author": "Igal Klebanov <[email protected]>",
"license": "MIT",
"main": "./dist/cjs/index.js",
"module": "./dist/esm/index.js",
"exports": {
".": {
"import": "./dist/esm/index.js",
"require": "./dist/cjs/index.js"
}
},
"files": [
"dist"
],
"keywords": [
"kysely",
"typeorm",
"postgres",
"mysql",
"postgresql",
"mariadb",
"sqlite",
"better-sqlite3",
"mssql",
"dialect"
],
"scripts": {
"build": "tsup && node ./scripts/dist-fix.js",
"clean": "rm -rf dist",
"fmt": "prettier --write .",
"fmt:check": "prettier --check .",
"lint": "eslint src --ext .ts",
"prepack": "pnpm run lint && pnpm run build",
"test:nodejs": "mocha ./tests/nodejs",
"type-check": "tsc --noEmit"
},
"peerDependencies": {
"kysely": ">= 0.24.0 < 1",
"typeorm": ">= 0.3.0 < 0.4.0"
},
"devDependencies": {
"@tsconfig/node20": "^20.1.2",
"@types/chai": "^4.3.4",
"@types/chai-as-promised": "^7.1.5",
"@types/chai-subset": "^1.3.3",
"@types/mocha": "^10.0.1",
"@types/mocha-each": "^2.0.0",
"@types/node": "^18.15.11",
"@types/pg": "^8.10.9",
"@types/validator": "^13.11.7",
"@typescript-eslint/eslint-plugin": "^5.57.1",
"@typescript-eslint/parser": "^5.57.1",
"better-sqlite3": "^9.2.2",
"chai": "^4.3.7",
"chai-subset": "^1.6.0",
"esbuild": "^0.17.15",
"esbuild-runner": "^2.2.2",
"eslint": "^8.38.0",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-prettier": "^4.2.1",
"kysely": "^0.27.0",
"mariadb": "^3.2.2",
"mocha": "^10.2.0",
"mocha-each": "^2.0.1",
"mysql2": "^3.6.5",
"pg": "^8.11.3",
"prettier": "^2.8.7",
"prettier-plugin-organize-imports": "^3.2.2",
"prettier-plugin-pkg": "^0.17.1",
"reflect-metadata": "^0.2.1",
"sqlite3": "^5.1.6",
"tedious": "^16.6.1",
"tsup": "^6.7.0",
"typeorm": "^0.3.17",
"typeorm-naming-strategies": "^4.1.0",
"typescript": "^5.0.4"
},
"sideEffects": false
}
Loading

0 comments on commit 7d717fd

Please sign in to comment.