From 558dadd0f81e7bae635b8e7c4b23b861bbb3fa61 Mon Sep 17 00:00:00 2001 From: Jackson M Meade Date: Wed, 25 Feb 2026 01:50:21 -0500 Subject: [PATCH] feat: add turbo to track shared package changes --- .github/workflows/deploy-base.yml | 46 ++++++--- package-lock.json | 151 ++++++++++++++++++++++++++++++ package.json | 2 + turbo.json | 5 + 4 files changed, 191 insertions(+), 13 deletions(-) create mode 100644 turbo.json diff --git a/.github/workflows/deploy-base.yml b/.github/workflows/deploy-base.yml index 9cf5d3b1..d7235b83 100644 --- a/.github/workflows/deploy-base.yml +++ b/.github/workflows/deploy-base.yml @@ -67,25 +67,45 @@ jobs: with: fetch-depth: 2 + - name: Set up Node.js + if: inputs.target == '' + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: Cache node_modules + if: inputs.target == '' + uses: actions/cache@v4 + with: + path: node_modules + key: deploy-node-modules-${{ runner.os }}-node20-${{ hashFiles('package-lock.json') }} + + - name: Install dependencies + if: inputs.target == '' + run: npm ci + - name: Detect Build Target id: detect_targets run: | if [ -n "${{ inputs.target }}" ]; then echo "Using provided target: ${{ inputs.target }}" - TARGETS="${{ inputs.target }}" - else - echo "Detecting targets from git diff..." - TARGETS=$(git diff --name-only HEAD~1..HEAD | grep '^apps' | cut -d '/' -f 2 | sort -u) - fi - - if [ -z "$TARGETS" ] ; then - echo "No targets found. Exiting." - echo "TARGETS=[]" >> $GITHUB_OUTPUT - echo "HAS_TARGETS=false" >> $GITHUB_OUTPUT - else - echo "TARGETS=$TARGETS" - echo "TARGETS=$(echo "$TARGETS" | jq -R -s -c 'split("\n") | map(select(length > 0))')" >> $GITHUB_OUTPUT + TARGETS=$(echo "${{ inputs.target }}" | jq -R -s -c 'split("\n") | map(select(length > 0))') + echo "TARGETS=$TARGETS" >> $GITHUB_OUTPUT echo "HAS_TARGETS=true" >> $GITHUB_OUTPUT + else + echo "Detecting affected app targets (Turborepo)..." + export TURBO_SCM_BASE=HEAD^ + export TURBO_SCM_HEAD=HEAD + TARGETS=$(npx turbo ls --affected --output=json | jq -c '[.packages.items[] | select(.path | startswith("apps/")) | .path | split("/")[1]] | unique | sort') + if [ "$TARGETS" = "[]" ] || [ -z "$TARGETS" ]; then + echo "No affected app targets found." + echo "TARGETS=[]" >> $GITHUB_OUTPUT + echo "HAS_TARGETS=false" >> $GITHUB_OUTPUT + else + echo "TARGETS=$TARGETS" + echo "TARGETS=$TARGETS" >> $GITHUB_OUTPUT + echo "HAS_TARGETS=true" >> $GITHUB_OUTPUT + fi fi - name: Generate Unique Build ID diff --git a/package-lock.json b/package-lock.json index 9ef6de82..1aa3bc36 100644 --- a/package-lock.json +++ b/package-lock.json @@ -39,6 +39,7 @@ "ts-node": "^10.9.2", "tsup": "^8.4.0", "tsx": "^4.21.0", + "turbo": "^2.3.0", "typescript": "^5.6.2", "typescript-eslint": "^8.55.0", "wait-on": "^8.0.1" @@ -1412,6 +1413,7 @@ "cpu": [ "arm" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1428,6 +1430,7 @@ "cpu": [ "arm64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1444,6 +1447,7 @@ "cpu": [ "x64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1460,6 +1464,7 @@ "cpu": [ "arm64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1476,6 +1481,7 @@ "cpu": [ "x64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1492,6 +1498,7 @@ "cpu": [ "arm64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1508,6 +1515,7 @@ "cpu": [ "x64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1524,6 +1532,7 @@ "cpu": [ "arm" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1540,6 +1549,7 @@ "cpu": [ "arm64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1556,6 +1566,7 @@ "cpu": [ "ia32" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1572,6 +1583,7 @@ "cpu": [ "loong64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1588,6 +1600,7 @@ "cpu": [ "mips64el" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1604,6 +1617,7 @@ "cpu": [ "ppc64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1620,6 +1634,7 @@ "cpu": [ "riscv64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1636,6 +1651,7 @@ "cpu": [ "s390x" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1652,6 +1668,7 @@ "cpu": [ "x64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1668,6 +1685,7 @@ "cpu": [ "x64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1684,6 +1702,7 @@ "cpu": [ "x64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1700,6 +1719,7 @@ "cpu": [ "x64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1716,6 +1736,7 @@ "cpu": [ "arm64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1732,6 +1753,7 @@ "cpu": [ "ia32" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1748,6 +1770,7 @@ "cpu": [ "x64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1814,6 +1837,7 @@ "cpu": [ "ppc64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1830,6 +1854,7 @@ "cpu": [ "arm" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1846,6 +1871,7 @@ "cpu": [ "arm64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1862,6 +1888,7 @@ "cpu": [ "x64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1878,6 +1905,7 @@ "cpu": [ "arm64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1894,6 +1922,7 @@ "cpu": [ "x64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1910,6 +1939,7 @@ "cpu": [ "arm64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1926,6 +1956,7 @@ "cpu": [ "x64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1942,6 +1973,7 @@ "cpu": [ "arm" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1958,6 +1990,7 @@ "cpu": [ "arm64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1974,6 +2007,7 @@ "cpu": [ "ia32" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1990,6 +2024,7 @@ "cpu": [ "loong64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2006,6 +2041,7 @@ "cpu": [ "mips64el" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2022,6 +2058,7 @@ "cpu": [ "ppc64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2038,6 +2075,7 @@ "cpu": [ "riscv64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2054,6 +2092,7 @@ "cpu": [ "s390x" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2070,6 +2109,7 @@ "cpu": [ "x64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2086,6 +2126,7 @@ "cpu": [ "arm64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2102,6 +2143,7 @@ "cpu": [ "x64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2118,6 +2160,7 @@ "cpu": [ "arm64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2134,6 +2177,7 @@ "cpu": [ "x64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2150,6 +2194,7 @@ "cpu": [ "arm64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2166,6 +2211,7 @@ "cpu": [ "x64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2182,6 +2228,7 @@ "cpu": [ "arm64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2198,6 +2245,7 @@ "cpu": [ "ia32" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2214,6 +2262,7 @@ "cpu": [ "x64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -12470,6 +12519,108 @@ "@esbuild/win32-x64": "0.27.2" } }, + "node_modules/turbo": { + "version": "2.8.10", + "resolved": "https://registry.npmjs.org/turbo/-/turbo-2.8.10.tgz", + "integrity": "sha512-OxbzDES66+x7nnKGg2MwBA1ypVsZoDTLHpeaP4giyiHSixbsiTaMyeJqbEyvBdp5Cm28fc+8GG6RdQtic0ijwQ==", + "dev": true, + "license": "MIT", + "bin": { + "turbo": "bin/turbo" + }, + "optionalDependencies": { + "turbo-darwin-64": "2.8.10", + "turbo-darwin-arm64": "2.8.10", + "turbo-linux-64": "2.8.10", + "turbo-linux-arm64": "2.8.10", + "turbo-windows-64": "2.8.10", + "turbo-windows-arm64": "2.8.10" + } + }, + "node_modules/turbo-darwin-64": { + "version": "2.8.10", + "resolved": "https://registry.npmjs.org/turbo-darwin-64/-/turbo-darwin-64-2.8.10.tgz", + "integrity": "sha512-A03fXh+B7S8mL3PbdhTd+0UsaGrhfyPkODvzBDpKRY7bbeac4MDFpJ7I+Slf2oSkCEeSvHKR7Z4U71uKRUfX7g==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/turbo-darwin-arm64": { + "version": "2.8.10", + "resolved": "https://registry.npmjs.org/turbo-darwin-arm64/-/turbo-darwin-arm64-2.8.10.tgz", + "integrity": "sha512-sidzowgWL3s5xCHLeqwC9M3s9M0i16W1nuQF3Mc7fPHpZ+YPohvcbVFBB2uoRRHYZg6yBnwD4gyUHKTeXfwtXA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/turbo-linux-64": { + "version": "2.8.10", + "resolved": "https://registry.npmjs.org/turbo-linux-64/-/turbo-linux-64-2.8.10.tgz", + "integrity": "sha512-YK9vcpL3TVtqonB021XwgaQhY9hJJbKKUhLv16osxV0HkcQASQWUqR56yMge7puh6nxU67rQlTq1b7ksR1T3KA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/turbo-linux-arm64": { + "version": "2.8.10", + "resolved": "https://registry.npmjs.org/turbo-linux-arm64/-/turbo-linux-arm64-2.8.10.tgz", + "integrity": "sha512-3+j2tL0sG95iBJTm+6J8/45JsETQABPqtFyYjVjBbi6eVGdtNTiBmHNKrbvXRlQ3ZbUG75bKLaSSDHSEEN+btQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/turbo-windows-64": { + "version": "2.8.10", + "resolved": "https://registry.npmjs.org/turbo-windows-64/-/turbo-windows-64-2.8.10.tgz", + "integrity": "sha512-hdeF5qmVY/NFgiucf8FW0CWJWtyT2QPm5mIsX0W1DXAVzqKVXGq+Zf+dg4EUngAFKjDzoBeN6ec2Fhajwfztkw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/turbo-windows-arm64": { + "version": "2.8.10", + "resolved": "https://registry.npmjs.org/turbo-windows-arm64/-/turbo-windows-arm64-2.8.10.tgz", + "integrity": "sha512-QGdr/Q8LWmj+ITMkSvfiz2glf0d7JG0oXVzGL3jxkGqiBI1zXFj20oqVY0qWi+112LO9SVrYdpHS0E/oGFrMbQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, "node_modules/tweetnacl": { "version": "0.14.5", "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", diff --git a/package.json b/package.json index 687e3c33..5880e6c8 100644 --- a/package.json +++ b/package.json @@ -2,6 +2,7 @@ "name": "@wxyc/backend-services", "version": "1.0.0", "description": "All necessary app services for the WXYC flowsheet backend", + "packageManager": "npm@10.9.4", "scripts": { "typecheck": "npm run build --workspace=@wxyc/database --workspace=@wxyc/authentication && npm run typecheck --workspace=@wxyc/database --workspace=shared/** --workspace=apps/**", "lint": "eslint .", @@ -68,6 +69,7 @@ "supertest": "^7.0.0", "ts-jest": "^29.4.6", "ts-node": "^10.9.2", + "turbo": "^2.3.0", "tsup": "^8.4.0", "tsx": "^4.21.0", "typescript": "^5.6.2", diff --git a/turbo.json b/turbo.json new file mode 100644 index 00000000..0876743e --- /dev/null +++ b/turbo.json @@ -0,0 +1,5 @@ +{ + "tasks": { + "build": { "outputs": ["dist/**"] } + } +}