-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
+ add lint as pre-commit hook and on pr workflow + add convenience scripts + lint and format + document in CONTRIBUTING.md
- Loading branch information
Showing
22 changed files
with
170 additions
and
154 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: Lint, format, and test | ||
|
||
on: | ||
pull_request: | ||
branches: [main] | ||
|
||
jobs: | ||
lint: | ||
name: Lint and format | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Bun | ||
uses: oven-sh/setup-bun@v1 | ||
|
||
- name: Lint and format the code | ||
run: bunx biome ci --linter-enabled=true --formatter-enabled=true . | ||
|
||
test: | ||
name: Test | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Bun | ||
uses: oven-sh/setup-bun@v1 | ||
|
||
- name: Test the code | ||
run: bun test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/usr/bin/env sh | ||
. "$(dirname -- "$0")/_/husky.sh" | ||
|
||
bun lint-staged |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
{ | ||
"editor.tabSize": 2 | ||
} | ||
"editor.tabSize": 2 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,18 @@ | ||
import type { Config } from "drizzle-kit"; | ||
import type { Config } from 'drizzle-kit'; | ||
export const dbCredentials = { | ||
host: process.env.POSTGRES_HOST || "0.0.0.0", | ||
port: parseInt(process.env.POSTGRES_PORT || '5432'), | ||
user: process.env.POSTGRES_USER || "postgres", | ||
password: process.env.POSTGRES_PASSWORD || "postgres", | ||
database: process.env.POSTGRES_DB || "medium" | ||
} | ||
host: process.env.POSTGRES_HOST || '0.0.0.0', | ||
port: parseInt(process.env.POSTGRES_PORT || '5432'), | ||
user: process.env.POSTGRES_USER || 'postgres', | ||
password: process.env.POSTGRES_PASSWORD || 'postgres', | ||
database: process.env.POSTGRES_DB || 'medium', | ||
}; | ||
|
||
export const dbCredentialsString = `postgres://${dbCredentials.user}:${dbCredentials.password}@${dbCredentials.host}:${dbCredentials.port}/${dbCredentials.database}`; | ||
|
||
export default { | ||
out: "./src/db/migrations", | ||
schema: "**/*.schema.ts", | ||
breakpoints: false, | ||
driver: "pg", | ||
dbCredentials | ||
out: './src/db/migrations', | ||
schema: '**/*.schema.ts', | ||
breakpoints: false, | ||
driver: 'pg', | ||
dbCredentials, | ||
} satisfies Config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -72,4 +72,4 @@ | |
"tables": {}, | ||
"columns": {} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,4 +10,4 @@ | |
"breakpoints": false | ||
} | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
import {drizzle} from "drizzle-orm/postgres-js"; | ||
import {migrate} from "drizzle-orm/postgres-js/migrator"; | ||
import {migrationClient} from "@/database.providers"; | ||
import { drizzle } from 'drizzle-orm/postgres-js'; | ||
import { migrate } from 'drizzle-orm/postgres-js/migrator'; | ||
import { migrationClient } from '@/database.providers'; | ||
|
||
await migrate(drizzle(migrationClient), {migrationsFolder: `${import.meta.dir}`}); | ||
await migrate(drizzle(migrationClient), { | ||
migrationsFolder: `${import.meta.dir}`, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,20 @@ | ||
import { exit } from 'process'; | ||
import { db } from '@/database.providers'; | ||
import {users} from "@/users/users.schema"; | ||
import { users } from '@/users/users.schema'; | ||
|
||
const data = { | ||
id: users.id.default, | ||
email: '[email protected]', | ||
username: 'test', | ||
password: 'test', | ||
bio: 'test', | ||
image: 'test', | ||
} | ||
console.log("Inserting user: ", data) | ||
await db.insert(users).values(data) | ||
console.log("User inserted") | ||
id: users.id.default, | ||
email: '[email protected]', | ||
username: 'test', | ||
password: 'test', | ||
bio: 'test', | ||
image: 'test', | ||
}; | ||
console.log('Inserting user: ', data); | ||
await db.insert(users).values(data); | ||
console.log('User inserted'); | ||
|
||
const userResult = await db.select().from(users); | ||
console.log("User result: ", userResult); | ||
console.log('User result: ', userResult); | ||
|
||
exit(0); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,28 @@ | ||
import { defineConfig } from 'vitepress' | ||
import { defineConfig } from 'vitepress'; | ||
|
||
// https://vitepress.dev/reference/site-config | ||
export default defineConfig({ | ||
title: "RealWorld Elysia Docs", | ||
description: "A Vite Press docs of Real World", | ||
title: 'RealWorld Elysia Docs', | ||
description: 'A Vite Press docs of Real World', | ||
themeConfig: { | ||
// https://vitepress.dev/reference/default-theme-config | ||
nav: [ | ||
{ text: 'Home', link: '/' }, | ||
{ text: 'Examples', link: '/markdown-examples' } | ||
{ text: 'Examples', link: '/markdown-examples' }, | ||
], | ||
|
||
sidebar: [ | ||
{ | ||
text: 'Examples', | ||
items: [ | ||
{ text: 'Markdown Examples', link: '/markdown-examples' }, | ||
{ text: 'Runtime API Examples', link: '/api-examples' } | ||
] | ||
} | ||
{ text: 'Runtime API Examples', link: '/api-examples' }, | ||
], | ||
}, | ||
], | ||
|
||
socialLinks: [ | ||
{ icon: 'github', link: 'https://github.com/vuejs/vitepress' } | ||
] | ||
} | ||
}) | ||
{ icon: 'github', link: 'https://github.com/vuejs/vitepress' }, | ||
], | ||
}, | ||
}); |
Oops, something went wrong.