diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml index ee323bd..7bfbef8 100644 --- a/.gitea/workflows/build.yaml +++ b/.gitea/workflows/build.yaml @@ -12,8 +12,10 @@ jobs: steps: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 + - name: Checkout uses: actions/checkout@v4 + - name: Login to Container Registry if: ${{ gitea.event_name != 'pull_request' }} uses: docker/login-action@v3 @@ -35,33 +37,12 @@ jobs: type=sha flavor: | latest=true - - name: Generate legacy API Docker metadata - id: meta-legacy-api - uses: docker/metadata-action@v5 - with: - images: | - docker.valverde.cloud/commelechef/legacy-api - tags: | - type=ref,event=branch - type=ref,event=tag - type=ref,event=pr - type=sha - flavor: | - latest=true - name: Build uses: docker/build-push-action@v6 with: context: . - file: ./docker/website/Dockerfile + file: ./Dockerfile push: ${{ gitea.event_name != 'pull_request' }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} - - name: Build legacy API - uses: docker/build-push-action@v6 - with: - context: . - file: ./docker/legacy-api/Dockerfile - push: ${{ gitea.event_name != 'pull_request' }} - tags: ${{ steps.meta-legacy-api.outputs.tags }} - labels: ${{ steps.meta-legacy-api.outputs.labels }} diff --git a/.gitea/workflows/lint.yaml b/.gitea/workflows/lint.yaml index ce2029f..7c2ea16 100644 --- a/.gitea/workflows/lint.yaml +++ b/.gitea/workflows/lint.yaml @@ -17,9 +17,5 @@ jobs: uses: actions/checkout@v4 - name: Install dependencies run: bun install --frozen-lockfile - - name: Lint TypeScript common - run: npm -w packages/common run lint:tsc - - name: Lint TypeScript server - run: npm -w packages/server run lint:tsc - - name: Lint TypeScript webapp - run: npm -w packages/webapp run lint:tsc + - name: Lint TypeScript + run: npm run lint:tsc diff --git a/.gitignore b/.gitignore index a14702c..e4333bb 100644 --- a/.gitignore +++ b/.gitignore @@ -32,3 +32,5 @@ report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json # Finder (MacOS) folder config .DS_Store + +.turbo diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..1cec30f --- /dev/null +++ b/Dockerfile @@ -0,0 +1,24 @@ +FROM oven/bun:1 AS bun + +FROM node:20-trixie-slim + +COPY --from=bun /usr/local/bin/bun \ + /usr/local/bin/bunx \ + /usr/local/bin/ +WORKDIR /app + +COPY ./ ./ +RUN bun install --frozen-lockfile && \ + npm run build && \ + npm run lint:tsc && \ + # npm run lint:eslint && \ + npm run clean:cache && \ +\ + npm run clean:node && \ + bun install --frozen-lockfile --production && \ + find node_modules/proxy-from-env -type f -exec chmod 644 {} \; && \ + npx -w packages/server prisma generate && \ +\ + cd cms && \ + bun install --frozen-lockfile --production && \ + npm run build diff --git a/bun.lock b/bun.lock index 7a24ebc..b2dab9c 100644 --- a/bun.lock +++ b/bun.lock @@ -8,6 +8,7 @@ "@types/bun": "latest", "npm-check-updates": "^18.1.1", "npm-sort": "^0.0.4", + "turbo": "^2.5.6", "typescript": "^5.9.2", }, }, @@ -656,6 +657,20 @@ "tsx": ["tsx@4.20.5", "", { "dependencies": { "esbuild": "~0.25.0", "get-tsconfig": "^4.7.5" }, "optionalDependencies": { "fsevents": "~2.3.3" }, "bin": { "tsx": "dist/cli.mjs" } }, "sha512-+wKjMNU9w/EaQayHXb7WA7ZaHY6hN8WgfvHNQ3t1PnU91/7O8TcTnIhCDYTZwnt8JsO9IBqZ30Ln1r7pPF52Aw=="], + "turbo": ["turbo@2.5.6", "", { "optionalDependencies": { "turbo-darwin-64": "2.5.6", "turbo-darwin-arm64": "2.5.6", "turbo-linux-64": "2.5.6", "turbo-linux-arm64": "2.5.6", "turbo-windows-64": "2.5.6", "turbo-windows-arm64": "2.5.6" }, "bin": { "turbo": "bin/turbo" } }, "sha512-gxToHmi9oTBNB05UjUsrWf0OyN5ZXtD0apOarC1KIx232Vp3WimRNy3810QzeNSgyD5rsaIDXlxlbnOzlouo+w=="], + + "turbo-darwin-64": ["turbo-darwin-64@2.5.6", "", { "os": "darwin", "cpu": "x64" }, "sha512-3C1xEdo4aFwMJAPvtlPqz1Sw/+cddWIOmsalHFMrsqqydcptwBfu26WW2cDm3u93bUzMbBJ8k3zNKFqxJ9ei2A=="], + + "turbo-darwin-arm64": ["turbo-darwin-arm64@2.5.6", "", { "os": "darwin", "cpu": "arm64" }, "sha512-LyiG+rD7JhMfYwLqB6k3LZQtYn8CQQUePbpA8mF/hMLPAekXdJo1g0bUPw8RZLwQXUIU/3BU7tXENvhSGz5DPA=="], + + "turbo-linux-64": ["turbo-linux-64@2.5.6", "", { "os": "linux", "cpu": "x64" }, "sha512-GOcUTT0xiT/pSnHL4YD6Yr3HreUhU8pUcGqcI2ksIF9b2/r/kRHwGFcsHgpG3+vtZF/kwsP0MV8FTlTObxsYIA=="], + + "turbo-linux-arm64": ["turbo-linux-arm64@2.5.6", "", { "os": "linux", "cpu": "arm64" }, "sha512-10Tm15bruJEA3m0V7iZcnQBpObGBcOgUcO+sY7/2vk1bweW34LMhkWi8svjV9iDF68+KJDThnYDlYE/bc7/zzQ=="], + + "turbo-windows-64": ["turbo-windows-64@2.5.6", "", { "os": "win32", "cpu": "x64" }, "sha512-FyRsVpgaj76It0ludwZsNN40ytHN+17E4PFJyeliBEbxrGTc5BexlXVpufB7XlAaoaZVxbS6KT8RofLfDRyEPg=="], + + "turbo-windows-arm64": ["turbo-windows-arm64@2.5.6", "", { "os": "win32", "cpu": "arm64" }, "sha512-j/tWu8cMeQ7HPpKri6jvKtyXg9K1gRyhdK4tKrrchH8GNHscPX/F71zax58yYtLRWTiK04zNzPcUJuoS0+v/+Q=="], + "type-check": ["type-check@0.4.0", "", { "dependencies": { "prelude-ls": "^1.2.1" } }, "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew=="], "typescript": ["typescript@5.9.2", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-CWBzXQrc/qOkhidw1OzBTQuYRbfyxDXJMVJ1XNwUHGROVmuaeiEm3OslpZ1RV96d7SKKjZKrSJu3+t/xlw3R9A=="], diff --git a/package.json b/package.json index aad0e54..a7fd466 100644 --- a/package.json +++ b/package.json @@ -1,12 +1,17 @@ { "name": "website", + "packageManager": "bun@1.2.22", "private": true, "workspaces": ["./packages/*"], + "scripts": { + "lint:tsc": "turbo lint:tsc" + }, "devDependencies": { "@effect/language-service": "^0.40.0", "@types/bun": "latest", "npm-check-updates": "^18.1.1", "npm-sort": "^0.0.4", + "turbo": "^2.5.6", "typescript": "^5.9.2" } } diff --git a/turbo.json b/turbo.json new file mode 100644 index 0000000..0c4fc0b --- /dev/null +++ b/turbo.json @@ -0,0 +1,32 @@ +{ + "$schema": "https://turbo.build/schema.json", + + "tasks": { + "build": { + "dependsOn": ["^build"], + "inputs": ["src/**"], + "outputs": ["dist/**"], + "cache": false + }, + + "lint:tsc": { + "cache": false + }, + "lint:eslint": { + "cache": false + }, + + "clean:cache": { + "dependsOn": ["^clean:cache"], + "cache": false + }, + "clean:dist": { + "dependsOn": ["^clean:dist"], + "cache": false + }, + "clean:node": { + "dependsOn": ["^clean:node"], + "cache": false + } + } +}