Skip to content

Commit

Permalink
feat: add test for adapter (#2)
Browse files Browse the repository at this point in the history
* feat: add test for adapter

* feat: improve package
  • Loading branch information
tony-stark-eth authored Sep 30, 2024
1 parent 804e7ae commit 36b5fcc
Show file tree
Hide file tree
Showing 14 changed files with 904 additions and 39 deletions.
85 changes: 85 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: CI
on:
workflow_dispatch:
pull_request:
types:
- opened
- reopened
- synchronize
paths-ignore:
- '.github/**'
- '!.github/workflows/ci.yaml'
- '.gitignore'
- '**.md'

push:
branches:
- main
- release@*
paths-ignore:
- '.github/**'
- '!.github/workflows/ci.yaml'
- '.gitignore'
- '**.md'

concurrency:
# Documentation suggests ${{ github.head_ref }}, but that's only available on pull_request/pull_request_target triggers, so using ${{ github.ref }}.
# On main, we want all builds to complete even if merging happens faster to make it easier to discover at which point something broke.
group: ci-${{ github.ref_name == 'main' && format('ci-main-{0}', github.sha) || format('ci-{0}', github.ref) }}
cancel-in-progress: true

permissions:
contents: read
id-token: write

jobs:
code-style:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Check Out
uses: actions/checkout@v4

- name: Use Node.js 20
uses: actions/setup-node@v4
with:
node-version: 20

- name: Enable corepack
run: |
corepack enable
corepack prepare pnpm@latest --activate
- name: Install deps
run: pnpm install --frozen-lockfile

- name: Run Code Style Check
run: pnpm run lint

tests:
runs-on: ubuntu-latest
timeout-minutes: 25
steps:
- name: Check Out
uses: actions/checkout@v4

- name: Use Node.js 20
uses: actions/setup-node@v4
with:
node-version: 20

- name: Enable corepack
run: |
corepack enable
corepack prepare pnpm@latest --activate
- name: Install deps
run: pnpm install --frozen-lockfile

- name: Start Docker Compose Services
shell: bash
run: |
docker compose up -d --no-build --no-deps --quiet-pull --wait
- name: Run Test Suite
run: pnpm run test
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ node_modules

# dist
/dist

**/*.tgz
15 changes: 15 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
services:
database:
image: postgres
restart: always
environment:
POSTGRES_USER: ${DATABASE_USER:-lucia}
POSTGRES_PASSWORD: ${DATABASE_PASSWORD:-lucia}
POSTGRES_DB: ${DATABASE_NAME:-lucia}
ports:
- "5432:5432"
volumes:
- database:/var/lib/postgresql/data -
volumes:
database:
driver: local
3 changes: 3 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ import tseslint from 'typescript-eslint';
import stylistic from '@stylistic/eslint-plugin';

export default tseslint.config(
{
ignores: ['**/*.js'],
},
eslint.configs.recommended,
...tseslint.configs.recommended,
stylistic.configs.customize({
Expand Down
35 changes: 28 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,33 @@
{
"name": "@tony-stark-eth/lucia-mikro-orm-adapter",
"version": "1.0.0",
"version": "2.0.0",
"description": "mikro-orm adapter for lucia auth",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"module": "dist/index.js",
"type": "module",
"packageManager": "[email protected]",
"engines": {
"node": "^20.0.0",
"pnpm": "^9.0.0"
},
"exports": {
".": "./dist/index.js"
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.js"
},
"./*": {
"types": "./dist/*.d.ts",
"import": "./dist/*.js"
},
"./**/*": {
"types": "./dist/**/*.d.ts",
"import": "./dist/**/*.js"
}
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "pnpm run lint:fix && tsc && tsc-alias",
"test": "tsx tests/mikro-orm-postgres.ts",
"build": "pnpm run lint:fix && tsc -p tsconfig.json",
"release": "pnpm run lint:fix && release-it",
"lint": "pnpm run lint:base -- .",
"lint:base": "eslint --cache --cache-location='node_modules/.cache/eslint/'",
Expand Down Expand Up @@ -44,16 +56,19 @@
},
"devDependencies": {
"@eslint/js": "^9.11.1",
"@mikro-orm/core": "^6.3.10",
"@mikro-orm/core": "^6.3.11",
"@mikro-orm/postgresql": "^6.3.11",
"@stylistic/eslint-plugin": "^2.8.0",
"@types/eslint__js": "^8.42.3",
"@types/node": "^22.7.1",
"@types/node": "^20.0.0",
"@types/uuid": "^10.0.0",
"eslint": "^9.11.1",
"lucia": "^3.2.0",
"npm-pkg-lint": "^3.9.0",
"release-it": "^17.6.0",
"release-it-pnpm": "^4.6.3",
"tsc-alias": "^1.8.10",
"tsx": "^4.19.1",
"typescript": "^5.6.2",
"typescript-eslint": "^8.7.0"
},
Expand All @@ -62,5 +77,11 @@
},
"publishConfig": {
"access": "public"
}
},
"files": [
"dist",
"src",
"README.md",
"LICENSE"
]
}
Loading

0 comments on commit 36b5fcc

Please sign in to comment.