Try number idk how much

This commit is contained in:
2025-08-10 23:35:20 +02:00
parent 76f2072d61
commit 67ff6a4c19
5 changed files with 11 additions and 3 deletions

View File

@@ -7,6 +7,7 @@ RUN bun install --frozen-lockfile
COPY . . COPY . .
ENV NODE_ENV=prod ENV NODE_ENV=prod
ENV DOCKER=1
RUN bun bundle RUN bun bundle
FROM oven/bun FROM oven/bun

View File

@@ -21,6 +21,11 @@ const files = [
eventFiles.map(f => `src/events/${f}`) eventFiles.map(f => `src/events/${f}`)
].flat() ].flat()
const banner = [
"process.env.BUILD = 'true'",
process.env.DOCKER === "1" ? "process.env.DOCKER = '1'" : null
].filter(v => typeof v === "string").join("\n")
await Bun.build({ await Bun.build({
entrypoints: ["src/index.ts", ...files], entrypoints: ["src/index.ts", ...files],
outdir: "dist", outdir: "dist",
@@ -32,5 +37,5 @@ await Bun.build({
asset: "asset/[name]-[hash].[ext]" asset: "asset/[name]-[hash].[ext]"
}, },
root: "src", root: "src",
banner: "process.env.BUILD = 'true'" banner
}) })

2
src/enviroment.d.ts vendored
View File

@@ -3,6 +3,8 @@ declare global {
interface ProcessEnv { interface ProcessEnv {
NODE_ENV?: "dev" | "prod" NODE_ENV?: "dev" | "prod"
TYPESCRIPT?: "true" TYPESCRIPT?: "true"
BUILD?: "true"
DOCKER?: "1"
} }
} }
} }

View File

@@ -1,4 +1,4 @@
export type LoadEventsOptions = { export type LoadEventsOptions = {
ft: "ts" | "js" ft: "ts" | "js"
dir: "src" | "dist" dir: "src" | "dist" | ""
} }

View File

@@ -8,7 +8,7 @@ const client = new Client()
const redis = new RedisClient(env.prod.REDISURI) const redis = new RedisClient(env.prod.REDISURI)
const ft = process.env.BUILD !== "true" ? "ts" : "js" const ft = process.env.BUILD !== "true" ? "ts" : "js"
const dir = process.env.BUILD !== "true" ? "src" : "dist" const dir = process.env.DOCKER !== "1" ? process.env.BUILD !== "true" ? "src" : "dist" : ""
class Illegitimate { class Illegitimate {
async start() { async start() {