-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22 from arkavidia-hmif/chore/workflows
[CHORE] Workflows + Husky
- Loading branch information
Showing
57 changed files
with
2,029 additions
and
1,980 deletions.
There are no files selected for viewing
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,32 @@ | ||
module.exports = { | ||
env: { | ||
browser: true, | ||
node: true, | ||
es2021: true, | ||
}, | ||
extends: [ | ||
'eslint:recommended', | ||
'plugin:@typescript-eslint/recommended', | ||
'plugin:prettier/recommended', | ||
], | ||
ignorePatterns: ['.eslintrc.js', 'node_modules/', 'drizzle/'], | ||
overrides: [ | ||
{ | ||
files: ['.eslintrc.{js,cjs}'], | ||
env: { | ||
node: true, | ||
}, | ||
parserOptions: { | ||
sourceType: 'script', | ||
}, | ||
}, | ||
], | ||
parserOptions: { | ||
ecmaVersion: 'latest', | ||
sourceType: 'module', | ||
}, | ||
rules: { | ||
'no-console': 'off', | ||
'prettier/prettier': 'error', | ||
}, | ||
}; |
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,25 @@ | ||
name: codecheck | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- develop | ||
types: [opened, synchronize] | ||
|
||
jobs: | ||
code-check: | ||
name: Run eslint and typescript check | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup Bun | ||
uses: oven-sh/setup-bun@v2 | ||
|
||
- name: Install dependencies | ||
run: bun install | ||
|
||
- name: Run code check | ||
run: bun check |
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,2 @@ | ||
bun i | ||
bun check:write |
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 @@ | ||
drizzle |
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,12 @@ | ||
{ | ||
"singleQuote": true, | ||
"arrowParens": "always", | ||
"semi": true, | ||
"tabWidth": 2, | ||
"trailingComma": "all", | ||
"endOfLine": "auto", | ||
"importOrder": ["^@core/(.*)$", "^@server/(.*)$", "^@ui/(.*)$", "^[./]"], | ||
"importOrderSeparation": true, | ||
"importOrderSortSpecifiers": true, | ||
"plugins": ["@trivago/prettier-plugin-sort-imports"] | ||
} |
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 was deleted.
Oops, something went wrong.
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,11 +1,11 @@ | ||
import { defineConfig } from 'drizzle-kit'; | ||
|
||
export default defineConfig({ | ||
dialect: 'postgresql', | ||
schema: './src/db/schema', | ||
out: './drizzle', | ||
dbCredentials: { | ||
// biome-ignore lint/style/noNonNullAssertion: <explanation> | ||
url: process.env.DATABASE_URL!, | ||
}, | ||
dialect: 'postgresql', | ||
schema: './src/db/schema', | ||
out: './drizzle', | ||
dbCredentials: { | ||
// biome-ignore lint/style/noNonNullAssertion: <explanation> | ||
url: process.env.DATABASE_URL!, | ||
}, | ||
}); |
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,39 +1,53 @@ | ||
{ | ||
"name": "backend", | ||
"scripts": { | ||
"dev": "bun run --hot src/index.ts", | ||
"db:generate": "drizzle-kit generate", | ||
"db:migrate": "drizzle-kit migrate && bun run src/db/migrate-trigger.ts", | ||
"db:studio": "drizzle-kit studio", | ||
"check": "bunx biome check src && bunx check:type", | ||
"check:write": "bunx biome check --write", | ||
"check:lint": "biome lint src", | ||
"check:format": "biome format src", | ||
"check:type": "tsc --noEmit" | ||
}, | ||
"dependencies": { | ||
"@hono/zod-openapi": "^0.18.3", | ||
"@paralleldrive/cuid2": "^2.2.2", | ||
"@scalar/hono-api-reference": "^0.5.162", | ||
"@types/nodemailer": "^6.4.17", | ||
"argon2": "^0.41.1", | ||
"dotenv": "^16.4.5", | ||
"drizzle-orm": "^0.36.0", | ||
"drizzle-zod": "^0.5.1", | ||
"hono": "^4.6.12", | ||
"minio": "^8.0.2", | ||
"nodemailer": "^6.9.16", | ||
"postgres": "^3.4.5", | ||
"zod": "^3.23.8" | ||
}, | ||
"devDependencies": { | ||
"@biomejs/biome": "1.9.4", | ||
"@softwaretechnik/dbml-renderer": "^1.0.30", | ||
"@types/bun": "latest", | ||
"@types/pg": "^8.11.10", | ||
"drizzle-dbml-generator": "^0.10.0", | ||
"drizzle-kit": "^0.27.1", | ||
"tsx": "^4.19.2", | ||
"typescript": "^5.7.2" | ||
} | ||
"name": "backend", | ||
"scripts": { | ||
"dev": "bun run --hot src/index.ts", | ||
"db:generate": "drizzle-kit generate", | ||
"db:migrate": "drizzle-kit migrate && bun run src/db/migrate-trigger.ts", | ||
"db:studio": "drizzle-kit studio", | ||
"check": "bun run typecheck && bun run codecheck", | ||
"check:write": "bun run format && bun run pretty", | ||
"codecheck": "eslint src --ext .ts", | ||
"typecheck": "tsc --noEmit", | ||
"format": "eslint src --ext .ts --fix", | ||
"pretty": "prettier . --write", | ||
"prepare": "husky" | ||
}, | ||
"dependencies": { | ||
"@hono/zod-openapi": "^0.18.3", | ||
"@paralleldrive/cuid2": "^2.2.2", | ||
"@scalar/hono-api-reference": "^0.5.162", | ||
"@trivago/prettier-plugin-sort-imports": "^5.2.0", | ||
"@types/nodemailer": "^6.4.17", | ||
"argon2": "^0.41.1", | ||
"dotenv": "^16.4.5", | ||
"drizzle-orm": "^0.36.0", | ||
"drizzle-zod": "^0.5.1", | ||
"hono": "^4.6.12", | ||
"husky": "^9.1.7", | ||
"install": "^0.13.0", | ||
"minio": "^8.0.2", | ||
"nodemailer": "^6.9.16", | ||
"postgres": "^3.4.5", | ||
"zod": "^3.23.8" | ||
}, | ||
"devDependencies": { | ||
"@biomejs/biome": "1.9.4", | ||
"@softwaretechnik/dbml-renderer": "^1.0.30", | ||
"@types/bun": "latest", | ||
"@types/pg": "^8.11.10", | ||
"@typescript-eslint/eslint-plugin": "^6.4.0", | ||
"drizzle-dbml-generator": "^0.10.0", | ||
"drizzle-kit": "^0.27.1", | ||
"eslint": "^8.57.0", | ||
"eslint-config-prettier": "^9.1.0", | ||
"eslint-plugin-import": "^2.25.2", | ||
"eslint-plugin-n": "^15.0.0 || ^16.0.0 ", | ||
"eslint-plugin-prettier": "^5.1.3", | ||
"eslint-plugin-promise": "^6.0.0", | ||
"prettier": "^3.2.5", | ||
"tsx": "^4.19.2", | ||
"typescript": "^5.7.2", | ||
"typescript-eslint": "^8.18.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,35 +1,35 @@ | ||
import { z } from 'zod'; | ||
|
||
const EnvSchema = z.object({ | ||
PORT: z.coerce.number().default(5000), | ||
DATABASE_URL: z.string().url(), | ||
ALLOWED_ORIGINS: z | ||
.string() | ||
.default('["http://localhost:5173"]') | ||
.transform((value) => JSON.parse(value)) | ||
.pipe(z.array(z.string().url())), | ||
ACCESS_TOKEN_SECRET: z.string(), | ||
ACCESS_TOKEN_EXPIRATION: z.coerce.number(), | ||
REFRESH_TOKEN_SECRET: z.string(), | ||
REFRESH_TOKEN_EXPIRATION: z.coerce.number(), | ||
SMTP_HOST: z.string(), | ||
SMTP_USER: z.string(), | ||
SMTP_PASSWORD: z.string(), | ||
SMTP_PORT: z.coerce.number().default(465), | ||
SMTP_SECURE: z.coerce.boolean().default(true), | ||
GOOGLE_CLIENT_ID: z.string(), | ||
GOOGLE_CLIENT_SECRET: z.string(), | ||
GOOGLE_CALLBACK_URL: z.string(), | ||
S3_ENDPOINT: z.string(), | ||
S3_ACCESS_KEY_ID: z.string(), | ||
S3_SECRET_ACCESS_KEY: z.string(), | ||
PORT: z.coerce.number().default(5000), | ||
DATABASE_URL: z.string().url(), | ||
ALLOWED_ORIGINS: z | ||
.string() | ||
.default('["http://localhost:5173"]') | ||
.transform((value) => JSON.parse(value)) | ||
.pipe(z.array(z.string().url())), | ||
ACCESS_TOKEN_SECRET: z.string(), | ||
ACCESS_TOKEN_EXPIRATION: z.coerce.number(), | ||
REFRESH_TOKEN_SECRET: z.string(), | ||
REFRESH_TOKEN_EXPIRATION: z.coerce.number(), | ||
SMTP_HOST: z.string(), | ||
SMTP_USER: z.string(), | ||
SMTP_PASSWORD: z.string(), | ||
SMTP_PORT: z.coerce.number().default(465), | ||
SMTP_SECURE: z.coerce.boolean().default(true), | ||
GOOGLE_CLIENT_ID: z.string(), | ||
GOOGLE_CLIENT_SECRET: z.string(), | ||
GOOGLE_CALLBACK_URL: z.string(), | ||
S3_ENDPOINT: z.string(), | ||
S3_ACCESS_KEY_ID: z.string(), | ||
S3_SECRET_ACCESS_KEY: z.string(), | ||
}); | ||
|
||
const result = EnvSchema.safeParse(process.env); | ||
if (!result.success) { | ||
console.error('Invalid environment variables: '); | ||
console.error(result.error.flatten().fieldErrors); | ||
process.exit(1); | ||
console.error('Invalid environment variables: '); | ||
console.error(result.error.flatten().fieldErrors); | ||
process.exit(1); | ||
} | ||
|
||
export const env = result.data; |
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
Oops, something went wrong.