diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 07542f5..e537bce 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -4,15 +4,9 @@ # If you need more help, visit the Dockerfile reference guide at # https://docs.docker.com/engine/reference/builder/ -ARG NODE_MAJOR_VERSION=24 -# Necessary to run "pnpm install" when the Dev Container has started. -ARG PNPM_MAJOR_VERSION=10 +ARG BUN_MAJOR_VERSION=1 -FROM node:${NODE_MAJOR_VERSION}-alpine as base -RUN --mount=type=cache,target=/root/.npm \ - npm install -g pnpm@${PNPM_MAJOR_VERSION} -ENV PNPM_HOME="/pnpm" -ENV PATH="$PNPM_HOME:$PATH" +FROM oven/bun:${BUN_MAJOR_VERSION}-alpine AS base # https://code.visualstudio.com/remote/advancedcontainers/sharing-git-credentials#_sharing-gpg-keys RUN apk add --no-cache bash bash-completion git gnupg gcompat diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 03d0e69..2ca59f2 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -28,18 +28,19 @@ // "shutdownAction": "none", // Uncomment the next line to run commands after the container is created. - "postCreateCommand": "corepack up && pnpm install", + "postCreateCommand": "bun install", // When building the dev container for the first time, it works but file permissions do not work. // Only root has permissions. https://github.com/microsoft/vscode-remote-release/issues/4646 // This command does not actually work... - // "updateContentCommand": "chown -R node:node /workspaces", + // "updateContentCommand": "chown -R bun:bun /workspaces", // Configure tool-specific properties. "customizations": { "vscode": { "extensions": [ "ms-azuretools.vscode-containers", + "oven.bun-vscode", "biomejs.biome", "bradlc.vscode-tailwindcss", "wix.vscode-import-cost", @@ -48,27 +49,26 @@ "settings": { "git.enabled": true, "terminal.integrated.defaultProfile.linux": "bash", + "npm.packageManager": "bun", + "npm.scriptRunner": "bun", "editor.defaultFormatter": "biomejs.biome", "editor.codeActionsOnSave": { "source.fixAll.biome": "explicit" }, - "js/ts.tsdk.path": "node_modules/.pnpm/node_modules/typescript/lib", + "js/ts.tsdk.path": "node_modules/.bun/node_modules/typescript/lib", + "json.schemaDownload.trustedDomains": { + "https://ui.shadcn.com/schema.json": true + }, // Debug settings. "launch": { "version": "0.2.0", "configurations": [ // Method 2: https://tsx.is/vscode { - "name": "Attach to process", - "type": "node", + "name": "Attach to Bun", + "type": "bun", "request": "attach", - "port": 9229, - "skipFiles": [ - // Node.js internal core modules. - "/**", - // Ignore all dependencies (optional). - "${workspaceFolder}/node_modules/**" - ] + "url": "ws://localhost:6499/" } ] } diff --git a/.github/workflows/biome.yml b/.github/workflows/biome.yml index 2ff0ea2..70ffbbe 100644 --- a/.github/workflows/biome.yml +++ b/.github/workflows/biome.yml @@ -8,18 +8,10 @@ permissions: contents: read jobs: - build: + biome: runs-on: ubuntu-latest - strategy: - matrix: - node-version: [24] steps: - uses: actions/checkout@v4 - - uses: pnpm/action-setup@v4 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v4 - with: - node-version: ${{ matrix.node-version }} - cache: 'pnpm' - - run: pnpm install - - run: pnpm run check + - uses: oven-sh/setup-bun@v2 + - run: bun install + - run: bun run check diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4f21f85..ac7b572 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -13,16 +13,8 @@ env: jobs: build: runs-on: ubuntu-latest - strategy: - matrix: - node-version: [24] steps: - uses: actions/checkout@v4 - - uses: pnpm/action-setup@v4 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v4 - with: - node-version: ${{ matrix.node-version }} - cache: 'pnpm' - - run: pnpm install - - run: pnpm run build + - uses: oven-sh/setup-bun@v2 + - run: bun install + - run: bun run build diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9049013..39356e6 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -8,18 +8,10 @@ permissions: contents: read jobs: - build: + test: runs-on: ubuntu-latest - strategy: - matrix: - node-version: [24] steps: - uses: actions/checkout@v4 - - uses: pnpm/action-setup@v4 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v4 - with: - node-version: ${{ matrix.node-version }} - cache: 'pnpm' - - run: pnpm install - - run: pnpm test + - uses: oven-sh/setup-bun@v2 + - run: bun install + - run: bun test diff --git a/apps/bot/.typesafe-i18n.json b/apps/bot/.typesafe-i18n.json index 4e15b50..d65378a 100644 --- a/apps/bot/.typesafe-i18n.json +++ b/apps/bot/.typesafe-i18n.json @@ -1,5 +1,5 @@ { - "$schema": "https://unpkg.com/typesafe-i18n@5.26.2/schema/typesafe-i18n.json", + "$schema": "./node_modules/typesafe-i18n/schema/typesafe-i18n.json", "baseLocale": "en-GB", "adapter": "node", "esmImports": true, diff --git a/apps/bot/Dockerfile b/apps/bot/Dockerfile index eece68b..55cd7ab 100644 --- a/apps/bot/Dockerfile +++ b/apps/bot/Dockerfile @@ -4,25 +4,17 @@ # If you need more help, visit the Dockerfile reference guide at # https://docs.docker.com/engine/reference/builder/ -# This problem has caused pain: https://github.com/pnpm/pnpm/issues/6088 -# The solution? Do not use dependenciesMeta.injected (until further notice). - -ARG NODE_MAJOR_VERSION=24 -ARG PNPM_MAJOR_VERSION=10 +ARG BUN_MAJOR_VERSION=1 ARG TURBO_MAJOR_VERSION=2 -FROM node:${NODE_MAJOR_VERSION}-alpine AS base -RUN --mount=type=cache,target=/root/.npm \ - npm install -g pnpm@${PNPM_MAJOR_VERSION} -ENV PNPM_HOME="/pnpm" -ENV PATH="$PNPM_HOME:$PATH" +FROM oven/bun:${BUN_MAJOR_VERSION}-alpine AS base # Require the dependencies which "@ticketer/bot" depends on. FROM base AS builder RUN apk add --no-cache libc6-compat RUN apk update WORKDIR /src -RUN pnpm add -g turbo@${TURBO_MAJOR_VERSION} +RUN bun add --global turbo@${TURBO_MAJOR_VERSION} COPY . . RUN turbo prune @ticketer/bot --docker @@ -33,11 +25,8 @@ WORKDIR /src # Install the dependencies. COPY --from=builder /src/out/json/ . -COPY --from=builder /src/out/pnpm-lock.yaml ./pnpm-lock.yaml -RUN --mount=type=bind,source=package.json,target=package.json \ - --mount=type=bind,source=pnpm-lock.yaml,target=pnpm-lock.yaml \ - --mount=type=cache,target=/root/.local/share/pnpm/store \ - pnpm install --prod --frozen-lockfile +COPY --from=builder /src/out/bun.lock ./bun.lock +RUN bun install --production --frozen-lockfile # Build the project and its dependencies. COPY --from=builder /src/out/full/ . @@ -46,9 +35,9 @@ COPY turbo.json turbo.json # Copy the files over and use the apps/bot directory. FROM base AS runner WORKDIR /src -USER node +USER bun COPY --from=installer /src . WORKDIR /src/apps/bot # Run the bot. -CMD ["pnpm", "start"] +CMD ["bun", "start"] diff --git a/apps/bot/package.json b/apps/bot/package.json index 3c1d304..b7083c0 100644 --- a/apps/bot/package.json +++ b/apps/bot/package.json @@ -4,12 +4,12 @@ "main": "./src/index.ts", "type": "module", "scripts": { - "dev": "tsx watch --env-file=.env.bot.development.local .", - "debug": "tsx watch --inspect-wait --env-file=.env.bot.development.local .", - "start": "tsx .", + "dev": "bun --env-file=.env.bot.development.local .", + "debug": "bun --inspect-wait --env-file=.env.bot.development.local .", + "start": "bun .", "check": "biome check --write", - "commands:deploy:development": "tsx --env-file=.env.bot.development.local ./src/deploy.ts", - "commands:deploy:production": "tsx ./src/deploy.ts", + "commands:deploy:development": "bun --env-file=.env.bot.development.local ./src/deploy.ts", + "commands:deploy:production": "bun ./src/deploy.ts", "i18n": "typesafe-i18n" }, "dependencies": { @@ -19,7 +19,6 @@ "@ticketer/tsconfig": "workspace:*", "chalk": "^5.6.2", "discord.js": "^14.26.3", - "tsx": "^4.21.0", "typesafe-i18n": "^5.27.1", "zod": "^4.3.6" } diff --git a/apps/bot/src/bot.ts b/apps/bot/src/bot.ts index 7ebfa64..8e9e79c 100644 --- a/apps/bot/src/bot.ts +++ b/apps/bot/src/bot.ts @@ -1,6 +1,6 @@ -import { fileURLToPath } from 'node:url'; import { Client } from '@ticketer/djs-framework'; import { environment } from '@ticketer/env/bot'; +import { fileURLToPath } from 'bun'; import { GatewayIntentBits, Options } from 'discord.js'; import { refreshGuildBlacklist } from '@/utils'; diff --git a/apps/bot/src/deploy.ts b/apps/bot/src/deploy.ts index 35d81ef..24c4dba 100644 --- a/apps/bot/src/deploy.ts +++ b/apps/bot/src/deploy.ts @@ -1,7 +1,7 @@ import { exit } from 'node:process'; -import { fileURLToPath } from 'node:url'; import { Client } from '@ticketer/djs-framework'; import { environment } from '@ticketer/env/bot'; +import { fileURLToPath } from 'bun'; import chalk from 'chalk'; const client = new Client({ diff --git a/apps/bot/src/index.ts b/apps/bot/src/index.ts index e83065e..a7fbe35 100644 --- a/apps/bot/src/index.ts +++ b/apps/bot/src/index.ts @@ -1,11 +1,10 @@ -import { fileURLToPath } from 'node:url'; import { environment } from '@ticketer/env/bot'; +import { fileURLToPath } from 'bun'; import chalk from 'chalk'; import { ShardingManager } from 'discord.js'; import { formatDateLong } from '@/utils'; const sharder = new ShardingManager(fileURLToPath(import.meta.resolve('./bot.ts')), { - execArgv: ['--import=tsx'], mode: 'process', token: environment.DISCORD_BOT_TOKEN, }); diff --git a/apps/website/Dockerfile b/apps/website/Dockerfile index 174c54d..f69f0d8 100644 --- a/apps/website/Dockerfile +++ b/apps/website/Dockerfile @@ -4,15 +4,10 @@ # If you need more help, visit the Dockerfile reference guide at # https://docs.docker.com/engine/reference/builder/ -ARG NODE_MAJOR_VERSION=24 -ARG PNPM_MAJOR_VERSION=10 +ARG BUN_MAJOR_VERSION=1 ARG TURBO_MAJOR_VERSION=2 -FROM node:${NODE_MAJOR_VERSION}-alpine AS base -RUN --mount=type=cache,target=/root/.npm \ - npm install -g pnpm@${PNPM_MAJOR_VERSION} -ENV PNPM_HOME="/pnpm" -ENV PATH="$PNPM_HOME:$PATH" +FROM oven/bun:${BUN_MAJOR_VERSION}-alpine AS base ENV NODE_ENV=production # Require the dependencies which "@ticketer/website" depends on. @@ -20,7 +15,7 @@ FROM base AS builder RUN apk add --no-cache libc6-compat RUN apk update WORKDIR /src -RUN pnpm add -g turbo@${TURBO_MAJOR_VERSION} +RUN bun add --global turbo@${TURBO_MAJOR_VERSION} COPY . . RUN turbo prune @ticketer/website --docker @@ -28,15 +23,12 @@ FROM base AS installer RUN apk add --no-cache libc6-compat RUN apk update WORKDIR /src -RUN pnpm add -g turbo@${TURBO_MAJOR_VERSION} +RUN bun add --global turbo@${TURBO_MAJOR_VERSION} # Install the dependencies. COPY --from=builder /src/out/json/ . -COPY --from=builder /src/out/pnpm-lock.yaml ./pnpm-lock.yaml -RUN --mount=type=bind,source=package.json,target=package.json \ - --mount=type=bind,source=pnpm-lock.yaml,target=pnpm-lock.yaml \ - --mount=type=cache,target=/root/.local/share/pnpm/store \ - pnpm install --frozen-lockfile +COPY --from=builder /src/out/bun.lock ./bun.lock +RUN bun install --frozen-lockfile # Build the project and its dependencies. COPY --from=builder /src/out/full/ . @@ -62,18 +54,18 @@ RUN turbo run build --filter=@ticketer/website FROM base AS runner RUN apk add --no-cache curl WORKDIR /src -USER node +USER bun # https://turborepo.com/docs/guides/tools/docker # Automatically leverage output traces to reduce image size # https://nextjs.org/docs/advanced-features/output-file-tracing -COPY --from=installer --chown=node:node /src/apps/website/.next/standalone ./ -COPY --from=installer --chown=node:node /src/apps/website/.next/static ./apps/website/.next/static -COPY --from=installer --chown=node:node /src/apps/website/public ./apps/website/public +COPY --from=installer --chown=bun:bun /src/apps/website/.next/standalone ./ +COPY --from=installer --chown=bun:bun /src/apps/website/.next/static ./apps/website/.next/static +COPY --from=installer --chown=bun:bun /src/apps/website/public ./apps/website/public ENV HOSTNAME=0.0.0.0 ENV PORT=2027 EXPOSE ${PORT} # Run the website. -CMD ["node", "apps/website/server.js"] +CMD ["bun", "run", "apps/website/server.js"] diff --git a/apps/website/package.json b/apps/website/package.json index cb72ec1..a64475c 100644 --- a/apps/website/package.json +++ b/apps/website/package.json @@ -4,11 +4,11 @@ "private": true, "scripts": { "dev": "next dev --port 2027", - "debug": "pnpm run dev", + "debug": "bun run dev", "build": "NODE_ENV=production NEXT_TELEMETRY_DISABLED=1 next build", "start": "NODE_ENV=production next start --port 2027", "typegen": "next typegen", - "check": "pnpm run typegen && biome check --write" + "check": "bun run typegen && biome check --write" }, "dependencies": { "@icons-pack/react-simple-icons": "^13.13.0", @@ -39,6 +39,7 @@ "devDependencies": { "@tailwindcss/postcss": "^4.2.2", "@ticketer/tsconfig": "workspace:*", + "@types/node": "^25.6.0", "@types/react": "^19.2.14", "@types/react-dom": "^19.2.3", "autoprefixer": "^10.5.0", diff --git a/apps/website/src/app/[locale]/docs/self-hosting/page.tsx b/apps/website/src/app/[locale]/docs/self-hosting/page.tsx index 14e5c9d..d7b8986 100644 --- a/apps/website/src/app/[locale]/docs/self-hosting/page.tsx +++ b/apps/website/src/app/[locale]/docs/self-hosting/page.tsx @@ -257,10 +257,10 @@ export default async function Page({ params }: PageProps<'/[locale]/docs/self-ho {t('content.running-the-bot.paragraphs.2')} - + docker - exec ticketer-bot sh -c "cd /src/apps/bot && pnpm commands:deploy:production" + exec ticketer-bot sh -c "cd /src/apps/bot && bun run commands:deploy:production" diff --git a/apps/website/src/app/[locale]/layout.tsx b/apps/website/src/app/[locale]/layout.tsx index e4fc4c6..3c9668d 100644 --- a/apps/website/src/app/[locale]/layout.tsx +++ b/apps/website/src/app/[locale]/layout.tsx @@ -51,9 +51,10 @@ export default async function RootLayout({ children, params }: LayoutProps<'/[lo {environment.NEXT_PUBLIC_UMAMI_ID && environment.NEXT_PUBLIC_UMAMI_URL && (