Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 5b9a7c2

Browse files
authored
fix workflows & little fixes (#15)
* trying to trigger yml * trying to add bun * wip * wip * wip * fixes * wip * wip * wip * wip
1 parent dd40633 commit 5b9a7c2

File tree

14 files changed

+67
-47
lines changed

14 files changed

+67
-47
lines changed

.github/workflows/build-api.yml

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,31 @@
11
name: Build API
22

3-
on:
4-
push:
5-
branches:
6-
- main
7-
pull_request:
8-
branches:
9-
- main
3+
on:
4+
push:
5+
branches: [ "master" ]
6+
pull_request:
7+
branches: [ "master" ]
108

11-
jobs:
12-
build-api:
9+
jobs:
10+
build-api:
1311
runs-on: ubuntu-latest
14-
needs: linting
15-
steps:
12+
steps:
1613
- name: Checkout repository
1714
uses: actions/checkout@v2
1815

16+
- name: Setup Bun
17+
uses: oven-sh/setup-bun@v1
18+
with:
19+
bun-version: 1.0.11 # or "latest", "canary", <sha>
20+
1921
- name: Install dependencies
2022
run: bun i
2123

24+
- name: Install dependencies in API
25+
run: |
26+
cd apps/api
27+
bun i
28+
2229
- name: API build
2330
run: bun run build:api
2431

.github/workflows/build-shared.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,22 @@ name: Build Shared
22

33
on:
44
push:
5-
branches:
6-
- main
5+
branches: [ "master" ]
76
pull_request:
8-
branches:
9-
- main
7+
branches: [ "master" ]
108

119
jobs:
1210
build-shared:
1311
runs-on: ubuntu-latest
14-
needs: linting
1512
steps:
1613
- name: Checkout repository
1714
uses: actions/checkout@v2
1815

16+
- name: Setup Bun
17+
uses: oven-sh/setup-bun@v1
18+
with:
19+
bun-version: 1.0.11 # or "latest", "canary", <sha>
20+
1921
- name: Install dependencies
2022
run: bun i
2123

.github/workflows/build-web.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,22 @@ name: Build Web
22

33
on:
44
push:
5-
branches:
6-
- main
5+
branches: [ "master" ]
76
pull_request:
8-
branches:
9-
- main
7+
branches: [ "master" ]
108

119
jobs:
1210
build-web:
1311
runs-on: ubuntu-latest
14-
needs: linting
1512
steps:
1613
- name: Checkout repository
1714
uses: actions/checkout@v2
1815

16+
- name: Setup Bun
17+
uses: oven-sh/setup-bun@v1
18+
with:
19+
bun-version: 1.0.11 # or "latest", "canary", <sha>
20+
1921
- name: Install dependencies
2022
run: bun i
2123

.github/workflows/lint.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,9 @@ name: Linting
22

33
on:
44
push:
5-
branches:
6-
- main
5+
branches: [ "master" ]
76
pull_request:
8-
branches:
9-
- main
7+
branches: [ "master" ]
108

119
jobs:
1210
linting:
@@ -15,6 +13,11 @@ jobs:
1513
- name: Checkout repository
1614
uses: actions/checkout@v2
1715

16+
- name: Setup Bun
17+
uses: oven-sh/setup-bun@v1
18+
with:
19+
bun-version: 1.0.11 # or "latest", "canary", <sha>
20+
1821
- name: Install dependencies
1922
run: bun i
2023

apps/api/package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
"dev": "bun run --watch src/index.ts",
77
"db:start": "docker-compose up -d",
88
"migrate": "npx prisma migrate dev && npx prisma generate",
9+
"lint": "biome lint . --apply",
10+
"format": "biome format . --write",
911
"build": "bun build ./src/index.ts --outdir dist --minify --target bun --splitting",
1012
"build:types": "tsc --noEmit"
1113
},
@@ -16,7 +18,8 @@
1618
},
1719
"devDependencies": {
1820
"bun-types": "latest",
19-
"prisma": "^5.6.0"
21+
"prisma": "^5.6.0",
22+
"shared": "workspace:*"
2023
},
2124
"repository": {
2225
"type": "git",

apps/api/src/handlers/userHandler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { User } from '@prisma/client'
21
import { getAllUsers, getUserById } from '../services/userService'
32
import { ApiResponse, ContextWith } from '../types'
3+
import { User } from 'shared'
44

55
type Params = { id: string }
66

apps/api/src/index.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
1+
import { handleErrors } from '@utils'
12
import Elysia from 'elysia'
23
import users from './routes/user/userRoutes'
3-
import { handleErrors } from '@utils'
44

5-
const app = new Elysia()
6-
.use(users)
7-
.listen(3000)
8-
.onError(handleErrors)
5+
const app = new Elysia().use(users).listen(3000).onError(handleErrors)
96

107
console.log(
118
`🦊 Elysia is running at http://${app.server?.hostname}:${app.server?.port}`

apps/api/src/services/userService.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
1-
import { PrismaClient, User as PrismaUser } from '@prisma/client'
1+
import { PrismaClient } from 'prisma/prisma-client/scripts/default-index'
2+
import { User } from 'shared'
23

34
const db = new PrismaClient()
45

5-
export const getAllUsers = async (): Promise<PrismaUser[]> => {
6+
export const getAllUsers = async (): Promise<User[]> => {
67
return db.user.findMany()
78
}
89

910
export const getUserById = async (
1011
userId: number
11-
): Promise<PrismaUser | null> => {
12+
): Promise<User | null> => {
1213
return db.user.findUnique({
1314
where: {
1415
id: userId

apps/shared/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
"main": "index.ts",
66
"scripts": {
77
"test": "echo \"Error: no test specified\" && exit 1",
8+
"lint": "biome lint . --apply",
9+
"format": "biome format . --write",
810
"build": "tsc --noEmit"
911
},
1012
"repository": {

apps/web/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
"scripts": {
77
"dev": "bunx --bun vite",
88
"build": "tsc && vite build",
9+
"lint": "biome lint . --apply",
10+
"format": "biome format . --write",
911
"preview": "vite preview"
1012
},
1113
"dependencies": {

apps/web/src/main.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,5 @@ const AppProvider = () => {
1515
)
1616
}
1717

18+
// biome-ignore lint: It's OK
1819
render(<AppProvider />, document.getElementById('app')!)

apps/web/vite.config.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,21 @@ export default defineConfig({
1212
terserOptions: {
1313
compress: {
1414
drop_console: true,
15-
dead_code: true,
15+
dead_code: true
1616
},
1717
toplevel: true,
1818
keep_classnames: false,
1919
keep_fnames: false,
20-
safari10: false,
20+
safari10: false
2121
},
2222
rollupOptions: {
2323
logLevel: 'debug',
2424
output: {
2525
manualChunks: {
26-
'@vkontakte/icons': ['@vkontakte/icons'],
27-
},
28-
},
29-
},
26+
'@vkontakte/icons': ['@vkontakte/icons']
27+
}
28+
}
29+
}
3030
},
3131
// @ts-ignore unknown
3232
plugins: [preact()],
@@ -36,8 +36,8 @@ export default defineConfig({
3636
{ find: '@utils', replacement: path.resolve(__dirname, 'src/utils') },
3737
{
3838
find: '@components',
39-
replacement: path.resolve(__dirname, 'src/components'),
40-
},
41-
],
42-
},
39+
replacement: path.resolve(__dirname, 'src/components')
40+
}
41+
]
42+
}
4343
})

bun.lockb

32 Bytes
Binary file not shown.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
"prepare": "husky install && bun format",
99
"dev:api": "cd apps/api && bun dev",
1010
"dev:startDB": "cd apps/api && db:start",
11-
"lint": "biome lint .",
11+
"lint": "biome lint . --apply",
1212
"format": "biome format . --write",
13-
"checkAll": "biome check .",
13+
"checkAll": "biome check . --apply",
1414
"build:web": "cd apps/web && bun run build",
1515
"build:api": "cd apps/api && bun run build",
1616
"build:api:types": "cd apps/api && bun run build:types",

0 commit comments

Comments
 (0)