From 81e69d78c91f2bb867851c2b57de40ee1429aebb Mon Sep 17 00:00:00 2001 From: ImNotTheGuy Date: Mon, 20 Apr 2026 16:42:19 +0200 Subject: [PATCH] shared package.json config --- .gitea/workflows/deploy.yml | 32 +++++++++++++++++ Dockerfile | 33 ++++++++++++++++++ apps/{docs => api}/.gitignore | 0 apps/{docs => api}/README.md | 0 apps/{docs => api}/app/favicon.ico | Bin apps/{docs => api}/app/fonts/GeistMonoVF.woff | Bin apps/{docs => api}/app/fonts/GeistVF.woff | Bin apps/{docs => api}/app/globals.css | 0 apps/{docs => api}/app/layout.tsx | 0 apps/{docs => api}/app/page.module.css | 0 apps/{docs => api}/app/page.tsx | 2 +- apps/{docs => api}/eslint.config.js | 0 apps/{docs => api}/next.config.js | 0 apps/{docs => api}/package.json | 11 +++--- apps/{docs => api}/public/file-text.svg | 0 apps/{docs => api}/public/globe.svg | 0 apps/{docs => api}/public/next.svg | 0 apps/{docs => api}/public/turborepo-dark.svg | 0 apps/{docs => api}/public/turborepo-light.svg | 0 apps/{docs => api}/public/vercel.svg | 0 apps/{docs => api}/public/window.svg | 0 apps/{docs => api}/tsconfig.json | 0 apps/web/package.json | 8 ++--- docker-compose.yml | 0 packages/shared/index.ts | 5 +++ packages/shared/package.json | 7 ++++ pnpm-lock.yaml | 13 ++++++- turbo.json | 5 ++- 28 files changed, 102 insertions(+), 14 deletions(-) create mode 100644 .gitea/workflows/deploy.yml create mode 100644 Dockerfile rename apps/{docs => api}/.gitignore (100%) rename apps/{docs => api}/README.md (100%) rename apps/{docs => api}/app/favicon.ico (100%) rename apps/{docs => api}/app/fonts/GeistMonoVF.woff (100%) rename apps/{docs => api}/app/fonts/GeistVF.woff (100%) rename apps/{docs => api}/app/globals.css (100%) rename apps/{docs => api}/app/layout.tsx (100%) rename apps/{docs => api}/app/page.module.css (100%) rename apps/{docs => api}/app/page.tsx (98%) rename apps/{docs => api}/eslint.config.js (100%) rename apps/{docs => api}/next.config.js (100%) rename apps/{docs => api}/package.json (74%) rename apps/{docs => api}/public/file-text.svg (100%) rename apps/{docs => api}/public/globe.svg (100%) rename apps/{docs => api}/public/next.svg (100%) rename apps/{docs => api}/public/turborepo-dark.svg (100%) rename apps/{docs => api}/public/turborepo-light.svg (100%) rename apps/{docs => api}/public/vercel.svg (100%) rename apps/{docs => api}/public/window.svg (100%) rename apps/{docs => api}/tsconfig.json (100%) create mode 100644 docker-compose.yml create mode 100644 packages/shared/index.ts create mode 100644 packages/shared/package.json diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml new file mode 100644 index 0000000..7c89440 --- /dev/null +++ b/.gitea/workflows/deploy.yml @@ -0,0 +1,32 @@ +name: Build and Deploy +on: [ push ] + +jobs: + build-and-push: + runs-on: ubuntu-latest # This refers to your self-hosted runner + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Login to Gitea Registry + uses: docker/login-action@v2 + with: + registry: git.ludops.com + username: ${{ gitea.actor }} + password: ${{ secrets.GITEA_TOKEN }} + + - name: Build and Push + uses: docker/build-push-action@v4 + with: + context: . + push: true + tags: git.ludops.com/${{ gitea.repository }}:latest + + - name: Deploy to Server + run: | + # Here we tell the server to pull the new image and restart + docker compose -f docker-compose.prod.yml pull + docker compose -f docker-compose.prod.yml up -d diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..8d2b01d --- /dev/null +++ b/Dockerfile @@ -0,0 +1,33 @@ +FROM node:20-alpine AS base +ENV PNPM_HOME="/pnpm" +ENV PATH="$PNPM_HOME:$PATH" +RUN corepack enable +WORKDIR /app + +# Install dependencies +COPY pnpm-lock.yaml pnpm-workspace.yaml package.json turbo.json ./ +COPY apps/api/package.json ./apps/api/ +COPY apps/web/package.json ./apps/web/ +COPY packages/shared/package.json ./packages/shared/ +COPY packages/ui/package.json ./packages/ui/ +COPY packages/typescript-config/package.json ./packages/typescript-config/ + +RUN pnpm install --frozen-lockfile + +# Copy source and build +COPY . . +RUN pnpm turbo run build + +# Runner Stage +FROM node:20-alpine AS runner +WORKDIR /app +COPY --from=base /app/apps/api/dist ./api +COPY --from=base /app/apps/web/dist ./web-dist +COPY --from=base /app/node_modules ./node_modules +# We need the shared package built files if they exist +COPY --from=base /app/packages/shared ./packages/shared +COPY --from=base /app/packages/ui ./packages/ui +COPY --from=base /app/packages/typescript-config ./packages/typescript-config + +EXPOSE 3000 +CMD ["node", "api/index.js"] \ No newline at end of file diff --git a/apps/docs/.gitignore b/apps/api/.gitignore similarity index 100% rename from apps/docs/.gitignore rename to apps/api/.gitignore diff --git a/apps/docs/README.md b/apps/api/README.md similarity index 100% rename from apps/docs/README.md rename to apps/api/README.md diff --git a/apps/docs/app/favicon.ico b/apps/api/app/favicon.ico similarity index 100% rename from apps/docs/app/favicon.ico rename to apps/api/app/favicon.ico diff --git a/apps/docs/app/fonts/GeistMonoVF.woff b/apps/api/app/fonts/GeistMonoVF.woff similarity index 100% rename from apps/docs/app/fonts/GeistMonoVF.woff rename to apps/api/app/fonts/GeistMonoVF.woff diff --git a/apps/docs/app/fonts/GeistVF.woff b/apps/api/app/fonts/GeistVF.woff similarity index 100% rename from apps/docs/app/fonts/GeistVF.woff rename to apps/api/app/fonts/GeistVF.woff diff --git a/apps/docs/app/globals.css b/apps/api/app/globals.css similarity index 100% rename from apps/docs/app/globals.css rename to apps/api/app/globals.css diff --git a/apps/docs/app/layout.tsx b/apps/api/app/layout.tsx similarity index 100% rename from apps/docs/app/layout.tsx rename to apps/api/app/layout.tsx diff --git a/apps/docs/app/page.module.css b/apps/api/app/page.module.css similarity index 100% rename from apps/docs/app/page.module.css rename to apps/api/app/page.module.css diff --git a/apps/docs/app/page.tsx b/apps/api/app/page.tsx similarity index 98% rename from apps/docs/app/page.tsx rename to apps/api/app/page.tsx index efb86f0..3243e7d 100644 --- a/apps/docs/app/page.tsx +++ b/apps/api/app/page.tsx @@ -63,7 +63,7 @@ export default function Home() { Read our docs - diff --git a/apps/docs/eslint.config.js b/apps/api/eslint.config.js similarity index 100% rename from apps/docs/eslint.config.js rename to apps/api/eslint.config.js diff --git a/apps/docs/next.config.js b/apps/api/next.config.js similarity index 100% rename from apps/docs/next.config.js rename to apps/api/next.config.js diff --git a/apps/docs/package.json b/apps/api/package.json similarity index 74% rename from apps/docs/package.json rename to apps/api/package.json index 4fa303b..bfc4879 100644 --- a/apps/docs/package.json +++ b/apps/api/package.json @@ -1,16 +1,17 @@ { - "name": "docs", + "name": "api", "version": "0.1.0", "type": "module", "private": true, "scripts": { - "dev": "next dev --port 3001", - "build": "next build", - "start": "next start", + "dev": "vite dev --port 3001", + "build": "vite build", + "start": "vite preview", "lint": "eslint --max-warnings 0", - "check-types": "next typegen && tsc --noEmit" + "check-types": "tsc --noEmit" }, "dependencies": { + "@ludops/shared": "workspace:^", "@repo/ui": "workspace:*", "next": "16.2.0", "react": "^19.2.0", diff --git a/apps/docs/public/file-text.svg b/apps/api/public/file-text.svg similarity index 100% rename from apps/docs/public/file-text.svg rename to apps/api/public/file-text.svg diff --git a/apps/docs/public/globe.svg b/apps/api/public/globe.svg similarity index 100% rename from apps/docs/public/globe.svg rename to apps/api/public/globe.svg diff --git a/apps/docs/public/next.svg b/apps/api/public/next.svg similarity index 100% rename from apps/docs/public/next.svg rename to apps/api/public/next.svg diff --git a/apps/docs/public/turborepo-dark.svg b/apps/api/public/turborepo-dark.svg similarity index 100% rename from apps/docs/public/turborepo-dark.svg rename to apps/api/public/turborepo-dark.svg diff --git a/apps/docs/public/turborepo-light.svg b/apps/api/public/turborepo-light.svg similarity index 100% rename from apps/docs/public/turborepo-light.svg rename to apps/api/public/turborepo-light.svg diff --git a/apps/docs/public/vercel.svg b/apps/api/public/vercel.svg similarity index 100% rename from apps/docs/public/vercel.svg rename to apps/api/public/vercel.svg diff --git a/apps/docs/public/window.svg b/apps/api/public/window.svg similarity index 100% rename from apps/docs/public/window.svg rename to apps/api/public/window.svg diff --git a/apps/docs/tsconfig.json b/apps/api/tsconfig.json similarity index 100% rename from apps/docs/tsconfig.json rename to apps/api/tsconfig.json diff --git a/apps/web/package.json b/apps/web/package.json index 74d7027..a5a02d2 100644 --- a/apps/web/package.json +++ b/apps/web/package.json @@ -4,11 +4,11 @@ "type": "module", "private": true, "scripts": { - "dev": "next dev --port 3000", - "build": "next build", - "start": "next start", + "dev": "vite", + "build": "vite build", + "start": "vite preview", "lint": "eslint --max-warnings 0", - "check-types": "next typegen && tsc --noEmit" + "check-types": "tsc --noEmit" }, "dependencies": { "@ludops/shared": "workspace:^", diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..e69de29 diff --git a/packages/shared/index.ts b/packages/shared/index.ts new file mode 100644 index 0000000..dac0dcc --- /dev/null +++ b/packages/shared/index.ts @@ -0,0 +1,5 @@ +export interface AppStatus { + status: string; + version: string; + database: boolean; +} \ No newline at end of file diff --git a/packages/shared/package.json b/packages/shared/package.json new file mode 100644 index 0000000..6534213 --- /dev/null +++ b/packages/shared/package.json @@ -0,0 +1,7 @@ +{ + "name": "@ludops/shared", + "version": "0.0.0", + "private": true, + "main": "./index.ts", + "types": "./index.ts" +} \ No newline at end of file diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index a6af0c0..c022e60 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -18,8 +18,11 @@ importers: specifier: 5.9.2 version: 5.9.2 - apps/docs: + apps/api: dependencies: + '@ludops/shared': + specifier: workspace:^ + version: link:../../packages/shared '@repo/ui': specifier: workspace:* version: link:../../packages/ui @@ -57,6 +60,9 @@ importers: apps/web: dependencies: + '@ludops/shared': + specifier: workspace:^ + version: link:../../packages/shared '@repo/ui': specifier: workspace:* version: link:../../packages/ui @@ -128,6 +134,8 @@ importers: specifier: ^8.50.0 version: 8.50.0(eslint@9.39.1)(typescript@5.9.2) + packages/shared: {} + packages/typescript-config: {} packages/ui: @@ -733,6 +741,7 @@ packages: eslint-config-prettier@10.1.1: resolution: {integrity: sha512-4EQQr6wXwS+ZJSzaR5ZCrYgLxqvUjdXctaEtBqHcbkW944B1NQyO4qpdHQbXBONfwxXdkAY81HH4+LUfrg+zPw==} + hasBin: true peerDependencies: eslint: '>=7.0.0' @@ -773,6 +782,7 @@ packages: eslint@9.39.1: resolution: {integrity: sha512-BhHmn2yNOFA9H9JmmIVKJmd288g9hrVRDkdoIgRCRuSySRUHH7r/DI6aAXW9T1WwUuY3DFgrcaqB+deURBLR5g==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + hasBin: true peerDependencies: jiti: '*' peerDependenciesMeta: @@ -1118,6 +1128,7 @@ packages: next@16.2.0: resolution: {integrity: sha512-NLBVrJy1pbV1Yn00L5sU4vFyAHt5XuSjzrNyFnxo6Com0M0KrL6hHM5B99dbqXb2bE9pm4Ow3Zl1xp6HVY9edQ==} engines: {node: '>=20.9.0'} + hasBin: true peerDependencies: '@opentelemetry/api': ^1.1.0 '@playwright/test': ^1.51.1 diff --git a/turbo.json b/turbo.json index 452ba54..800a468 100644 --- a/turbo.json +++ b/turbo.json @@ -4,8 +4,7 @@ "tasks": { "build": { "dependsOn": ["^build"], - "inputs": ["$TURBO_DEFAULT$", ".env*"], - "outputs": [".next/**", "!.next/cache/**"] + "outputs": ["dist/**", ".dist/**"] }, "lint": { "dependsOn": ["^lint"] @@ -18,4 +17,4 @@ "persistent": true } } -} +} \ No newline at end of file