From 518420232580ed34d77399f189cb9fc8c2fb4e15 Mon Sep 17 00:00:00 2001 From: Igor Samokhovets Date: Sun, 19 Jul 2026 16:43:46 +0200 Subject: [PATCH] internal: adopt Turborepo task orchestration --- .github/workflows/ci.yml | 7 +++- .gitignore | 1 + .node-version | 1 + package.json | 24 ++++++----- packages/cli/package.json | 3 ++ packages/native/package.json | 7 +++- packages/schema/package.json | 5 ++- packages/studio/package.json | 5 ++- pnpm-lock.yaml | 64 +++++++++++++++++++++++++++++ rust-toolchain.toml | 4 ++ turbo.json | 79 ++++++++++++++++++++++++++++++++++++ 11 files changed, 186 insertions(+), 14 deletions(-) create mode 100644 .node-version create mode 100644 rust-toolchain.toml create mode 100644 turbo.json diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bd31307..f5c2ed3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,7 +31,7 @@ jobs: - name: Set up Node.js uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 with: - node-version: 24 + node-version-file: .node-version cache: pnpm - name: Set up Rust @@ -46,5 +46,10 @@ jobs: - name: Install dependencies run: pnpm install --frozen-lockfile + - name: Set up Turborepo cache + uses: rharkor/caching-for-turbo@75f8ebf4a43d2c60b23bc2a27082cfea94ffdad9 # v2.5.0 + with: + use-relative-cache-path: true + - name: Validate run: pnpm validate diff --git a/.gitignore b/.gitignore index 5f50de1..4713e26 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ node_modules/ packages/*/node_modules/ +.turbo/ packages/native/target/ packages/native/*.node packages/studio/dist/ diff --git a/.node-version b/.node-version new file mode 100644 index 0000000..3fe3b15 --- /dev/null +++ b/.node-version @@ -0,0 +1 @@ +24.13.0 diff --git a/package.json b/package.json index 5ab6bea..0a180a2 100644 --- a/package.json +++ b/package.json @@ -4,16 +4,19 @@ "private": true, "type": "module", "scripts": { - "build": "pnpm --filter @patchwave/schema build && pnpm --filter @patchwave/studio build && pnpm typecheck && pnpm --filter @patchwave/native build && pnpm --filter @patchwave/cli build", - "typecheck": "pnpm exec tsc --noEmit -p tsconfig.json", - "fmt": "oxfmt && cargo fmt --manifest-path packages/native/Cargo.toml", - "fmt:check": "oxfmt --check && cargo fmt --check --manifest-path packages/native/Cargo.toml", - "lint": "cargo clippy --manifest-path packages/native/Cargo.toml --all-targets -- -D warnings", - "test": "pnpm --filter @patchwave/schema test && pnpm --filter @patchwave/studio test && pnpm --filter @patchwave/cli test && pnpm test:native", - "test:native": "cargo test --manifest-path packages/native/Cargo.toml", - "bench:callback": "cargo test --release --manifest-path packages/native/Cargo.toml realtime::tests::maximum_patch_callback_budget_matrix -- --ignored --exact --nocapture", - "check": "pnpm typecheck && pnpm fmt:check && pnpm lint", - "validate": "pnpm build && pnpm check && pnpm test", + "build": "turbo run build typecheck:root", + "typecheck": "turbo run typecheck typecheck:root", + "typecheck:root": "tsc --noEmit -p tsconfig.json", + "fmt": "turbo run fmt fmt:root --cache=local:rw", + "fmt:root": "oxfmt . '!packages/cli/**' '!packages/schema/**' '!packages/studio/**'", + "fmt:check": "turbo run fmt:check fmt:check:root", + "fmt:check:root": "oxfmt --check . '!packages/cli/**' '!packages/schema/**' '!packages/studio/**'", + "lint": "turbo run lint", + "test": "turbo run test", + "test:native": "turbo run test --filter=@patchwave/native", + "bench:callback": "turbo run bench:callback --filter=@patchwave/native --cache=local:rw", + "check": "turbo run typecheck typecheck:root fmt:check fmt:check:root lint", + "validate": "turbo run build typecheck:root typecheck fmt:check fmt:check:root lint test", "validate:release": "pnpm validate && pnpm bench:callback", "patchwave": "pnpm --filter @patchwave/cli patchwave" }, @@ -21,6 +24,7 @@ "@patchwave/schema": "workspace:*", "@types/node": "24.13.3", "oxfmt": "^0.59.0", + "turbo": "2.10.5", "typescript": "7.0.2" }, "engines": { diff --git a/packages/cli/package.json b/packages/cli/package.json index a1eacfe..b194468 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -5,7 +5,10 @@ "type": "module", "scripts": { "build": "tsc --noEmit", + "typecheck": "tsc --noEmit", "test": "tsx --test test/**/*.test.ts", + "fmt": "oxfmt package.json src test tsconfig.json", + "fmt:check": "oxfmt --check package.json src test tsconfig.json", "patchwave": "tsx src/index.ts" }, "dependencies": { diff --git a/packages/native/package.json b/packages/native/package.json index eb96f7b..c4a7a48 100644 --- a/packages/native/package.json +++ b/packages/native/package.json @@ -9,7 +9,12 @@ "main": "index.js", "types": "index.d.ts", "scripts": { - "build": "napi build --platform --release" + "build": "napi build --platform --release", + "test": "cargo test --manifest-path Cargo.toml", + "lint": "cargo clippy --manifest-path Cargo.toml --all-targets -- -D warnings", + "fmt": "cargo fmt --manifest-path Cargo.toml", + "fmt:check": "cargo fmt --check --manifest-path Cargo.toml", + "bench:callback": "cargo test --release --manifest-path Cargo.toml realtime::tests::maximum_patch_callback_budget_matrix -- --ignored --exact --nocapture" }, "devDependencies": { "@napi-rs/cli": "3.7.3" diff --git a/packages/schema/package.json b/packages/schema/package.json index f5b4f88..9f25355 100644 --- a/packages/schema/package.json +++ b/packages/schema/package.json @@ -11,7 +11,10 @@ }, "scripts": { "build": "tsc --noEmit", - "test": "tsx --test src/**/*.test.ts" + "typecheck": "tsc --noEmit", + "test": "tsx --test src/**/*.test.ts", + "fmt": "oxfmt package.json src tsconfig.json", + "fmt:check": "oxfmt --check package.json src tsconfig.json" }, "devDependencies": { "@types/node": "24.13.3", diff --git a/packages/studio/package.json b/packages/studio/package.json index 53e56ed..531c91f 100644 --- a/packages/studio/package.json +++ b/packages/studio/package.json @@ -15,8 +15,11 @@ }, "scripts": { "build": "vite build && tsc --noEmit", + "typecheck": "tsc --noEmit", "dev": "vite", - "test": "vite build && tsx --test test/**/*.test.ts && vitest run" + "test": "tsx --test test/**/*.test.ts && vitest run", + "fmt": "oxfmt package.json client src test tsconfig.json vite.config.ts", + "fmt:check": "oxfmt --check package.json client src test tsconfig.json vite.config.ts" }, "dependencies": { "@babel/types": "7.28.4", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index a9d763b..0a16ce5 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -17,6 +17,9 @@ importers: oxfmt: specifier: ^0.59.0 version: 0.59.0 + turbo: + specifier: 2.10.5 + version: 2.10.5 typescript: specifier: 7.0.2 version: 7.0.2 @@ -1413,6 +1416,36 @@ packages: peerDependencies: '@testing-library/dom': '>=7.21.4' + '@turbo/darwin-64@2.10.5': + resolution: {integrity: sha512-ENvPwy3x5yS7MwNYHeWjqOBXkwIMp39Pd+/zXC6PoiNzF8EIvvLZOZZ+ny6L9x4WgS5vxUii2LM5gM+zjPdnWw==} + cpu: [x64] + os: [darwin] + + '@turbo/darwin-arm64@2.10.5': + resolution: {integrity: sha512-rqROo9zsF/P9RqsdtbLD1nFJicjSrYyvQ9kNJC38AbxA3pAs6VAlATvtvOFx7bqOv6vicf20SP9kF33avJjy2w==} + cpu: [arm64] + os: [darwin] + + '@turbo/linux-64@2.10.5': + resolution: {integrity: sha512-RoSSiNFUxi27zLJuM9F6GyWWjHgLch9t6nwD6K0FkXRirZkTLlzIj6IhFnK8H9++nefLtdFqylE4vGjZAv6AAA==} + cpu: [x64] + os: [linux] + + '@turbo/linux-arm64@2.10.5': + resolution: {integrity: sha512-4ZComcpzmHGmVynQqvvi+iZOSq/tBvY1SltXB8g4NZRsrA01W8E+yRL8RNM+PLoyWsrCnJa8xa+DkWkv+xg4iQ==} + cpu: [arm64] + os: [linux] + + '@turbo/windows-64@2.10.5': + resolution: {integrity: sha512-eL2Iyj4DbMINq1Sr1w0iAi6nAiZOF16KSlRGwCJpVh+IWZeY33MAsLHVOBMj1xoFtncVJXclCVpTPL2nBoYkFg==} + cpu: [x64] + os: [win32] + + '@turbo/windows-arm64@2.10.5': + resolution: {integrity: sha512-sog+wP+8YSJrdWZ/rUJg8xghVTrwoG+BrSlDQpnK5fzSgJHn1INRWXbVWRH0d3vX8dBI01E3yxXRre9Dn+OXQA==} + cpu: [arm64] + os: [win32] + '@tybys/wasm-util@0.10.3': resolution: {integrity: sha512-F3fo1MYrRJYL3zER0OUOmkutjr1Vp23m7OsSgp7nq4SP6OqX6C/56XFIPAl5bt3zaBRjmW7SGz3u/6LwFpYcOg==} @@ -2066,6 +2099,10 @@ packages: engines: {node: '>=18.0.0'} hasBin: true + turbo@2.10.5: + resolution: {integrity: sha512-07Y/C7OUp23l4P92PJoYtFNbHjLhftrZH5Ce7dbczS4kX2Re+wtbXvZLoxn/pUtzgsQaRCBaRuZPJp4zmAn0WQ==} + hasBin: true + typanion@3.14.0: resolution: {integrity: sha512-ZW/lVMRabETuYCd9O9ZvMhAh8GslSqaUjxmK/JLPCh6l73CvLBiuXswj/+7LdnWOgYsQ130FqLzFz5aGT4I3Ug==} @@ -3150,6 +3187,24 @@ snapshots: dependencies: '@testing-library/dom': 10.4.1 + '@turbo/darwin-64@2.10.5': + optional: true + + '@turbo/darwin-arm64@2.10.5': + optional: true + + '@turbo/linux-64@2.10.5': + optional: true + + '@turbo/linux-arm64@2.10.5': + optional: true + + '@turbo/windows-64@2.10.5': + optional: true + + '@turbo/windows-arm64@2.10.5': + optional: true + '@tybys/wasm-util@0.10.3': dependencies: tslib: 2.8.1 @@ -3774,6 +3829,15 @@ snapshots: optionalDependencies: fsevents: 2.3.3 + turbo@2.10.5: + optionalDependencies: + '@turbo/darwin-64': 2.10.5 + '@turbo/darwin-arm64': 2.10.5 + '@turbo/linux-64': 2.10.5 + '@turbo/linux-arm64': 2.10.5 + '@turbo/windows-64': 2.10.5 + '@turbo/windows-arm64': 2.10.5 + typanion@3.14.0: {} typescript@7.0.2: diff --git a/rust-toolchain.toml b/rust-toolchain.toml new file mode 100644 index 0000000..308350f --- /dev/null +++ b/rust-toolchain.toml @@ -0,0 +1,4 @@ +[toolchain] +channel = "1.88.0" +components = ["clippy", "rustfmt"] +profile = "minimal" diff --git a/turbo.json b/turbo.json new file mode 100644 index 0000000..38cae35 --- /dev/null +++ b/turbo.json @@ -0,0 +1,79 @@ +{ + "$schema": "https://turborepo.com/schema.json", + "globalDependencies": [".node-version", "pnpm-lock.yaml", "rust-toolchain.toml"], + "globalEnv": ["CI", "RUNNER_ARCH", "RUNNER_OS"], + "tasks": { + "build": { + "dependsOn": ["^build"], + "outputs": [] + }, + "@patchwave/studio#build": { + "dependsOn": ["^build"], + "env": ["NODE_ENV", "VITE_*"], + "outputs": ["dist/**"] + }, + "@patchwave/native#build": { + "dependsOn": ["^build"], + "env": [ + "CARGO_BUILD_TARGET", + "CARGO_ENCODED_RUSTFLAGS", + "CC", + "CFLAGS", + "CXX", + "CXXFLAGS", + "MACOSX_DEPLOYMENT_TARGET", + "NAPI_RS_CLI_VERSION", + "PKG_CONFIG_LIBDIR", + "PKG_CONFIG_PATH", + "PKG_CONFIG_SYSROOT_DIR", + "RUSTC_WORKSPACE_WRAPPER", + "RUSTC_WRAPPER", + "RUSTFLAGS" + ], + "inputs": ["$TURBO_DEFAULT$", "../../rust-toolchain.toml"], + "outputs": ["patchwave-native.*.node"] + }, + "typecheck": { + "dependsOn": ["^typecheck"], + "outputs": [] + }, + "//#typecheck:root": { + "outputs": [] + }, + "test": { + "dependsOn": ["^build"], + "outputs": [] + }, + "@patchwave/studio#test": { + "dependsOn": ["build"], + "outputs": [] + }, + "@patchwave/native#test": { + "inputs": ["$TURBO_DEFAULT$", "../../fixtures/**", "../../rust-toolchain.toml"], + "outputs": [] + }, + "lint": { + "outputs": [] + }, + "@patchwave/native#lint": { + "inputs": ["$TURBO_DEFAULT$", "../../fixtures/**", "../../rust-toolchain.toml"], + "outputs": [] + }, + "fmt": { + "cache": false + }, + "//#fmt:root": { + "cache": false + }, + "fmt:check": { + "outputs": [] + }, + "//#fmt:check:root": { + "outputs": [] + }, + "bench:callback": { + "cache": false, + "inputs": ["$TURBO_DEFAULT$", "../../fixtures/**", "../../rust-toolchain.toml"] + } + } +}