Skip to content

Commit

Permalink
🧹 chore: update dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
SaltyAom committed Aug 2, 2024
1 parent 034fae7 commit 30bb419
Show file tree
Hide file tree
Showing 14 changed files with 63 additions and 40 deletions.
31 changes: 20 additions & 11 deletions Dockerfile.resonator
Original file line number Diff line number Diff line change
@@ -1,27 +1,36 @@
FROM oven/bun:1.0.20 as base
FROM oven/bun:1.1.21 as build

WORKDIR /app

COPY apps/resonator/package.json package.json
COPY bun.lockb bun.lockb

RUN bun install

# ? -------------------------
FROM oven/bun:1.0.20

WORKDIR /app

COPY --from=base /app/node_modules node_modules
COPY --from=base /app/package.json package.json

COPY /apps/resonator/src apps/resonator/src
COPY /apps/resonator/tsconfig.json apps/resonator/tsconfig.json
COPY tsconfig.json tsconfig.json

ENV NODE_ENV production
ENV ENV production

RUN bun build --compile --minify apps/resonator/src/index.ts --outfile resonator

RUN rm -rf node_modules && rm -f bun.lockb

COPY apps/resonator/package.docker.json package.json
RUN bun install
RUN bun install --production

# -----------
FROM debian:bullseye-slim

COPY --from=build /app/resonator resonator
COPY --from=build /app/node_modules node_modules
# COPY apps/resonator/.env .env

ENV NODE_ENV production
ENV PORT 3001

CMD ["bun", "apps/resonator/src/index.ts"]
CMD ["./resonator"]

EXPOSE 3001
4 changes: 2 additions & 2 deletions apps/medium/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"lint": "eslint 'src/**/*.{ts,tsx}'"
},
"dependencies": {
"@elysiajs/eden": "^1.1.0-rc.1",
"@elysiajs/eden": "^1.1.1",
"@hookform/resolvers": "^3.3.3",
"@iconify/react": "^4.1.1",
"@radix-ui/react-slot": "^1.0.2",
Expand All @@ -24,7 +24,7 @@
"@vercel/og": "^0.5.20",
"class-variance-authority": "^0.7.0",
"clsx": "^2.0.0",
"elysia": "^1.1.0-rc.12",
"elysia": "^1.1.4",
"framer-motion": "^10.16.16",
"jotai": "^2.6.1",
"lucide-react": "^0.302.0",
Expand Down
5 changes: 5 additions & 0 deletions apps/medium/src/services/eden.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,8 @@ export const resonator = treaty<app>(
}
)
export type resonator = typeof resonator

resonator.character({ id: '123' }).chat.post({
conversationId: '123',
'content': 'awd'
})
Binary file removed apps/resonator/mika.jpg
Binary file not shown.
Binary file removed apps/resonator/mika_portrait.webp
Binary file not shown.
6 changes: 6 additions & 0 deletions apps/resonator/package.docker.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "resonator",
"dependencies": {
"@libsql/linux-arm64-gnu": "^0.4.0-pre.10"
}
}
11 changes: 5 additions & 6 deletions apps/resonator/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,21 @@
"dependencies": {
"@aws-sdk/client-s3": "^3.481.0",
"@cloudflare/ai": "^1.0.47",
"@elysiajs/cors": "^1.1.0-rc.1",
"@elysiajs/cors": "^1.1.0",
"@elysiajs/lucia-auth": "1.1.0-rc.0",
"@elysiajs/opentelemetry": "^1.1.0-rc.3",
"@elysiajs/swagger": "^1.1.0-rc.1",
"@elysiajs/opentelemetry": "^1.1.1",
"@elysiajs/server-timing": "^1.1.0",
"@elysiajs/swagger": "^1.1.0",
"@google/generative-ai": "^0.14.1",
"@libsql/client": "^0.7.0",
"@lucia-auth/adapter-sqlite": "^2.0.1",
"@paralleldrive/cuid2": "^2.2.2",
"better-sqlite3": "^11.1.2",
"drizzle-orm": "^0.32.0",
"drizzle-typebox": "^0.1.1",
"elysia": "1.1.0-rc.12",
"elysia": "1.1.4",
"elysia-rate-limit": "^2.0.1"
},
"devDependencies": {
"@types/better-sqlite3": "^7.6.8",
"bun-types": "latest",
"drizzle-kit": "^0.20.8"
},
Expand Down
Binary file added apps/resonator/resonator
Binary file not shown.
12 changes: 6 additions & 6 deletions apps/resonator/src/controllers/character/index.ts
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
import { Elysia, t } from 'elysia'
import { rateLimit } from 'elysia-rate-limit'

import { ElyAuth, dream } from '@resonator/libs'

export const character = new Elysia({
name: '@controller/character',
prefix: '/character'
})
.use(ElyAuth)
.get('/list/:page', ({ params: { page } }) => dream.character.list(page), {
.get('/list/:page?', ({ params: { page } }) => dream.character.list(page), {
params: t.Object({
page: t.Numeric({
minimum: 1
minimum: 1,
default: 1
})
})
})
.get(
'/room/:page',
'/room/:page?',
async ({ user, params: { page } }) =>
dream.character.getRooms(await user.id, page),
{
isSignIn: true,
params: t.Object({
page: t.Numeric({
minimum: 1
minimum: 1,
default: 1
})
})
}
Expand Down
11 changes: 6 additions & 5 deletions apps/resonator/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,19 @@ const app = new Elysia()
.use(admin)
.use(auth)
.use(character)
.use(app => {
if (process.env.NODE_ENV !== 'production') return app.use(swagger())

// console.log(app.routes.find(x => x.path === '/auth/profile')?.composed?.toString())

if (process.env.NODE_ENV !== 'production') app.use(swagger())

console.log('took', performance.now() - t1)
return app
})

app.listen({
port: process.env.PORT ?? 3001,
hostname: '0.0.0.0'
})

console.log("Resonator took", performance.now() - t1, "ms")

export type app = typeof app

console.log(
Expand Down
3 changes: 0 additions & 3 deletions apps/resonator/src/libs/database/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import { drizzle } from 'drizzle-orm/libsql'
import { createClient } from '@libsql/client'

export { dream, Dream, DreamEditor } from './repository'
export * from './connection'
export * from './table'
20 changes: 13 additions & 7 deletions apps/resonator/src/libs/tracing/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,26 @@ export const tracing = new Elysia({ name: 'tracing' }).use(
opentelemetry({
spanProcessors: [
new BatchSpanProcessor(
new OTLPTraceExporter({
url: 'https://api.axiom.co/v1/traces',
headers: {
Authorization: `Bearer ${Bun.env.AXIOM_KEY}`,
'X-Axiom-Dataset': Bun.env.AXIOM_DATASET
}
})
new OTLPTraceExporter(
process.env.NODE_ENV === 'production'
? {
url: 'https://api.axiom.co/v1/traces',
headers: {
Authorization: `Bearer ${Bun.env.AXIOM_KEY}`,
'X-Axiom-Dataset': Bun.env.AXIOM_DATASET
}
}
: {}
)
)
]
})
)

export function record(name?: string) {
return function decorator(_instance: unknown, _method: unknown) {
return _instance

const instance = _instance as Record<string, unknown>
const method = _method as string

Expand Down
Binary file modified bun.lockb
Binary file not shown.
Empty file removed src
Empty file.

0 comments on commit 30bb419

Please sign in to comment.