From d472bd479ecf02debaec3e6bf0af2a80556e2958 Mon Sep 17 00:00:00 2001 From: Shintaro Jokagi Date: Tue, 3 Jun 2025 10:57:43 +1200 Subject: [PATCH 1/5] feat(turbo): integrate Turbo for task management and update CI pipeline to use Turbo commands --- .github/workflows/ci-pipeline.yml | 19 ++++++--- .gitignore | 4 +- package.json | 5 ++- pnpm-lock.yaml | 64 +++++++++++++++++++++++++++++++ turbo.json | 40 +++++++++++++++++++ 5 files changed, 123 insertions(+), 9 deletions(-) create mode 100644 turbo.json diff --git a/.github/workflows/ci-pipeline.yml b/.github/workflows/ci-pipeline.yml index 5d9da7d..27aa822 100644 --- a/.github/workflows/ci-pipeline.yml +++ b/.github/workflows/ci-pipeline.yml @@ -23,6 +23,7 @@ jobs: uses: actions/cache@v4 with: path: | + .turbo node_modules key: ${{ runner.os }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }} - name: Verify pnpm installation @@ -47,10 +48,11 @@ jobs: uses: actions/cache@v4 with: path: | + .turbo node_modules key: ${{ runner.os }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }} - name: Run Eslint check - run: pnpm run lint + run: turbo run lint prettier: runs-on: ubuntu-latest @@ -67,10 +69,11 @@ jobs: uses: actions/cache@v4 with: path: | + .turbo node_modules key: ${{ runner.os }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }} - name: Run Prettier check - run: pnpm run format:check + run: turbo run format cspell: runs-on: ubuntu-latest @@ -87,10 +90,11 @@ jobs: uses: actions/cache@v4 with: path: | + .turbo node_modules key: ${{ runner.os }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }} - name: Run cspell check - run: pnpm run spell + run: turbo run spell vitest: runs-on: ubuntu-latest @@ -107,10 +111,11 @@ jobs: uses: actions/cache@v4 with: path: | + .turbo node_modules key: ${{ runner.os }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }} - name: Run Vitest tests - run: pnpm vitest run + run: turbo vitest run build: runs-on: ubuntu-latest @@ -127,10 +132,11 @@ jobs: uses: actions/cache@v4 with: path: | + .turbo node_modules key: ${{ runner.os }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }} - name: Build project - run: pnpm run build + run: turbo run build - name: Upload build output uses: actions/upload-artifact@v4 with: @@ -155,6 +161,7 @@ jobs: uses: actions/cache@v4 with: path: | + .turbo node_modules key: ${{ runner.os }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }} - name: Install dependencies @@ -167,4 +174,4 @@ jobs: name: build path: dist - name: Run Playwright tests - run: pnpm run test:playwright + run: turbo run test:playwright diff --git a/.gitignore b/.gitignore index 5323fa6..ccf48a6 100644 --- a/.gitignore +++ b/.gitignore @@ -32,4 +32,6 @@ npm-debug.log* /coverage # cache -.eslintcache \ No newline at end of file +.eslintcache +# Turborepo +.turbo diff --git a/package.json b/package.json index fa8f945..2ad7313 100644 --- a/package.json +++ b/package.json @@ -16,8 +16,8 @@ "lint": "eslint . --max-warnings=0 --cache", "lint:fix": "eslint . --fix", "spell": "cspell \"src/**/*.{ts,tsx,js,jsx,astro,md,json,yml,yaml}\"", - "format": "prettier --write .", - "format:check": "prettier --check . --cache", + "format": "prettier . --check --cache", + "format:fix": "prettier . --write --cache --list-different", "commitlint": "commitlint --edit", "test": "vitest run", "test:coverage": "vitest --coverage", @@ -91,6 +91,7 @@ "prettier": "3.5.3", "prettier-plugin-astro": "0.14.1", "prettier-plugin-tailwindcss": "^0.6.11", + "turbo": "^2.5.4", "typescript-eslint": "8.33.0", "vite-tsconfig-paths": "5.1.4", "vitest": "3.1.3", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 17fdf12..426ce18 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -201,6 +201,9 @@ importers: prettier-plugin-tailwindcss: specifier: ^0.6.11 version: 0.6.12(prettier-plugin-astro@0.14.1)(prettier@3.5.3) + turbo: + specifier: ^2.5.4 + version: 2.5.4 typescript-eslint: specifier: 8.33.0 version: 8.33.0(eslint@9.27.0(jiti@2.4.2))(typescript@5.6.3) @@ -4465,6 +4468,40 @@ packages: tslib@2.8.1: resolution: {integrity: sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==} + turbo-darwin-64@2.5.4: + resolution: {integrity: sha512-ah6YnH2dErojhFooxEzmvsoZQTMImaruZhFPfMKPBq8sb+hALRdvBNLqfc8NWlZq576FkfRZ/MSi4SHvVFT9PQ==} + cpu: [x64] + os: [darwin] + + turbo-darwin-arm64@2.5.4: + resolution: {integrity: sha512-2+Nx6LAyuXw2MdXb7pxqle3MYignLvS7OwtsP9SgtSBaMlnNlxl9BovzqdYAgkUW3AsYiQMJ/wBRb7d+xemM5A==} + cpu: [arm64] + os: [darwin] + + turbo-linux-64@2.5.4: + resolution: {integrity: sha512-5May2kjWbc8w4XxswGAl74GZ5eM4Gr6IiroqdLhXeXyfvWEdm2mFYCSWOzz0/z5cAgqyGidF1jt1qzUR8hTmOA==} + cpu: [x64] + os: [linux] + + turbo-linux-arm64@2.5.4: + resolution: {integrity: sha512-/2yqFaS3TbfxV3P5yG2JUI79P7OUQKOUvAnx4MV9Bdz6jqHsHwc9WZPpO4QseQm+NvmgY6ICORnoVPODxGUiJg==} + cpu: [arm64] + os: [linux] + + turbo-windows-64@2.5.4: + resolution: {integrity: sha512-EQUO4SmaCDhO6zYohxIjJpOKRN3wlfU7jMAj3CgcyTPvQR/UFLEKAYHqJOnJtymbQmiiM/ihX6c6W6Uq0yC7mA==} + cpu: [x64] + os: [win32] + + turbo-windows-arm64@2.5.4: + resolution: {integrity: sha512-oQ8RrK1VS8lrxkLriotFq+PiF7iiGgkZtfLKF4DDKsmdbPo0O9R2mQxm7jHLuXraRCuIQDWMIw6dpcr7Iykf4A==} + cpu: [arm64] + os: [win32] + + turbo@2.5.4: + resolution: {integrity: sha512-kc8ZibdRcuWUG1pbYSBFWqmIjynlD8Lp7IB6U3vIzvOv9VG+6Sp8bzyeBWE3Oi8XV5KsQrznyRTBPvrf99E4mA==} + hasBin: true + type-check@0.4.0: resolution: {integrity: sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==} engines: {node: '>= 0.8.0'} @@ -9949,6 +9986,33 @@ snapshots: tslib@2.8.1: {} + turbo-darwin-64@2.5.4: + optional: true + + turbo-darwin-arm64@2.5.4: + optional: true + + turbo-linux-64@2.5.4: + optional: true + + turbo-linux-arm64@2.5.4: + optional: true + + turbo-windows-64@2.5.4: + optional: true + + turbo-windows-arm64@2.5.4: + optional: true + + turbo@2.5.4: + optionalDependencies: + turbo-darwin-64: 2.5.4 + turbo-darwin-arm64: 2.5.4 + turbo-linux-64: 2.5.4 + turbo-linux-arm64: 2.5.4 + turbo-windows-64: 2.5.4 + turbo-windows-arm64: 2.5.4 + type-check@0.4.0: dependencies: prelude-ls: 1.2.1 diff --git a/turbo.json b/turbo.json new file mode 100644 index 0000000..058731d --- /dev/null +++ b/turbo.json @@ -0,0 +1,40 @@ +{ + "$schema": "https://turborepo.com/schema.json", + "tasks": { + "dev": { + "cache": false, + "persistent": true, + "outputs": [] + }, + "lint": { + "cache": true, + "inputs": ["**/*{ts,tsx,js,jsx,astro}"], + "outputs": [] + }, + "format": { + "cache": true, + "inputs": ["**/*.{ts,tsx,js,jsx,astro,json,yml,yaml}"], + "outputs": [] + }, + "build": { + "cache": true, + "outputs": [".dist/**"] + }, + "test": { + "cache": true, + "inputs": ["**/*.{ts,tsx,js,jsx}"], + "outputs": [] + }, + "spell": { + "cache": true, + "inputs": ["src/**/*.{ts,tsx,js,jsx,astro,md,json,yml,yaml}"], + "outputs": [] + }, + "test:playwright": { + "cache": true, + "inputs": ["**/*.{ts,tsx,js,jsx}"], + "outputs": ["playwright-report/**", "test-results/**"] + } + }, + "ui": "tui" +} From 2dc109ccc5286ccf6e4201161bcffa32c5e4a703 Mon Sep 17 00:00:00 2001 From: Shintaro Jokagi Date: Tue, 3 Jun 2025 10:58:37 +1200 Subject: [PATCH 2/5] fix(turbo): correct output path for build task in turbo.json --- turbo.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/turbo.json b/turbo.json index 058731d..9f023e3 100644 --- a/turbo.json +++ b/turbo.json @@ -18,7 +18,7 @@ }, "build": { "cache": true, - "outputs": [".dist/**"] + "outputs": ["dist/**"] }, "test": { "cache": true, From 4b9d6ba81b1b97ea67fe848420d9df31aa7047e2 Mon Sep 17 00:00:00 2001 From: Shintaro Jokagi Date: Tue, 3 Jun 2025 11:04:04 +1200 Subject: [PATCH 3/5] fix(ci-pipeline): update commands to use pnpm exec --- .github/workflows/ci-pipeline.yml | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci-pipeline.yml b/.github/workflows/ci-pipeline.yml index 27aa822..56c80a0 100644 --- a/.github/workflows/ci-pipeline.yml +++ b/.github/workflows/ci-pipeline.yml @@ -52,7 +52,7 @@ jobs: node_modules key: ${{ runner.os }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }} - name: Run Eslint check - run: turbo run lint + run: pnpm exec turbo run lint prettier: runs-on: ubuntu-latest @@ -73,7 +73,7 @@ jobs: node_modules key: ${{ runner.os }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }} - name: Run Prettier check - run: turbo run format + run: pnpm exec turbo run format cspell: runs-on: ubuntu-latest @@ -94,7 +94,7 @@ jobs: node_modules key: ${{ runner.os }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }} - name: Run cspell check - run: turbo run spell + run: pnpm exec turbo run spell vitest: runs-on: ubuntu-latest @@ -115,7 +115,7 @@ jobs: node_modules key: ${{ runner.os }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }} - name: Run Vitest tests - run: turbo vitest run + run: pnpm exec turbo vitest run build: runs-on: ubuntu-latest @@ -136,7 +136,7 @@ jobs: node_modules key: ${{ runner.os }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }} - name: Build project - run: turbo run build + run: pnpm exec turbo run build - name: Upload build output uses: actions/upload-artifact@v4 with: @@ -164,8 +164,6 @@ jobs: .turbo node_modules key: ${{ runner.os }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }} - - name: Install dependencies - run: pnpm install --frozen-lockfile - name: Install Playwright Browsers run: pnpm exec playwright install --with-deps - name: Download build output @@ -174,4 +172,4 @@ jobs: name: build path: dist - name: Run Playwright tests - run: turbo run test:playwright + run: pnpm exec turbo run test:playwright From 449bd00c473f8337b270b6c9b276caba02dc7965 Mon Sep 17 00:00:00 2001 From: Shintaro Jokagi Date: Tue, 3 Jun 2025 11:09:55 +1200 Subject: [PATCH 4/5] fix(ci-pipeline): update vitest command to use test script --- .github/workflows/ci-pipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-pipeline.yml b/.github/workflows/ci-pipeline.yml index 56c80a0..27f2e6e 100644 --- a/.github/workflows/ci-pipeline.yml +++ b/.github/workflows/ci-pipeline.yml @@ -115,7 +115,7 @@ jobs: node_modules key: ${{ runner.os }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }} - name: Run Vitest tests - run: pnpm exec turbo vitest run + run: pnpm exec turbo test build: runs-on: ubuntu-latest From 4fccd01331dcc98ef5f8913270b113d8dfe7ef74 Mon Sep 17 00:00:00 2001 From: Shintaro Jokagi Date: Tue, 3 Jun 2025 11:14:51 +1200 Subject: [PATCH 5/5] fix(ci-pipeline): update cache keys to use GitHub SHA for better cache management --- .github/workflows/ci-pipeline.yml | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci-pipeline.yml b/.github/workflows/ci-pipeline.yml index 27f2e6e..4131ae1 100644 --- a/.github/workflows/ci-pipeline.yml +++ b/.github/workflows/ci-pipeline.yml @@ -25,7 +25,9 @@ jobs: path: | .turbo node_modules - key: ${{ runner.os }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }} + key: ${{ runner.os }}-turbo-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-turbo- - name: Verify pnpm installation run: pnpm --version - name: Install dependencies @@ -50,7 +52,9 @@ jobs: path: | .turbo node_modules - key: ${{ runner.os }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }} + key: ${{ runner.os }}-turbo-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-turbo- - name: Run Eslint check run: pnpm exec turbo run lint @@ -71,7 +75,9 @@ jobs: path: | .turbo node_modules - key: ${{ runner.os }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }} + key: ${{ runner.os }}-turbo-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-turbo- - name: Run Prettier check run: pnpm exec turbo run format @@ -92,7 +98,9 @@ jobs: path: | .turbo node_modules - key: ${{ runner.os }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }} + key: ${{ runner.os }}-turbo-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-turbo- - name: Run cspell check run: pnpm exec turbo run spell @@ -113,7 +121,9 @@ jobs: path: | .turbo node_modules - key: ${{ runner.os }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }} + key: ${{ runner.os }}-turbo-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-turbo- - name: Run Vitest tests run: pnpm exec turbo test @@ -134,7 +144,9 @@ jobs: path: | .turbo node_modules - key: ${{ runner.os }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }} + key: ${{ runner.os }}-turbo-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-turbo- - name: Build project run: pnpm exec turbo run build - name: Upload build output @@ -163,7 +175,9 @@ jobs: path: | .turbo node_modules - key: ${{ runner.os }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }} + key: ${{ runner.os }}-turbo-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-turbo- - name: Install Playwright Browsers run: pnpm exec playwright install --with-deps - name: Download build output